Пример #1
0
 /**
  * 清空用户工单队列
  * @param int $userId
  */
 public function clearOrder($userId)
 {
     $dataList = $this->select("select Id,vip_level,room_id,game_type,operator_id from {$this->tName()} where owner_user_id={$userId} and status in (1,2)");
     //找到当前用户工单状态为待处理,处理中的工单ID
     if (!$dataList) {
         return array('msg' => Tools::getLang('CLEARORDER_ERROR', __CLASS__), 'status' => -2, 'href' => 1);
     }
     $ids = array();
     $this->_utilWorkOrder = $this->_getGlobalData('Util_WorkOrder', 'object');
     $objectOrder = $this->_utilWorkOrder->getOrderManage();
     //获取自动分配工单对象
     foreach ($dataList as $list) {
         $list['game_type_id'] = $list['game_type'];
         //处理兼容问题
         $objectOrder->addOrder($list);
         //将工单全部加入到队列
         array_push($ids, $list['Id']);
         //工单ID
     }
     $objectOrder->setUpdateInfo(1);
     //更新.
     $this->execute("update {$this->tName()} set owner_user_id=null where Id in (" . implode(',', $ids) . ")");
     //更新工单的所有者,让系统重新分配
     return array('msg' => Tools::getLang('CLEARORDER_ERROR', __CLASS__), 'status' => 1, 'href' => 1);
 }
Пример #2
0
 /**
  * 添加问题
  */
 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));
     }
 }
Пример #3
0
 /**
  * 工单分配
  */
 private function _orderAssign()
 {
     $this->_modelAutoOrderQueue = $this->_getGlobalData('Model_AutoOrderQueue', 'object');
     $this->_modelAutoOrderQueue->delById($_GET['Id']);
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $this->_utilWorkOrder = $this->_getGlobalData('Util_WorkOrder', 'object');
     $objectOrderManage = $this->_utilWorkOrder->getOrderManage();
     $userClass = $this->_utilRbac->getUserClassById($_GET['userId']);
     $objectOrderManage->updateWorkOrderOwner($userClass, array('work_order_id' => $_GET['workOrderId']));
     $this->_utilMsg->showMsg(false);
 }
 /**
  * 内部队列分配 工单
  */
 public function actionDistributionOrder()
 {
     #------自动发送工单队列------#
     $this->_utilWorkOrder = $this->_getGlobalData('Util_WorkOrder', 'object');
     $orderManage = $this->_utilWorkOrder->getOrderManage();
     //		$orderManage['_workOrder']=array();
     $orderManage->sendOrder();
     $orderManage->setUpdateInfo(1);
     Tools::dump($orderManage);
     #------自动发送工单队列------#
 }
Пример #5
0
 /**
  * VIP数值计算
  * @param $expire 默认180秒
  */
 public function vipCount($expire = 180)
 {
     $vipCount = $this->get(COUNT_VIP);
     if (!$vipCount) {
         $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object');
         $vipCount = $this->_modelWorkOrder->select("SELECT vip_level,COUNT(Id) AS vip_count FROM {$this->_modelWorkOrder->tName()} WHERE `status`=1 GROUP BY vip_level");
         $this->_utilWorkOrder = $this->_getGlobalData('Util_WorkOrder', 'object');
         $tempCount = array();
         foreach ($vipCount as $value) {
             if ($value['vip_level'] == '') {
                 continue;
             }
             //防止空或是null
             $tempCount[$value['vip_level']] = $value['vip_count'];
         }
         $objectOrder = $this->_utilWorkOrder->getOrderManage();
         $objectOrder->setupOrderNum($tempCount);
         unset($objectOrder);
         $this->set(COUNT_VIP, $vipCount, $expire);
     }
 }
 /**
  * 内部队列分配 工单 
  */
 public function actionDistributionOrder()
 {
     #------自动发送工单队列------#
     $this->_utilWorkOrder = $this->_getGlobalData('Util_WorkOrder', 'object');
     $orderManage = $this->_utilWorkOrder->getOrderManage();
     $orderManage->sendOrder();
     $orderManage->setUpdateInfo(1);
     #------自动发送工单队列------#
     $cacheAutoCount = $this->_getGlobalData('Cache_AutoCount', 'object');
     $cacheAutoCount->vipCount();
     $cacheAutoCount->roomCount();
 }
Пример #7
0
 public function actionClearOrder()
 {
     Tools::import('Util_WorkOrder');
     $utilWorkOrder = new Util_WorkOrder();
     $orderManage = $utilWorkOrder->getOrderManage();
     $orderManage['_workOrder'] = array();
     $orderManage->setUpdateInfo(1);
 }
Пример #8
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);
 }