/**
  * 礼包卡号统计
  */
 public function actionLibaoCardState()
 {
     if (!$_REQUEST['game_type_id']) {
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'not game_type_id', 'data' => null));
     }
     if (!$_REQUEST['server_mark']) {
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'not server_mark', 'data' => null));
     }
     if (!$_REQUEST['type_id']) {
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'not type_id', 'data' => null));
     }
     if (!$_REQUEST['time']) {
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'not time', 'data' => null));
     }
     $this->_modelGameSerList = $this->_getGlobalData('Model_GameSerList', 'object');
     $serverDetail = $this->_modelGameSerList->findByMarking($_REQUEST['game_type_id'], $_REQUEST['server_mark']);
     if (!$serverDetail) {
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'game server non-existent'));
     }
     $cardId = $_REQUEST['type_id'];
     $time = $_REQUEST['time'];
     $this->_utilApiFrg = $this->_getGlobalData('Util_ApiFrg', 'object');
     $getArr = array('c' => 'Card', 'a' => 'ImportCard', 'doaction' => 'state');
     $postArr = array('type_id' => $cardId, 'DateTime' => $time);
     $this->_utilApiFrg->addHttp($serverDetail['Id'], $getArr, $postArr);
     $this->_utilApiFrg->send();
     $data = $this->_utilApiFrg->getResult();
     if ($data) {
         $this->_returnAjaxJson(array('status' => 1, 'info' => null, 'data' => $data));
     } else {
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'game server error', 'data' => null));
     }
 }
Example #2
0
 private function _createCache()
 {
     if ($this->_modelGameSerList->createToCache()) {
         $this->_utilMsg->showMsg('缓存生成成功', 1);
     } else {
         $this->_utilMsg->showMsg('缓存生成失败', -2);
     }
 }
Example #3
0
 private function _createCache()
 {
     if ($this->_modelGameSerList->createToCache()) {
         $this->_utilMsg->showMsg(Tools::getLang('UPDATE_SUCCESS', 'Common'), 1);
     } else {
         $this->_utilMsg->showMsg(Tools::getLang('UPDATE_ERROR', 'Common'), -2);
     }
 }
Example #4
0
 /**
  * 删除房间内的指定服务器
  */
 private function _delServer()
 {
     if ($_POST['server_list'] && $this->_isPost()) {
         $this->_modelGameSerList = $this->_getGlobalData('Model_GameSerList', 'object');
         $updateServer = implode(',', $_POST['server_list']);
         if ($this->_modelGameSerList->update(array('room_id' => '0'), "Id in ({$updateServer})")) {
             $this->_modelGameSerList->createToCache();
             $this->_utilMsg->showMsg(Tools::getLang('DEL_SUCESS', 'Common'));
         } else {
             $this->_utilMsg->showMsg(Tools::getLang('DEL_ERROR', 'Common'), -2);
         }
     }
 }
