/** * 问题类型编辑 */ private function _qEdit() { if ($this->_isPost()) { $_POST['form_table'] = str_replace('\\', '', $_POST['form_table']); $_POST['form_table'] = 'return ' . $_POST['form_table'] . ';'; $formTable = eval($_POST['form_table']); $formTable = serialize($formTable); $updateArr = array('game_type_id' => $_POST['game_type_id'], 'title' => $_POST['title'], 'form_table' => $formTable); if ($this->_modelQuestionType->update($updateArr, "Id={$_POST['Id']}")) { $this->_utilMsg->showMsg('编辑成功', 1); } else { $this->_utilMsg->showMsg('编辑失败', 1); } } else { $gameTypeList = Model::getTtwoArrConvertOneArr($this->_modelSysconfig->getValueToCache('game_type'), 'Id', 'name'); $this->_view->assign('gameListSelect', $gameTypeList); $dataList = $this->_modelQuestionType->findById($_GET['Id'], false); $dataList['form_table'] = unserialize($dataList['form_table']); $dataList['form_table'] = var_export($dataList['form_table'], true); $this->_view->assign('list', $dataList); $this->_utilMsg->createNavBar(); $this->_view->set_tpl(array('body' => 'SysManagement/QuestionEdit.html')); $this->_view->display(); } }
/** * 添加问题 */ public function actionAdd() { if ($this->_isPost()) { $this->_modelWorkOrderDetail = $this->_getGlobalData('Model_WorkOrderDetail', 'object'); $this->_modelWorkOrderQa = $this->_getGlobalData('Model_WorkOrderQa', 'object'); #------获取问题类型额外信息------# $questionType = $this->_modelQuestionType->findById($_POST['question_type']); $questionFormTable = $questionType['form_table']; $questionFormTableKey = $this->_modelQuestionType->getTtwoArrConvertOneArr($questionFormTable, 'name', 'name'); $formDetail = array(); if (!empty($questionFormTableKey)) { foreach ($questionFormTableKey as $value) { if ($value == null) { continue; } $formDetail[$value] = $_POST[$value]; } } #------获取问题类型额外信息------# #------生成工单work_order------# $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object'); $userClass = $this->_utilRbac->getUserClass(); //获取用户资料, $userName = $userClass['_nickName']; $workOrder = array('game_type' => $_POST['game_type'], 'question_type' => $_POST['question_type'], 'source' => 5, 'question_num' => 1, 'create_time' => CURRENT_TIME, 'title' => $_POST['title']); if ($_POST['game_server_id']) { #------获取服务器ID和运营商ID------# list($workOrder['operator_id'], $workOrder['game_server_id']) = explode(',', $_POST['game_server_id']); unset($formDetail['game_server_id']); //删除服务器列表数组 #------获取服务器ID和运营商ID------# } $this->_modelWorkOrder->add($workOrder); $workOrderId = $this->_modelWorkOrder->returnLastInsertId(); //获取工单id #------生成工单work_order------# #------生成工单详细信息------# $userDetail = array('nick_name' => $userName); $detail = array('user_data' => $userDetail, 'form_detail' => $formDetail); $addWorkOrderDetailArr = array('work_order_id' => $workOrderId, 'content' => serialize($detail)); $this->_modelWorkOrderDetail->add($addWorkOrderDetailArr); #------生成工单详细信息------# #------生成工单提问信息------# $addWorkOrderQaArr = array('work_order_id' => $workOrderId, 'content' => $_POST['description'], 'create_time' => CURRENT_TIME); $this->_modelWorkOrderQa->add($addWorkOrderQaArr); #------生成工单提问回复信息------# #------增加问题队列到队列------# $this->_utilWorkOrder = $this->_getGlobalData('Util_WorkOrder', 'object'); $orderManage = $this->_utilWorkOrder->getOrderManage(); $workOrder['Id'] = $workOrderId; $orderManage->addOrder($workOrder); $orderManage->setUpdateInfo(1); #------增加问题队列到队列------# $this->_utilMsg->showMsg('工单提问成功', 1, Tools::url(CONTROL, 'Index', 1)); } }
/** * 官网提问 */ private function _saveSource1() { $orderArr = array(); #------获取用户信息------# $orderArr['user_nickname'] = strip_tags($_POST['user_nickname']); $orderArr['money'] = $_POST['money_total']; #------获取用户信息------# $orderArr['game_type'] = $_POST['game_id']; $orderArr['user_account'] = $_POST['user_account'] ? strip_tags($_POST['user_account']) : 0; $orderArr['source'] = $_POST['source']; //工单来源 $orderArr['title'] = strip_tags($_POST['title']); $orderArr['question_num'] = 1; $orderArr['create_time'] = CURRENT_TIME; $orderArr['question_type'] = $_POST['question_type']; $orderArr['vip_level'] = 0; $orderArr['operator_id'] = $_POST['operator_id']; $orderArr['game_server_id'] = $_POST['game_server_id']; $orderArr['game_user_id'] = trim($_POST['user_id']); $gameServerList = $this->_getGlobalData('gameser_list'); $roomId = $gameServerList[$orderArr['game_server_id']]['room_id']; //获取房间ID,这个服务器属于哪个工作区的 if ($roomId) { $orderArr['room_id'] = $gameServerList[$orderArr['game_server_id']]['room_id']; } $this->_modelGameOperator = $this->_getGlobalData('Model_GameOperator', 'object'); $gameOperatorIndex = $this->_modelGameOperator->findByGidOId($_POST['game_id'], $_POST['operator_id']); //找到此运营商的详细 资料. if (!$gameOperatorIndex) { //未找到游戏与运营商的索引 $this->_returnAjaxJson(array('status' => 0, 'info' => 'game server non-existent', 'data' => null)); } $orderArr['vip_level'] = $this->_modelGameOperator->getVipLevel($gameOperatorIndex['vip_setup']['vip_pay'], $_POST['money_total']); $orderArr['timeout'] = $this->_modelGameOperator->getTimeOut($gameOperatorIndex['vip_setup']['vip_timeout'], $orderArr['vip_level']); $orderArr['timeout'] *= 60; //换成秒 $orderArr['is_verify'] = 0; if (!$this->_modelWorkOrder->add($orderArr)) { //创建表单失败 $this->_returnAjaxJson(array('status' => 0, 'info' => 'Failure to create order', 'data' => null)); } $workOrderId = $this->_modelWorkOrder->returnLastInsertId(); //获取工单id #------追加日志------# $this->_modelOrderLog = $this->_getGlobalData('Model_OrderLog', 'object'); $this->_modelOrderLog->addLog(array('game_type_id' => $orderArr['game_type'], 'operator_id' => $orderArr['operator_id'], 'server_id' => $orderArr['game_server_id'], 'Id' => $workOrderId), Model_OrderLog::ASK); #------追加日志------# #------增加新的工单到队列------# if ($orderArr['room_id']) { $addOrder = array('Id' => $workOrderId, 'vip_level' => $orderArr['vip_level'], 'room_id' => $orderArr['room_id'], 'game_type_id' => $orderArr['game_type'], 'operator_id' => $orderArr['operator_id']); $this->_utilWorkOrder = $this->_getGlobalData('Util_WorkOrder', 'object'); $orderManageClass = $this->_utilWorkOrder->getOrderManage(); $orderManageClass->addOrder($addOrder); $orderManageClass = null; } #------增加新的工单到队列------# $orderDetail = array(); $this->_modelQuestionType = $this->_getGlobalData('Model_QuestionType', 'object'); $orderDetail['form_detail'] = array(); #------获取问题类型额外信息------# $questionType = $this->_modelQuestionType->findById($_POST['question_type']); $questionFormTable = $questionType['form_table']; $questionFormTableKey = Model::getTtwoArrConvertOneArr($questionFormTable, 'name', 'name'); if (!empty($questionFormTableKey)) { foreach ($questionFormTableKey as $value) { if ($value == null) { continue; } $orderDetail['form_detail'][$value] = $_POST[$value]; } } #------获取问题类型额外信息------# $orderDetail['user_data'] = array('user_id' => $_POST['user_id'], 'user_account' => $_POST['user_account'], 'user_nickname' => $_POST['user_nickname'], 'money_total' => $_POST['money_total'], 'money_month' => $_POST['money_month'], 'register_date' => $_POST['register_date'], 'ip' => $_POST['ip']); $orderDetail = serialize($orderDetail); $this->_modelWorkOrderDetail = $this->_getGlobalData('Model_WorkOrderDetail', 'object'); $this->_modelWorkOrderDetail->add(array('work_order_id' => $workOrderId, 'content' => $orderDetail)); #-----插入对话表------# $this->_modelWorkOrderQa = $this->_getGlobalData('Model_WorkOrderQa', 'object'); $content = strip_tags($_POST['content']); if ($_POST['upload_img']) { //如果有post专过来的图片路径 $content .= '<br>玩家截图:'; foreach ($_POST['upload_img'] as $imgPath) { $content .= "<br><img src='{$imgPath}' /><hr size='1' /></br>"; } } $orderDialog = array('user_id' => 0, 'game_type_id' => $_POST['game_id'], 'operator_id' => $orderArr['operator_id'], 'work_order_id' => $workOrderId, 'qa' => '0', 'content' => $content, 'create_time' => CURRENT_TIME); $this->_modelWorkOrderQa->add($orderDialog); #-----插入对话表------# eaccelerator_rm('question_' . $orderArr['user_account']); eaccelerator_put('question_' . $orderArr['user_account'], md5($orderArr['user_account'] . $orderArr['title']), 60); $this->_returnAjaxJson(array('status' => 1, 'info' => null, 'data' => array('order_id' => $workOrderId, 'room_id' => $orderArr['room_id']))); }
/** * 查看工单详细 */ public function actionDetail() { $dataList = $this->_modelWorkOrder->findByIdToDetail($_GET['Id']); $dialogList = $this->_modelWorkOrderQa->findByWorkOrderId($_GET['Id']); #------载入缓存------# $gameTypeArr = Model::getTtwoArrConvertOneArr($this->_modelSysconfig->getValueToCache('game_type'), 'Id', 'name'); //游戏类型 $workOrderSourceArr = $this->_modelSysconfig->getValueToCache('workorder_source'); //工单来源 $workOrderStatusArr = $this->_modelSysconfig->getValueToCache('workorder_status'); //工单状态 $gameServerList = $this->_getGlobalData('gameser_list'); $gameServerList = Model::getTtwoArrConvertOneArr($gameServerList, 'Id', 'server_name'); $operatorList = $this->_getGlobalData('operator_list'); $operatorList = Model::getTtwoArrConvertOneArr($operatorList, 'Id', 'operator_name'); $user = $this->_getGlobalData('user'); $departmentList = $this->_getGlobalData('department'); $departmentList = Model::getTtwoArrConvertOneArr($departmentList, 'Id', 'name'); #------载入缓存------# #------跟椐ID转换文字显示------# $dataList['word_status'] = $workOrderStatusArr[$dataList['status']]; $dataList['word_game_type'] = $gameTypeArr[$dataList['game_type']]; $dataList['word_source'] = $workOrderSourceArr[$dataList['source']]; $dataList['word_game_server_id'] = $gameServerList[$dataList['game_server_id']]; $dataList['word_operator_id'] = $operatorList[$dataList['operator_id']]; $dataList['create_time'] = date('Y-m-d H:i', $dataList['create_time']); $dataList['word_quality_id'] = $dataList['quality_id'] < 0 ? $user[$dataList['quality_id']]['nick_name'] . "[{$departmentList[$user[$dataList['quality_id']]['department_id']]}]" : '未质检'; #------跟椐ID转换文字显示------# $user = Model::getTtwoArrConvertOneArr($user, 'user_name', 'full_name'); foreach ($dialogList as &$list) { $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']); $list['word_reply_name'] = $user[$list['reply_name']]; } $workOrderDetailArr = unserialize($dataList['content']); //获取工单的详细信息 $userData = $workOrderDetailArr['user_data']; //获取提交工单用户的详细信息 $userData['register_date'] = $userData['register_date'] ? date('Y-m-d H:i:s', $userData['register_date']) : ''; if ($dataList['evaluation_status'] != 0) { //如果已经评价 $playerEvaluation = $this->_getGlobalData('player_evaluation'); $evaluation = $playerEvaluation[$dataList['evaluation_status']]; $evaluation = $evaluation['title']; if ($dataList['evaluation_status'] == 3) { $evaluation .= ': ' . $workOrderDetailArr['other']['ev']; } $this->_view->assign('evaluation', $evaluation); } if ($dataList['source'] != 2) { //如果工单不是从游戏里面来的话 $userQuestionDetail = $workOrderDetailArr['form_detail']; //获取提问类型工单的值 $questionDetail = $this->_modelQuestionType->findById($dataList['question_type']); //查找问题类型 $dataList['word_question_type'] = $questionDetail['title']; //获取问题类型的中文名称以方便显示 $questionDetail = $questionDetail['form_table']; //获取问题类型的表单配置值 $userQuestionDetailArr = array(); //初始化显示提交问题类型数组 if ($questionDetail) { foreach ($questionDetail as $value) { //将表单转换为key/value方式,方便显示 if ($value['type'] == 'game_server_list') { continue; } //如果为服务器列表将跳过,因为已经在工单上面有了. switch ($value['type']) { case 'select': $userQuestionDetailArr[$value['title']] = $value['options'][$userQuestionDetail[$value['name']]]; break; default: $userQuestionDetailArr[$value['title']] = $userQuestionDetail[$value['name']]; break; } } } } unset($workOrderStatusArr[1]); //删除待处理状态 unset($workOrderStatusArr[4]); //删除被玩家删除状态 $this->_view->assign('workOrderStatusArr', $workOrderStatusArr); $this->_view->assign('userData', $userData); $this->_view->assign('userQuestionDetailArr', $userQuestionDetailArr); //问题类型显示 $this->_view->assign('dialogArr', $dialogList); //对话详细 $this->_view->assign('data', $dataList); //表单详细信息 $this->_view->assign('js', $this->_view->get_curJs()); $this->_url['Verify_OrderVerify'] = Tools::url('Verify', 'OrderVerify', array('work_order_id' => $_GET['Id'], 'game_type_id' => $dataList['game_type'], 'operator_id' => $dataList['operator_id'], 'game_server_id' => $dataList['game_server_id'], 'game_user_id' => $userData['user_id'], 'user_account' => urlencode($userData['user_account']), 'user_nickname' => urlencode($userData['user_nickname']))); $this->_view->assign('url', $this->_url); $this->_utilMsg->createNavBar(); $this->_view->display(); /* #----------第一种方式----------# $dataList = $this->_modelWorkOrder->findByIdDetail ( $_GET ['Id'] ); //获取工单整个数组,包括关联表 $dialogArr = $dataList; //列表详细 $dataList = $dataList [0]; //客服与用户的对话数组 #------载入缓存------# $gameTypeArr = Model::getTtwoArrConvertOneArr ( $this->_modelSysconfig->getValueToCache ( 'game_type' ), 'Id', 'name' ); //游戏类型 $workOrderSourceArr = $this->_modelSysconfig->getValueToCache ( 'workorder_source' ); //工单来源 $workOrderStatusArr = $this->_modelSysconfig->getValueToCache ( 'workorder_status' ); //工单状态 $gameSerList = $this->_modelGameSerList->findById ( $dataList ['game_server_id'] ); $operatorList = $this->_modelOperatorList->findById ( $dataList ['operator_id'] ); #------载入缓存------# foreach ( $dialogArr as &$list ) { $list ['qa_time'] = date ( 'Y-m-d H:i:s', $list ['qa_time'] ); } $workOrderDetailArr = unserialize ( $dataList ['detail'] ); //获取工单的详细信息 $userData = $workOrderDetailArr ['user_data']; //获取提交工单用户的详细信息 $userQuestionDetail = $workOrderDetailArr ['form_detail']; //获取提问类型工单的值 $questionDetail = $this->_modelQuestionType->findById ( $dataList ['question_type'] ); //查找问题类型 $user=$this->_getGlobalData('user'); $departmentList=$this->_getGlobalData('department'); $departmentList=Model::getTtwoArrConvertOneArr($departmentList,'Id','name'); #------跟椐ID转换文字显示------# $dataList ['word_question_type'] = $questionDetail ['title']; //获取问题类型的中文名称以方便显示 $dataList ['word_game_type'] = $gameTypeArr [$dataList ['game_type']]; $dataList ['word_source'] = $workOrderSourceArr [$dataList ['source']]; $dataList ['word_status'] = $workOrderStatusArr [$dataList ['status']]; $dataList ['word_game_server_id'] = $gameSerList ['server_name']; $dataList ['word_operator_id'] = $operatorList ['operator_name']; $dataList ['create_time'] = date ( 'Y-m-d H:i', $dataList ['create_time'] ); $dataList['word_quality_id']=($dataList['quality_id']<0)?$user[$dataList['quality_id']]['nick_name']."[{$departmentList[$user[$dataList['quality_id']]['department_id']]}]":'未质检'; #------跟椐ID转换文字显示------# $questionDetail = $questionDetail ['form_table']; //获取问题类型的表单配置值 $userQuestionDetailArr = array (); //初始化显示提交问题类型数组 if ($questionDetail) { foreach ( $questionDetail as $value ) { //将表单转换为key/value方式,方便显示 if ($value ['type'] == 'game_server_list') continue; //如果为服务器列表将跳过,因为已经在工单上面有了. switch ($value ['type']) { case 'select' : { $userQuestionDetailArr [$value ['title']] = $value ['options'] [$userQuestionDetail [$value ['name']]]; break; } default : { $userQuestionDetailArr [$value ['title']] = $userQuestionDetail [$value ['name']]; break; } } } } $this->_view->assign ( 'workOrderStatusArr', $workOrderStatusArr ); $this->_view->assign ( 'userData', $userData ); $this->_view->assign ( 'userQuestionDetailArr', $userQuestionDetailArr ); //问题类型显示 $this->_view->assign ( 'dialogArr', $dialogArr ); //对话详细 $this->_view->assign ( 'data', $dataList ); //表单详细信息 $this->_view->assign ( 'js', $this->_view->get_curJs () ); $this->_url ['Verify_OrderVerify']=Tools::url('Verify','OrderVerify',array('work_order_id'=>$_GET ['Id'])); $this->_view->assign('url',$this->_url); $this->_view->display ();*/ #----------第一种方式----------# }
/** * 察看详细 */ public function actionQualityDetail() { #------初始化------# $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object'); #------初始化------# if ($this->_isPost()) { switch ($_POST['submit_type']) { case '0': //质检 $this->_utilMsg->showMsg(false); break; case '1': //申诉 if ($this->_modelQuality->update(array('status' => $_POST['status'], 'complain_content' => $_POST['complain_content'], 'complain_time' => CURRENT_TIME), "Id={$_POST['Id']}")) { $this->_utilMsg->showMsg(false); } else { $this->_utilMsg->showMsg('申请失败', -2); } break; default: //默认回复申诉 $updateArr = array('status' => $_POST['status'], 'reply_content' => $_POST['reply_content'], 'reply_time' => CURRENT_TIME); if ($_POST['status'] == 3) { $updateArr['scores'] = '0'; } //如果申诉为同意申诉,将把扣分设置为0,不扣分; if ($this->_modelQuality->update($updateArr, "Id={$_POST['Id']}")) { $this->_utilMsg->showMsg(false); } else { $this->_utilMsg->showMsg('回复申诉失败', -2); } break; } } else { #------初始化------# $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object'); $this->_modelSysconfig = $this->_getGlobalData('Model_Sysconfig', 'object'); $this->_modelGameSerList = $this->_getGlobalData('Model_GameSerList', 'object'); $this->_modelOperatorList = $this->_getGlobalData('Model_OperatorList', 'object'); $this->_modelQuestionType = $this->_getGlobalData('Model_QuestionType', 'object'); $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object'); $user = $this->_getGlobalData('user'); $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object'); #------初始化------# #------质检详细------# $qualityOptions = $this->_getGlobalData('quality_options'); $qualityList = $this->_modelQuality->findByQaId($_GET['qa_id']); $qualityList['word_option_id'] = $qualityOptions[$qualityList['option_id']]; $qualityList['word_status'] = $this->_statusOptions[$qualityList['status']]; $qualityList['word_quality_user_id'] = $user[$qualityList['quality_user_id']]['full_name']; $qualityList['word_again_user_id'] = $user[$qualityList['again_user_id']]['full_name']; $qualityList['reply_time'] = $qualityList['reply_time'] ? date('Y-m-d H:i:s', $qualityList['reply_time']) : ''; $qualityList['quality_time'] = $qualityList['quality_time'] ? date('Y-m-d H:i:s', $qualityList['quality_time']) : ''; $qualityList['complain_time'] = $qualityList['complain_time'] ? date('Y-m-d H:i:s', $qualityList['complain_time']) : ''; $qualityList['again_time'] = $qualityList['again_time'] ? date('Y-m-d H:i:s', $qualityList['again_time']) : ''; #------质检详细------# $dataList = $this->_modelWorkOrder->findByIdDetail($_GET['work_order_id']); //获取工单整个数组,包括关联表 if (!$dataList) { $this->_utilMsg->showMsg('内容错误,请联系管理员', -2); } //防止错误 $dialogArr = $dataList; //客服与用户的对话数组 $dataList = $dataList[0]; //列表详细 #------载入缓存------# $gameTypeArr = Model::getTtwoArrConvertOneArr($this->_modelSysconfig->getValueToCache('game_type'), 'Id', 'name'); //游戏类型 $workOrderSourceArr = $this->_modelSysconfig->getValueToCache('workorder_source'); //工单来源 $workOrderStatusArr = $this->_modelSysconfig->getValueToCache('workorder_status'); //工单状态 $gameSerList = $this->_modelGameSerList->findById($dataList['game_server_id']); $operatorList = $this->_modelOperatorList->findById($dataList['operator_id']); #------载入缓存------# $user = Model::getTtwoArrConvertOneArr($user, 'user_name', 'full_name'); foreach ($dialogArr as &$list) { $list['qa_time'] = date('Y-m-d H:i:s', $list['qa_time']); $list['word_reply_name'] = $user[$list['reply_name']]; } $workOrderDetailArr = unserialize($dataList['detail']); //获取工单的详细信息 $userData = $workOrderDetailArr['user_data']; //获取提交工单用户的详细信息 $userData['register_date'] = date('Y-m-d H:i:s', $userData['register_date']); $userQuestionDetail = $workOrderDetailArr['form_detail']; //获取提问类型工单的值 $questionDetail = $this->_modelQuestionType->findById($dataList['question_type']); //查找问题类型 #------跟椐ID转换文字显示------# $dataList['word_question_type'] = $questionDetail['title']; //获取问题类型的中文名称以方便显示 $dataList['word_game_type'] = $gameTypeArr[$dataList['game_type']]; $dataList['word_source'] = $workOrderSourceArr[$dataList['source']]; $dataList['word_status'] = $workOrderStatusArr[$dataList['status']]; $dataList['word_game_server_id'] = $gameSerList['server_name']; $dataList['word_operator_id'] = $operatorList['operator_name']; $dataList['create_time'] = date('Y-m-d H:i', $dataList['create_time']); $dataList['word_quality_id'] = $user[$dataList['quality_id']]['full_name']; #------跟椐ID转换文字显示------# $questionDetail = $questionDetail['form_table']; //获取问题类型的表单配置值 $userQuestionDetailArr = array(); //初始化显示提交问题类型数组 if (count($questionDetail)) { foreach ($questionDetail as $value) { //将表单转换为key/value方式,方便显示 if ($value['type'] == 'game_server_list') { continue; } //如果为服务器列表将跳过,因为已经在工单上面有了. switch ($value['type']) { case 'select': $userQuestionDetailArr[$value['title']] = $value['options'][$userQuestionDetail[$value['name']]]; break; default: $userQuestionDetailArr[$value['title']] = $userQuestionDetail[$value['name']]; break; } } } $this->_view->assign('qualityList', $qualityList); $this->_view->assign('workOrderStatusArr', $workOrderStatusArr); $this->_view->assign('userData', $userData); $this->_view->assign('userQuestionDetailArr', $userQuestionDetailArr); //问题类型显示 $this->_view->assign('dialogArr', $dialogArr); //对话详细 $this->_view->assign('data', $dataList); //表单详细信息 $this->_view->assign('userClass', $this->_utilRbac->getUserClass()); $this->_utilMsg->createNavBar(); $this->_view->display(); } }
/** * 手动录入工单 */ public function actionManualEntry() { $gameTypes = $this->_getGlobalData('game_type'); $gameTypes = Model::getTtwoArrConvertOneArr($gameTypes, 'Id', 'name'); $operators = $this->_getGlobalData('operator_list'); $operators = Model::getTtwoArrConvertOneArr($operators, 'Id', 'operator_name'); $this->_modelQuestionType = $this->_getGlobalData('Model_QuestionType', 'Object'); $questionType = $this->_modelQuestionType->getGameQuestionType(); if ($this->_isPost()) { $_POST['game_type_id'] = intval($_POST['game_type_id']); $sendData['question_type'] = intval($_POST['questionType']); $sendData['game_user_id'] = intval($_POST['UserId']); //有些游戏可能要重新double($_POST['UserId']) $sendData['title'] = trim($_POST['title']); $sendData['content'] = $_POST['content']; if (!$sendData['question_type']) { $this->_utilMsg->showMsg('标题类型错误', -1); } if (!$sendData['game_user_id']) { $this->_utilMsg->showMsg('用户ID不能为空', -1); } if (!$sendData['title']) { $this->_utilMsg->showMsg('标题不能为空', -1); } if (!trim($sendData['content'])) { $this->_utilMsg->showMsg('内容不能为空', -1); } $sendOk = false; $errorInfo = Tools::getLang('SEND_MSG', __CLASS__); switch ($_POST['game_type_id']) { case 1: $gameServerList = $this->_getGlobalData('server/server_list_' . $_POST['game_type_id']); $gameServerUrl = $gameServerList[$_POST['server_id']]['server_url']; $this->_utilApiBto = $this->_getGlobalData('Util_ApiBto', 'object'); $sendUrl = $gameServerUrl . 'api_interface.php?action=FaqService&doaction=GetUserQuiz'; $this->_utilApiBto->addHttp($sendUrl, null, $sendData); $this->_utilApiBto->send(); $dataResult = $this->_utilApiBto->getResult(); //"$dataResult" = Array [3] // status = (int) 1 // info = (string:55) Submitted! Please wait for reply from CS with patience! // data = Array [8] // order_id = (int) 17 // user_id = (int) 1002 // user_account = (string:10) uwan188110 // user_nickname = (string:6) sdfsfs // money_month = (int) 390299 // money_total = (int) 570299 // register_date = (string:10) 1282743121 // server_marking = (string:6) S10009 if ($dataResult['status'] == 1) { $sendOk = true; } else { $errorInfo = $dataResult['info']; } break; case 2: $gameServerList = $this->_getGlobalData('server/server_list_' . $_POST['game_type_id']); $sendUrl = $gameServerList[$_POST['server_id']]['server_url']; $sendUrl .= 'php/interface.php?m=clerk&c=UserQuiz&a=SubmitByCs'; $this->_utilFRGInterface = $this->_getGlobalData('Util_FRGInterface', 'object'); $this->_utilFRGInterface->set_sendUrl($sendUrl); $sendData['_sign'] = md5(TAKE_KEY . CURRENT_TIME); $sendData['_verifycode'] = CURRENT_TIME; $this->_utilFRGInterface->setPost($sendData); $dataResult = $this->_utilFRGInterface->callInterface(); //"$dataResult" = Array [5] // msgno = (int) 0 // message = (string:0) // backurl = (string:0) // data = Array [3] // status = (int) 1 // info = (string:0) // data = Array [1] // order_id = (int) 64125 // backparams = (string:0) if ($dataResult['data']['status'] == 1) { $sendOk = 1; } else { $errorInfo = $dataResult['message']; } break; case 3: $gameServerList = $this->_getGlobalData('server/server_list_' . $_POST['game_type_id']); $gameServerUrl = $gameServerList[$_POST['server_id']]['server_url']; $utilHttpMInterface = $this->_getGlobalData('Util_HttpMInterface', 'object'); $sendData['userId'] = $sendData['game_user_id']; $sendData['questionType'] = $sendData['question_type']; unset($sendData['game_user_id'], $sendData['question_type']); $sendData['source'] = 3; $utilHttpMInterface->addHttp($gameServerUrl, 'question/saveQuestion', array(), $sendData); $utilHttpMInterface->send(); $data = $utilHttpMInterface->getResults(); $data = json_decode(array_shift($data), true); if ($data && $data['r'] === 0) { $sendOk = true; } //"$data" = Array [2] // r = (int) 0 // m = Array [1] // order_id = (int) 64113 break; case 4: $this->_utilMsg->showMsg('暂未开放', -1); break; case 5: $this->_utilMsg->showMsg('暂未开放', -1); break; case 6: $this->_utilMsg->showMsg('暂未开放', -1); break; case 7: $this->_utilMsg->showMsg('暂未开放', -1); break; default: $this->_utilMsg->showMsg('游戏选择错误', -1); } if ($sendOk) { $this->_utilMsg->showMsg('操作成功', 1); } else { $this->_utilMsg->showMsg($errorInfo, -1); } } else { $this->_modelGameOperator = $this->_getGlobalData('Model_GameOperator', 'object'); $servers = $this->_modelGameOperator->getGmOptSev(); $this->_view->assign('gameTypes', json_encode($gameTypes)); $this->_view->assign('operators', json_encode($operators)); $this->_view->assign('servers', json_encode($servers)); $this->_view->assign('questionType', json_encode($questionType)); $this->_utilMsg->createNavBar(); $this->_view->display(); } }
public function actionIndex() { #------初始化------# $this->_loadCore('Help_Page'); $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object'); $this->_modelSysconfig = $this->_getGlobalData('Model_Sysconfig', 'object'); $this->_modelQuestionType = $this->_getGlobalData('Model_QuestionType', 'object'); $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object'); $this->_utilRooms = $this->_getGlobalData('Util_Rooms', 'object'); $this->_utilOnline = $this->_getGlobalData('Util_Online', 'object'); $workOrderStatusArr = $this->_modelSysconfig->getValueToCache('workorder_status'); $gameTypeArr = Model::getTtwoArrConvertOneArr($this->_modelSysconfig->getValueToCache('game_type'), 'Id', 'name'); $operatorList = $this->_getGlobalData('operator_list'); $operatorList = Model::getTtwoArrConvertOneArr($operatorList, 'Id', 'operator_name'); #------初始化------# $userClass = $this->_utilRbac->getUserClass(); $roomId = $userClass['_roomId']; if ($roomId) { // $this->_utilMsg->showMsg('请先加入房间',-1,Tools::url('Group','Index')); $roomClass = $this->_utilRooms->getRoom($roomId); $this->_view->assign('roomClass', $roomClass); } $userGameTypes = $userClass->getUserGameTypeIds(); //获取用户能控制的游戏ids $userOperatorIds = $userClass->getUserOperatorIds(); //获取用户能控制的运营商ids if (!count($userGameTypes) && !count($userOperatorIds)) { $this->_utilMsg->showMsg('请先设置用户运营商权限', -1, Tools::url('Group', 'Room')); } //如果用户没有权限将退出 $onlineUsers = $this->_utilOnline->getOnlineUser('user_id'); //在线用户,一维数组,value值为user_id #------分页生成sql------# $this->_loadCore('Help_SqlSearch'); $helpSqlSearch = new Help_SqlSearch(); $helpSqlSearch->set_tableName($this->_modelWorkOrder->tName()); // $helpSqlSearch->set_conditions("room_id={$roomId}"); //只显示房间内的 if ($_GET['Id']) { $helpSqlSearch->set_conditions("Id={$_GET['Id']}"); $this->_view->assign('selectedId', $_GET['Id']); } if ($_GET['vip_level'] != '') { //如果设置了vip等级,将显示等级 $helpSqlSearch->set_conditions("vip_level={$_GET['vip_level']}"); $this->_view->assign('selectedVipLevel', $_GET['vip_level']); } if ($_GET['order_status']) { $helpSqlSearch->set_conditions("status={$_GET['order_status']}"); $this->_view->assign('selectedOrderStatus', $_GET['order_status']); $helpSqlSearch->set_orderBy('create_time desc'); } else { $helpSqlSearch->set_orderBy('status asc,create_time desc'); } $helpSqlSearch->set_conditions("owner_user_id={$userClass['_id']}"); if ($_GET['user_nickname']) { $helpSqlSearch->set_conditions("user_nickname='{$_GET['user_nickname']}'"); $this->_view->assign('selectedUserNickname', $_GET['user_nickname']); $_GET['user_nickname'] = urlencode($_GET['user_nickname']); } if ($_GET['user_account']) { $helpSqlSearch->set_conditions("user_account='{$_GET['user_account']}'"); $this->_view->assign('selectedUserAccount', $_GET['user_account']); $_GET['user_account'] = urlencode($_GET['user_account']); } if ($_GET['title']) { $helpSqlSearch->set_conditions("title like '%{$_GET['title']}%'"); $this->_view->assign('selectedTitle', $_GET['title']); $_GET['title'] = urlencode($_GET['title']); } $helpSqlSearch->setPageLimit($_GET['page'], PAGE_SIZE); $sql = $helpSqlSearch->createSql(); $conditions = $helpSqlSearch->get_conditions(); $helpPage = new Help_Page(array('total' => $this->_modelWorkOrder->findCount($conditions), 'perpage' => PAGE_SIZE)); #------分页生成sql------# $dataList = $this->_modelWorkOrder->select($sql); #------载入缓存------# $workOrderSourceArr = $this->_modelSysconfig->getValueToCache('workorder_source'); $vipLevel = array('0' => '普通', '1' => '一级', '2' => '二级', '3' => '三级', '4' => '四级', '5' => '五级', '6' => '六级', '' => '所有'); $users = $this->_getGlobalData('user'); $serverList = $this->_getGlobalData('gameser_list'); $serverList = Model::getTtwoArrConvertOneArr($serverList, 'Id', 'server_name'); #------载入缓存------# if ($dataList) { Tools::import('Util_FontColor'); foreach ($dataList as &$list) { $list['url_dialog'] = Tools::url(CONTROL, 'OrderDialog', array('Id' => $list['Id'])); $list['word_game_type'] = Util_FontColor::getGameTypeColor($list['game_type'], $gameTypeArr[$list['game_type']]); $list['word_source'] = Util_FontColor::getWorkOrderSource($list['source'], $workOrderSourceArr[$list['source']]); $list['word_status'] = Util_FontColor::getWorkOrderStatus($list['status'], $workOrderStatusArr[$list['status']]); $list['word_operator_id'] = $operatorList[$list['operator_id']]; $questionArr = $this->_modelQuestionType->findById($list['question_type']); $list['word_question_type'] = $questionArr['title'] ? $questionArr['title'] : '游戏提问'; $list['url_detail'] = Tools::url('WorkOrder', 'Detail', array('Id' => $list['Id'])); $list['word_owner_user_id'] = $users[$list['owner_user_id']]['nick_name']; $list['word_game_server_id'] = $serverList[$list['game_server_id']]; if ($list['status'] == 1) { $isTimeout = Tools::isTimeOut($list['create_time'], $list['timeout']); if ($isTimeout === true) { //已超时 $list['time_out_true'] = true; } else { //未超时 $list['lost_time'] = Tools::getTimeFormat($isTimeout); } } $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']); if ($list['word_owner_user_id']) { $list['word_owner_user_id'] .= in_array($list['owner_user_id'], $onlineUsers) ? Util_FontColor::getOnline(1) : Util_FontColor::getOnline(0); } } $this->_view->assign('dataList', $dataList); } $userOperator = $userClass['_operatorIds']; foreach ($userOperator as &$value) { $value['word_operator_id'] = $operatorList[$value['operator_id']]; $value['word_game_type_id'] = $gameTypeArr[$value['game_type_id']]; } $this->_view->assign('userClass', $userClass); $this->_view->assign('userOperator', $userOperator); $this->_view->assign('vipLevel', $vipLevel); $workOrderStatusArr[''] = '所有'; $this->_view->assign('workOrderStatusArr', $workOrderStatusArr); $this->_view->assign('js', $this->_view->get_curJs()); $this->_view->assign('pageBox', $helpPage->show()); $this->_utilMsg->createNavBar(); $this->_view->display(); }