예제 #1
0
 /**
  * 手动录入工单
  */
 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();
     }
 }