Example #5
0
 /**
  * 删除房间内的指定服务器
  */
 private function _delServer()
 {
     if ($_POST['server_list'] && $this->_isPost()) {
         $this->_modelGameSerList = $this->_getGlobalData('Model_GameSerList', 'object');
         $updateServer = implode(',', $_POST['server_list']);
         if ($this->_modelGameSerList->update(array('room_id' => '0'), "Id in ({$updateServer})")) {
             $this->_modelGameSerList->createToCache();
             $this->_utilMsg->showMsg('删除指定服务器列表成功');
         } else {
             $this->_utilMsg->showMsg('删除指定服务器列表失败.', -2);
         }
     }
 }
 public function actionWorkOrderList()
 {
     $userInfo = array('user_account' => trim($_REQUEST['user_account']), 'game_user_id' => trim($_REQUEST['user_id']), 'user_nickname' => trim(urldecode($_REQUEST['user_nickname'])));
     $userInfo = array_filter($userInfo);
     //检查用户信息是否都为空
     if (!$userInfo) {
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'player empty', 'data' => null));
     }
     $gameId = intval($_REQUEST['game_id']);
     if (!$gameId) {
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'error game_id', 'data' => null));
     }
     $serverMarking = trim($_REQUEST['server_marking']);
     if (empty($serverMarking)) {
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'server_marking empty', 'data' => null));
     }
     $this->_modelGameSerList = $this->_getGlobalData('Model_GameSerList', 'object');
     $gameServerList = $this->_modelGameSerList->findByMarking($gameId, $serverMarking);
     if (!$gameServerList) {
         //未找到服务器
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'game server non-existent', 'data' => null));
     }
     $status = intval($_REQUEST['status']);
     $ev = trim($_REQUEST['ev']);
     $page = max(1, intval($_REQUEST['page']));
     $pageSize = intval($_REQUEST['page_size']);
     if ($pageSize < 1 || $pageSize > 100) {
         $pageSize = 10;
     }
     $this->_loadCore('Help_SqlSearch');
     //载入sql工具
     $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object');
     $helpSqlSearch = new Help_SqlSearch();
     $helpSqlSearch->set_tableName($this->_modelWorkOrder->tName());
     $helpSqlSearch->set_field('Id as id,question_type as type,title,create_time as update_time,evaluation_status as ev,status,evaluation_desc as ev_desc,is_read');
     //指定玩家
     $helpSqlSearch->set_conditions(key($userInfo) . "='" . current($userInfo) . "'");
     //来自游戏的工单
     $helpSqlSearch->set_conditions('source=2');
     //来自哪个游戏
     $helpSqlSearch->set_conditions("is_vip='0'");
     $helpSqlSearch->set_conditions("game_type={$gameId}");
     //确定某个服务器
     $helpSqlSearch->set_conditions("game_server_id={$gameServerList['Id']}");
     //处理状态,0:待受理(包括:1未受理,2受理中),3:已答复 ,4:删除的 ,-1: 表示全部
     if ($status != -1) {
         if ($status == 0) {
             $helpSqlSearch->set_conditions('status>=1');
             $helpSqlSearch->set_conditions('status<=2');
         } else {
             $helpSqlSearch->set_conditions('status=3');
         }
     } else {
         $helpSqlSearch->set_conditions('status<>4');
     }
     //评价状态
     if ($ev == '0') {
         $helpSqlSearch->set_conditions('evaluation_status=0');
     } elseif ($ev) {
         $helpSqlSearch->set_conditions('evaluation_status=' . intval($ev));
     }
     //分页
     $helpSqlSearch->setPageLimit($page, $pageSize);
     //排序
     $helpSqlSearch->set_orderBy('is_read,Id desc');
     $sql = $helpSqlSearch->createSql();
     $conditions = $helpSqlSearch->get_conditions();
     $dataList = $this->_modelWorkOrder->select($sql);
     $total = $this->_modelWorkOrder->findCount($conditions);
     $returnData = array('list' => $dataList, 'query_status' => $status, 'total' => $total, 'page' => $page);
     $this->_returnAjaxJson(array('status' => 1, 'info' => CONTROL . '_' . ACTION, 'data' => $returnData));
 }
Example #7
0
 /**
  * 察看详细
  */
 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();
     }
 }
Example #8
0
 public function PayForGold($postArr, $gameId = 2)
 {
     //$gameId = 2兼容富人国
     if (!$postArr['server_id']) {
         return array('status' => -1, 'msg' => '请选择服务器', 'href' => 1);
     }
     if (!$postArr['card']) {
         return array('status' => -1, 'msg' => '请输入卡号', 'href' => 1);
     }
     if (!$postArr['use_name']) {
         return array('status' => -1, 'msg' => '请输入用户名', 'href' => 1);
     }
     $cardDetail = $this->select("select * from {$this->tName()} where game_type={$gameId} and card='{$postArr['card']}'", 1);
     if (!$cardDetail) {
         return array('status' => -1, 'msg' => "卡号: <b>{$postArr['card']}</b> 不存在", 'href' => 1);
     }
     if ($cardDetail['is_use'] == 1) {
         return array('status' => -1, 'msg' => "卡号: <b>{$postArr['card']}</b> 已经使用过了", 'href' => 1);
     }
     if ($cardDetail['start_time'] && $cardDetail['end_time']) {
         //表示有时间限制.
         if ($cardDetail['start_time'] < CURRENT_TIME) {
             return array('status' => -1, 'msg' => '此卡号还未到使用时间', 'href' => 1);
         }
         //如果开始时间小于当前时间
         if (CURRENT_TIME > $cardDetail['end_time']) {
             return array('status' => -1, 'msg' => '此卡号以过期', 'href' => 1);
         }
     }
     $this->_modelGameSerList = $this->_getGlobalData('Model_GameSerList', 'object');
     $serverList = $this->_modelGameSerList->findByGameIdOperatorId($gameId, $cardDetail['operator_id']);
     if (!array_key_exists($postArr['server_id'], $serverList)) {
         return array('status' => -1, 'msg' => '您的卡号无法充值所选择的服务器', 'href' => 1);
     }
     //兼容其他游戏配置
     //		$gameClass = $this->_getGlobalData($gameId,'game');
     //		if($gameClass){
     //			$tmp = $gameClass->getOptConf();
     //			if($tmp){
     //				$this->_payKey = $tmp;
     //				unset($tmp);
     //			}
     //		}
     //$this->_payKey = $this->getKey($gameId);
     //使用的配置改为从表中取
     $gameObject = $this->_getGlobalData($gameId, 'game');
     $gameOperatorExt = $gameObject->getOptConf($cardDetail['operator_id']);
     $syskey = isset($gameOperatorExt['syskey']) ? $gameOperatorExt['syskey'] : '';
     $this->_utilApiFrg = $this->_getGlobalData('Util_ApiFrg', 'object');
     $getArr = array('m' => 'User', 'c' => 'Deposit', 'a' => 'PayForGold', 'addcoin' => $cardDetail['type'], 'Uname' => $postArr['use_name'], 'Money' => $cardDetail['gold'], 'Transactionid' => $cardDetail['card'], 'Depay' => 0, 'gDepay' => 0, 'isGoldCard' => $cardDetail['card_type'], 'GoldCard' => $cardDetail['card'], 'GameId' => isset($gameOperatorExt['GameId']) ? $gameOperatorExt['GameId'] : '', 'ServiceId' => strpos($serverList[$postArr['server_id']]['marking'], '|') ? end(explode('|', $serverList[$postArr['server_id']]['marking'])) : intval(preg_replace('/[a-zA-Z]*(\\d+).*/', '\\1', $serverList[$postArr['server_id']]['marking'])));
     if (strpos($serverList[$postArr['server_id']]['marking'], '|') !== false) {
         strpos($serverList[$postArr['server_id']]['marking'], '|') ? end(explode('|', $serverList[$postArr['server_id']]['marking'])) : $serverList[$postArr['server_id']]['marking'];
     }
     //$syskey=$this->_payKey[$cardDetail['operator_id']]['key'];
     $sign = "Depay={$getArr['Depay']}&gDepay={$getArr['gDepay']}&addcoin={$getArr['addcoin']}&Uname={$getArr['Uname']}&Money={$getArr['Money']}&GameId={$getArr['GameId']}&ServiceId={$getArr['ServiceId']}&Transactionid={$getArr['Transactionid']}&Key={$syskey}";
     $getArr['Sign'] = md5($sign);
     $url = $serverList[$postArr['server_id']]['server_url'] . 'php/interface.php';
     $this->_utilApiFrg->addHttp($url, $getArr);
     $this->_utilApiFrg->send();
     $data = $this->_utilApiFrg->getResult();
     if ($data['data'] == 1) {
         //成功
         $updateArr = array('is_use' => 1, 'user_name' => $postArr['use_name'], 'user_ip' => ip2long(Tools::getClientIP()), 'use_time' => CURRENT_TIME, 'use_server_id' => $postArr['server_id']);
         $this->update($updateArr, "Id={$cardDetail['Id']}");
         return array('status' => 1, 'msg' => '领取成功', 'href' => 1);
     } else {
         return array('status' => -2, 'msg' => '领取失败。' . $data['message'], 'href' => 1);
     }
 }
 /**
  * 游戏内提问
  */
 private function _saveSource2()
 {
     $orderArr = array();
     $orderArr['game_type'] = $_POST['game_id'];
     $orderArr['user_account'] = $_POST['user_account'];
     $orderArr['user_nickname'] = $_POST['user_nickname'];
     $orderArr['money'] = $_POST['money_total'];
     $orderArr['source'] = $_POST['source'];
     //工单来源
     $orderArr['title'] = $_POST['title'];
     $orderArr['question_type'] = $_POST['question_type'];
     $orderArr['question_num'] = 1;
     $orderArr['create_time'] = CURRENT_TIME;
     if ($_FILES['image']) {
         $updateInfo = $this->_upload();
     }
     //如果有上传图片就上传文件
     $serverMarking = $_POST['server_marking'];
     $gameServerList = $this->_modelGameSerList->findByMarking($_POST['game_id'], $serverMarking);
     if (!$gameServerList) {
         //未找到服务器
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'game server non-existent', 'data' => null));
     }
     $this->_modelGameOperator = $this->_getGlobalData('Model_GameOperator', 'object');
     $gameOperatorIndex = $this->_modelGameOperator->findByGidOId($_POST['game_id'], $gameServerList['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['operator_id'] = $gameServerList['operator_id'];
     $orderArr['game_server_id'] = $gameServerList['Id'];
     if ($gameServerList['room_id']) {
         $orderArr['room_id'] = $gameServerList['room_id'];
     }
     if (!$this->_modelWorkOrder->add($orderArr)) {
         //创建表单失败
         $this->_returnAjaxJson(array('status' => 0, 'info' => 'Failure to create order', 'data' => null));
     }
     #------为房间工单数加1------#
     if ($orderArr['room_id']) {
         $this->_utilRooms = $this->_getGlobalData('Util_Rooms', 'object');
         $roomCLass = $this->_utilRooms->getRoom($orderArr['room_id']);
         $roomCLass->addOrderNum(1);
         $roomCLass->setUpdateInfo(1);
         $roomCLass = null;
     }
     #------为房间工单数加1------#
     $workOrderId = $this->_modelWorkOrder->returnLastInsertId();
     //获取工单id
     #------增加新的工单到队列------#
     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->setUpdateInfo(1);
         $orderManageClass = null;
     }
     #------增加新的工单到队列------#
     $orderDetail = array();
     $orderDetail['form_detail'] = array();
     $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 = $_POST['content'];
     if ($updateInfo['web_path']) {
         $content .= "<br>玩家截图:<br> <img src='{$updateInfo['web_path']}' />";
     }
     $orderDialog = array('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);
     //		if (!Tools::isUtf8($content))echo 'is not utf8';
     #-----插入对话表------#
     $this->_returnAjaxJson(array('status' => 1, 'info' => null, 'data' => array('order_id' => $workOrderId, 'image_path' => $updateInfo['web_path'])));
 }
Example #10
0
 private function _saveSource4()
 {
     $orderArr = array();
     $orderArr['game_type'] = intval($_POST['game_id']);
     $orderArr['is_vip'] = intval($_GET['is_vip']);
     $orderArr['user_account'] = $_POST['user_account'] ? $_POST['user_account'] : 0;
     $orderArr['user_nickname'] = trim($_POST['user_nickname']);
     $orderArr['money'] = intval($_POST['money_total']);
     $orderArr['source'] = intval(4);
     //工单来源
     $orderArr['title'] = strip_tags($_POST['title']);
     $orderArr['question_type'] = intval($_POST['question_type']);
     $orderArr['question_num'] = 1;
     $orderArr['create_time'] = CURRENT_TIME;
     $orderArr['game_user_id'] = trim($_POST['user_id']);
     if ($_FILES['image']) {
         $updateInfo = $this->_upload();
         //如果有上传图片就上传文件
     }
     $serverMarking = trim($_POST['server_marking']);
     $gameServerList = $this->_modelGameSerList->findByMarking($_POST['game_id'], $serverMarking, $_POST['server_name']);
     if (!$gameServerList) {
         //未找到服务器
         $this->_utilMsg->showMsg("game server non-existent", 1);
         //			$this->_returnAjaxJson ( array ('status' => 0, 'info' => 'game server non-existent', 'data' => null ) );
     }
     $this->_modelGameOperator = $this->_getGlobalData('Model_GameOperator', 'object');
     $gameOperatorIndex = $this->_modelGameOperator->findByGidOId($_POST['game_id'], $gameServerList['operator_id']);
     //找到此运营商的详细 资料.
     if (!$gameOperatorIndex) {
         //未找到游戏与运营商的索引
         $this->_utilMsg->showMsg("game server or operator non-existent", 1);
         //			$this->_returnAjaxJson ( array ('status' => 0, 'info' => 'game server or operator non-existent', 'data' => null ) );
     }
     //vip等级,如果从游戏中有传$_POST['vip_level']过来,就使用$_POST['vip_level'],否则使用配置值
     $orderArr['vip_level'] = isset($_REQUEST['vip']) ? intval($_REQUEST['vip']) : $this->_modelGameOperator->getVipLevel($gameOperatorIndex['vip_setup']['vip_pay'], $_POST['money_total']);
     $orderArr['vip_level'] = min(6, $orderArr['vip_level']);
     $orderArr['timeout'] = $this->_modelGameOperator->getTimeOut($gameOperatorIndex['vip_setup']['vip_timeout'], $orderArr['vip_level']);
     $orderArr['timeout'] *= 60;
     //换成秒
     $orderArr['is_verify'] = 0;
     $orderArr['operator_id'] = $gameServerList['operator_id'];
     $orderArr['game_server_id'] = $gameServerList['Id'];
     $orderArr['is_read'] = 0;
     if ($gameServerList['room_id']) {
         $orderArr['room_id'] = $gameServerList['room_id'];
     }
     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();
     $orderDetail['form_detail'] = array();
     $orderDetail['user_data'] = array('user_id' => $_POST['user_id'], 'user_account' => $_POST['user_account'], 'user_nickname' => $_POST['user_nickname'], 'money_total' => isset($_POST['money_total']) ? $_POST['money_total'] : -1, 'money_month' => isset($_POST['money_month']) ? $_POST['money_month'] : -1, 'register_date' => !$_POST['register_date'] || $_POST['register_date'] == 'null' ? null : $_POST['register_date'], 'ip' => $_POST['ip']);
     //钻类型
     if (isset($_POST['flatType'])) {
         $orderDetail['ext']['flatType']['desc'] = '钻类型';
         switch ($_POST['flatType']) {
             case '1':
                 $orderDetail['ext']['flatType']['value'] = '<font color="#FF9900">黄钻</font>';
                 break;
             case '10':
                 $orderDetail['ext']['flatType']['value'] = '<font color="#0000FF">蓝钻</font>';
                 break;
             default:
                 $orderDetail['ext']['flatType']['value'] = '<font color="#999999">无</font>';
         }
     }
     //钻等级
     if (isset($_POST['diamondLevel'])) {
         $orderDetail['ext']['diamondLevel'] = array('desc' => '钻等级', 'value' => $_POST['diamondLevel']);
     }
     //是否年费黄钻
     if (isset($_POST['yearDiamond'])) {
         $orderDetail['ext']['yearDiamond'] = array('desc' => '是否年费', 'value' => $_POST['yearDiamond'] ? '是' : '否');
     }
     //游戏VIP等级
     if (isset($_POST['vip'])) {
         $orderDetail['ext']['vip'] = array('desc' => '游戏VIP等级', 'value' => $_POST['vip']);
     }
     $orderDetail = serialize($orderDetail);
     $this->_modelWorkOrderDetail = $this->_getGlobalData('Model_WorkOrderDetail', 'object');
     $this->_modelWorkOrderDetail->add(array('work_order_id' => $workOrderId, 'content' => $orderDetail));
     #-----插入对话表------#
     $retArr = array('order_id' => $workOrderId);
     $this->_modelWorkOrderQa = $this->_getGlobalData('Model_WorkOrderQa', 'object');
     $content = strip_tags($_POST['content']);
     $content = str_replace(array('\\r\\n', '\\r'), chr(10), $content);
     $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);
     if ($updateInfo && is_array($updateInfo)) {
         $_imgArr = array();
         $i = '';
         foreach ($updateInfo as $img) {
             $retArr["image_path{$i}"] = $img['web_path'];
             $i++;
             $_imgArr[] = str_replace(__ROOT__, '', $img["web_path"]);
         }
         $orderDialog['image'] = json_encode($_imgArr);
     }
     $this->_modelWorkOrderQa->add($orderDialog);
     //$orderArr["room_id"]
     if ($orderArr['room_id'] && $gameServerList['server_url'] && $_POST['user_id']) {
         $this->_autoreply($orderArr, $gameServerList['server_url']);
     }
     #-----插入对话表------#
     eaccelerator_rm('question_' . $orderArr['user_account']);
     eaccelerator_put('question_' . $orderArr['user_account'], md5($orderArr['user_account'] . $orderArr['title']), 60);
     $this->_utilMsg->showMsg("提交成功", 1);
 }