Ejemplo n.º 1
0
 public function edit($postArr)
 {
     $postArr['Id'] = intval($postArr['Id']);
     if (!$postArr['Id']) {
         return array('msg' => '参数错误', 'status' => '-1', 'href' => 2);
     }
     if (!$postArr['game_type_id']) {
         return array('msg' => '请选择游戏', 'status' => '-1', 'href' => 2);
     }
     if (!$postArr['type']) {
         return array('msg' => '请选类型', 'status' => '-1', 'href' => 2);
     }
     if (!$postArr['progress']) {
         return array('msg' => '请选择进展', 'status' => '-1', 'href' => 2);
     }
     if (!$postArr['title']) {
         return array('msg' => '请输入标题', 'status' => '-1', 'href' => 2);
     }
     if (!$postArr['content']) {
         return array('msg' => '请输入内容', 'status' => '-1', 'href' => 2);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $updateArr = array('game_type_id' => intval($postArr['game_type_id']), 'type' => intval($postArr['type']), 'progress' => intval($postArr['progress']), 'title' => $postArr['title'], 'content' => $postArr['content'], 'edit_time' => CURRENT_TIME, 'user_id' => $userClass['_id']);
     $this->update($updateArr, "Id={$postArr['Id']}");
     return array('msg' => '编辑成功', 'status' => '1', 'href' => Tools::url('Worker', 'Index', array('zp' => 'LianYun')));
 }
Ejemplo n.º 2
0
 /**
  * 完成任务
  */
 public function finishTask($postArr)
 {
     $id = $postArr['Id'];
     if (!$id) {
         return array('status' => -1, 'msg' => '参数错误', 'href' => 1);
     }
     $task = $this->findById($id);
     if (!$task) {
         return array('status' => -1, 'msg' => '任务不存在', 'href' => 1);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     if ($task['start_time'] == null) {
         return array('status' => -1, 'msg' => '您还没有接收此任务', 'href' => 1);
     }
     if ($task['accept_user_id'] != $userClass['_id']) {
         return array('status' => -1, 'msg' => '您不能完成此任务', 'href' => 1);
     }
     $updateArr = array();
     $updateArr['actual_hour'] = $this->getWorkHour($task['start_time'], CURRENT_TIME);
     if ($updateArr['actual_hour'] > $task['precast_hour'] && empty($postArr['timeout_cause'])) {
         return array('status' => -1, 'msg' => null, 'href' => Tools::url('ProgramTask', 'TimeoutCause', array('Id' => $task['Id'])));
         //如果超时时间范围就跳到写原因的画面
     } else {
         $updateArr['timeout_cause'] = $postArr['timeout_cause'];
     }
     $updateArr['end_time'] = CURRENT_TIME;
     $updateArr['quality_scorce'] = $this->_getQualityScorce($task['precast_hour'], $updateArr['actual_hour']);
     $updateArr['finish_speed'] = $this->_getFinishSpeed($task['precast_hour'], $updateArr['actual_hour']);
     $this->update($updateArr, "Id='{$id}'");
     return array('status' => 1, 'msg' => '已完成任务,完成任务时间:' . date('Y-m-d H:i:s', CURRENT_TIME), 'href' => Tools::url('ProgramTask', 'Index', array('zp' => 'Program')));
 }
Ejemplo n.º 3
0
 public function edit($postArr)
 {
     if (empty($postArr['Id'])) {
         return array('msg' => '请选择要修改的链接', 'status' => -1, 'href' => 1);
     }
     if (empty($postArr['title'])) {
         return array('msg' => '请输入标题', 'status' => -1, 'href' => 1);
     }
     if (empty($postArr['href'])) {
         return array('msg' => '请输入链接', 'status' => -1, 'href' => 1);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $editArr = array();
     $editArr['title'] = $postArr['title'];
     $editArr['href'] = $postArr['href'];
     $editArr['game_type_id'] = $postArr['game_type_id'];
     $editArr['operator_id'] = $postArr['operator_id'];
     $editArr['user_id'] = $userClass['_id'];
     $editArr['edit_time'] = CURRENT_TIME;
     if ($this->update($editArr, "Id={$postArr['Id']}")) {
         return array('msg' => false, 'status' => 1, 'href' => 1);
     } else {
         return array('msg' => '修改失败', 'status' => -2, 'href' => 1);
     }
 }
Ejemplo n.º 4
0
 /**
  * 设置在线用户
  */
 public function setOnlineUser($userName = NULL)
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass($userName);
     $addArr = array('user_id' => $userClass['_id'], 'user_name' => $userClass['_userName'], 'last_time' => CURRENT_TIME);
     $this->_modelOnlineUser->replace($addArr);
 }
Ejemplo n.º 5
0
 public function edit($postArr)
 {
     if (empty($postArr['Id'])) {
         return array('status' => -1, 'msg' => '请选择要更新的问卷', 'href' => 1);
     }
     if (empty($postArr['title'])) {
         return array('status' => -1, 'msg' => '请填写标题', 'href' => 1);
     }
     if (empty($postArr['description'])) {
         return array('status' => -1, 'msg' => '请填写描述', 'href' => 1);
     }
     if (empty($postArr['start_time'])) {
         return array('status' => -1, 'msg' => '请选择开始时间', 'href' => 1);
     }
     if (empty($postArr['end_time'])) {
         return array('status' => -1, 'msg' => '请选择结束时间', 'href' => 1);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $updateArr = array();
     $updateArr['title'] = $postArr['title'];
     $updateArr['description'] = $postArr['description'];
     $updateArr['start_time'] = strtotime($postArr['start_time']);
     $updateArr['end_time'] = strtotime($postArr['end_time']);
     $updateArr['status'] = $postArr['status'];
     $updateArr['user_id'] = $userClass['_id'];
     if (parent::update($updateArr, "Id={$postArr['Id']}")) {
         return array('status' => 1, 'msg' => false, 'href' => 1);
     } else {
         return array('status' => -2, 'msg' => '编辑问卷失败', 'href' => 1);
     }
 }
Ejemplo n.º 6
0
 /**
  * 增加新的记录
  * @param array $postArr
  * @param string $file 上传的文件
  */
 public function importExcel($postArr, $file)
 {
     $serverList = $this->_getCheckServerList();
     $operatorMark = $this->_getOperatorMark();
     $operatorId = $postArr['operator_id'];
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $this->_loadCore('Help_Excel');
     $this->_loadCore('Help_FileUpload');
     if (!$file) {
         return array('msg' => '文件未上传', 'status' => -1, 'href' => 1);
     }
     $helpFileUpload = new Help_FileUpload($file, EXCEL_DIR . '/' . date('Ymd'), 1024 * 1024 * 8, array('xls', 'xlsx'));
     $helpFileUpload->singleUpload();
     $fileInfo = $helpFileUpload->getSaveInfo();
     $helpExcel = new Help_Excel($fileInfo['path']);
     $excelData = $helpExcel->getData(0);
     array_shift($excelData);
     $addArr = array();
     $num = 0;
     //记数器,第几行
     $retArr = array();
     //返回消息
     $batchNum = md5(Tools::getRandCode(5) . CURRENT_TIME);
     $batchNum = substr($batchNum, 0, 16);
     foreach ($excelData as $value) {
         $value[0] = strtoupper($value[0]);
         $num++;
         if (empty($value[0])) {
             continue;
         }
         $marking = strtolower($operatorMark[$operatorId]) . '|' . trim($value[0]);
         if (!array_key_exists($marking, $serverList)) {
             //如果服务器ID不存在将跳过
             array_push($retArr, "第 [{$num}] 行服务器ID不存在!");
             continue;
         }
         $arr = array();
         $arr['create_time'] = CURRENT_TIME;
         $arr['operator_id'] = $operatorId ? $operatorId : array_search(strtolower(trim($value[2])), $operatorMark);
         //运营商ID
         $arr['server_id'] = $serverList[$marking];
         //serverid
         $arr['user_id'] = $userClass['_id'];
         $arr['batch_num'] = $batchNum;
         $arr['player_id'] = trim($value[1]);
         array_push($addArr, $arr);
     }
     if (count($retArr)) {
         //如果有错误信息
         return array('msg' => implode('<br />', $retArr), 'status' => -1, 'href' => 1);
     }
     if ($this->adds($addArr)) {
         $dataList = $this->select("select * from {$this->tName()} where batch_num='{$batchNum}'");
         return array('msg' => '上传文件成功', 'status' => 1, 'href' => 1, 'data' => $dataList);
     } else {
         return array('msg' => '失败', 'status' => -1, 'href' => 1);
     }
 }
Ejemplo n.º 7
0
 public function add($postArr)
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $addArr = array('user_id' => $userClass['_id'], 'create_time' => CURRENT_TIME, 'content' => $postArr['content']);
     if (parent::add($addArr)) {
         return array('status' => 1, 'msg' => false, 'href' => Tools::url(CONTROL, 'BugBack'));
     } else {
         return array('status' => -2, 'msg' => '添加bug失败', 'href' => Tools::url(CONTROL, 'BugBack'));
     }
 }
Ejemplo n.º 8
0
 private function _index()
 {
     $users = $this->getItUsers();
     $selected = array();
     $progromGroup = $this->_getGlobalData('program/project');
     $progromGroup = Model::getTtwoArrConvertOneArr($progromGroup, 'Id', 'name');
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $this->_loadCore('Help_SqlSearch');
     $this->_modelProgramDatework = $this->_getGlobalData('Model_ProgramDatework', 'object');
     $helpSqlSearch = new Help_SqlSearch();
     $helpSqlSearch->set_tableName($this->_modelProgramDatework->tName());
     $helpSqlSearch->set_orderBy('start_time desc');
     if ($_REQUEST['user_id']) {
         $helpSqlSearch->set_conditions("user_id={$_REQUEST['user_id']}");
         $selected['user_id'] = $_REQUEST['user_id'];
     }
     if ($_REQUEST['group_id']) {
         $helpSqlSearch->set_conditions("group_id={$_REQUEST['group_id']}");
         $selected['group_id'] = $_REQUEST['group_id'];
     }
     if ($_REQUEST['start_time'] && $_REQUEST['end_time']) {
         $helpSqlSearch->set_conditions('start_time between ' . strtotime($_REQUEST['start_tme'] . ' and ' . strtotime($_REQUEST['end_time'])));
         $selected['start_time'] = $_REQUEST['start_time'];
         $selected['end_time'] = $_REQUEST['end_time'];
     }
     $conditions = $helpSqlSearch->get_conditions();
     $helpSqlSearch->setPageLimit($_POST['page']);
     $sql = $helpSqlSearch->createSql();
     $dataList = $this->_modelProgramDatework->select($sql);
     if ($dataList) {
         foreach ($dataList as &$list) {
             $list['word_user_id'] = $users[$list['user_id']];
             $list['is_over'] = $list['actual_time'] ? true : false;
             $list['word_is_over'] = $list['actual_time'] ? '完成' : '未完成';
             $list['start_time'] = date('Y-m-d H:i:s', $list['start_time']);
             $list['end_time'] = date('Y-m-d H:i:s', $list['end_time']);
             $list['actual_time'] = $list['actual_time'] ? date('Y-m-d H:i:s', $list['actual_time']) : '';
             $list['word_group_id'] = $progromGroup[$list['group_id']];
             $list['url_finish'] = Tools::url(CONTROL, 'Index', array('doaction' => 'finish', 'Id' => $list['Id'], 'zp' => 'Program'));
             $list['url_edit'] = Tools::url(CONTROL, 'Index', array('doaction' => 'edit', 'Id' => $list['Id'], 'zp' => 'Program'));
         }
         $this->_view->assign('dataList', $dataList);
         $this->_loadCore('Help_Page');
         $helpPage = new Help_Page(array('total' => $this->_modelProgramDatework->findCount($conditions), 'perpage' => PAGE_SIZE));
         $this->_view->assign('pageBox', $helpPage->show());
     }
     $this->_view->assign('selected', $selected);
     $this->_view->assign('users', $users);
     $this->_view->assign('progromGroup', $progromGroup);
     $this->_utilMsg->createPackageNavBar();
     $this->_view->display();
 }
Ejemplo n.º 9
0
 public function getAllRoom()
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $gameTypeIds = $userClass->getUserGameTypeIds();
     $operatorIds = $userClass->getUserOperatorIds();
     if (!count($gameTypeIds) || !count($operatorIds)) {
         return array();
     }
     //如果没有设置游戏或是没有设置运营商的话,就退出
     $roomList = $this->select("select * from {$this->tName()} where game_type_id in (" . implode(',', $gameTypeIds) . ") and operator_id in (" . implode(',', $operatorIds) . ")");
     return $roomList;
 }
Ejemplo n.º 10
0
 /**
  * 用户投票动作
  * @param array $postArr
  */
 public function vote(array $postArr)
 {
     if (empty($postArr['Id'])) {
         return array('status' => -1, 'msg' => '请选择要投票的项目', 'href' => 1);
     }
     if (!is_array($postArr['source'])) {
         return array('status' => -1, 'msg' => '您没有投票', 'href' => 1);
     }
     $data = $this->findById($postArr['Id']);
     if (!$data) {
         return array('status' => -1, 'msg' => '该投票项目不存在', 'href' => 1);
     }
     if ($data['end_time'] < CURRENT_TIME) {
         return array('status' => -1, 'msg' => '投票已结束', 'href' => 1);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $data['vote_user'] = unserialize($data['vote_user']);
     //获取所有用户的投票
     $mySources = $data['vote_user'][$userClass['_id']];
     //获取当前用户的投票数
     if ($this->getUserStatus($userClass['_id'], $data['vote_user']) != 1) {
         return array('status' => -1, 'msg' => '您没有权限投票或已经投过票', 'href' => 1);
     }
     $voteResult = $data['result'] ? unserialize($data['result']) : array();
     //获取当前投票的结果集
     $this->_modelVoteLog = $this->_getGlobalData('Model_VoteLog', 'object');
     if ($postArr['source'][1] == $postArr['source'][2] || $postArr['source'][1] == $postArr['source'][3] || $postArr['source'][2] == $postArr['source'][3]) {
         return array('status' => -1, 'msg' => '投票不能投相同的人', 'href' => 1);
     }
     foreach ($postArr['source'] as $vote => $option) {
         //循环将3个投票都投出去
         $voteResult[$option] = floatval($voteResult[$option]);
         $voteResult[$option] += floatval($mySources[$vote]);
         $voteResult[$option] = sprintf('%.2f', $voteResult[$option]);
         $voteResult[$option] = strval($voteResult[$option]);
         $logArr = array('vote_id' => $data['Id'], 'vote_option_id' => $option, 'user_id' => $userClass['_id'], 'source' => floatval($mySources[$vote]));
         //写日志
         $this->_modelVoteLog->add($logArr);
     }
     $data['vote_user'][$userClass['_id']] = array_fill(1, count($data['vote_user'][$userClass['_id']]), 0);
     $updateArr = array();
     $updateArr['vote_user'] = serialize($data['vote_user']);
     $updateArr['result'] = serialize($voteResult);
     if ($this->update($updateArr, "Id={$data['Id']}")) {
         return array('status' => 1, 'msg' => '投票成功', 'href' => 1);
     } else {
         return array('status' => -1, 'msg' => '投票失败', 'href' => 1);
     }
 }
Ejemplo n.º 11
0
 /**
  * 复检动作
  */
 public function actionAgain()
 {
     $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object');
     if ($this->_isPost()) {
         $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
         $userClass = $this->_utilRbac->getUserClass();
         $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object');
         $updateArr = array('again_status' => $_POST['again_status'], 'again_content' => $_POST['again_content'], 'again_time' => CURRENT_TIME, 'again_user_id' => $userClass['_id']);
         #------添加日志------#
         $this->_modelOrderLog = $this->_getGlobalData('Model_OrderLog', 'object');
         $this->_modelOrderLog->addLog(array('Id' => $_POST['work_order_id']), Model_OrderLog::AGAIN);
         #------添加日志------#
         if ($this->_modelQuality->update($updateArr, "Id={$_POST['Id']}")) {
             $this->_utilMsg->showMsg(false);
         } else {
             $this->_utilMsg->showMsg(Tools::getLang('AGAIN_ERROR', __CLASS__), -2);
         }
     }
     if ($_GET['doaction'] == 'option') {
         //更改评价
         $id = Tools::coerceInt($_GET['Id']);
         $option = intval($_GET['option']);
         $this->_modelQuality->update(array('option_id' => $option), "Id={$id}");
         $this->_returnAjaxJson(array('status' => 1, 'msg' => '更改评价成功'));
     }
     if ($_GET['doaction'] == 'scorces') {
         //更改分数
         $id = Tools::coerceInt($_GET['Id']);
         $scores = intval($_GET['scores']);
         $this->_modelQuality->update(array('scores' => $scores), "Id={$id}");
         $this->_returnAjaxJson(array('status' => 1, 'msg' => '更改分类成功'));
     }
 }
Ejemplo n.º 12
0
 /**
  * 批量删除记录
  * @param array $ids
  */
 public function batchDel($ids)
 {
     $count = count($ids);
     if (!$count) {
         return array('status' => 1, 'msg' => '请选择要删除的记录', 'href' => 1);
     }
     $ids = implode(',', $ids);
     if ($this->execute("delete from {$this->tName()} where Id in({$ids})")) {
         $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
         $userClass = $this->_utilRbac->getUserClass();
         $userClass->getUserMail()->setMailCount('-' . $count);
         $userClass->setUpdateInfo(2);
         return array('status' => 1, 'msg' => false, 'href' => 1);
     } else {
         return array('status' => -2, 'msg' => '删除失败', 'href' => 1);
     }
 }
Ejemplo n.º 13
0
 /**
  * 增加操作日志类型
  * @param array $postArr
  * @param int $type
  * @see Model::add()
  */
 public function add($postArr, $type)
 {
     if (!$type) {
         return false;
     }
     //如果没有日志类型将退出
     $this->_type = $type;
     $addArr = array();
     $addArr['type'] = $type;
     $addArr['cause'] = $postArr['cause'];
     $addArr['create_time'] = CURRENT_TIME;
     $addArr['ip'] = ip2long(Tools::getClientIP());
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $addArr['user_id'] = $userClass['_id'];
     $addArr['description'] = $this->_getDes($postArr);
     parent::add($addArr);
 }
Ejemplo n.º 14
0
 /**
  * 更新日志
  */
 private function _updateLog()
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $userId = $userClass ? $userClass['_id'] : 0;
     $log = $this->findById($this->_params['Id']);
     if (!$log) {
         return;
     }
     $log['log'] = unserialize($log['log']);
     $log['log'][] = array('user_id' => $userId, 'time' => CURRENT_TIME, 'action' => $this->_curAction);
     $log['log'] = serialize($log['log']);
     if (in_array($this->_curAction, array(self::REPLY_2, self::REPLY_3, self::CHANGE_STATUS))) {
         $log['runtime'] += CURRENT_TIME - $log['last_run_time'];
     }
     $log['last_run_time'] = CURRENT_TIME;
     $this->update($log, "Id={$log['Id']}");
 }
Ejemplo n.º 15
0
 /**
  * 回复用户信息
  */
 public function actionReply()
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $timeout = intval(strtotime($_POST['create_time'])) + intval($_POST['timeout']);
     if (CURRENT_TIME > $timeout && $_POST['cur_status'] == 1) {
         //如果当前时间大于超时时间,并且当前工单为未处理状态,就说明回复时间已经过了,那么就超时
         $isTimeout = '1';
     } else {
         $isTimeout = '0';
     }
     $replyContent = $_POST['reply'];
     if ($_POST['lock']) {
         $replyContent = '<em>[该消息未发送到游戏服务器]</em> ' . $replyContent;
     }
     //如果为不发送消息将自动在前面加上
     $addQaArr = array('is_timeout' => $isTimeout, 'work_order_id' => $_POST['Id'], 'content' => $replyContent, 'qa' => 1, 'reply_name' => $userClass['_userName'], 'create_time' => CURRENT_TIME, 'game_type_id' => $_POST['game_type_id'], 'operator_id' => $_POST['operator_id']);
     if ($isTimeout) {
         $addQaArr['last_reply_time'] = $timeout;
     }
     //如果超时的话,将记录最后超时的时间
     if ($_POST['source'] == 2 && !$_POST['lock']) {
         //如果工单来源为2并且lock为不锁定,那么就要发送webservice
         $gameServerList = $this->_getGlobalData('gameser_list');
         $gameServerUrl = $gameServerList[$_POST['game_server_id']]['send_msg_url'];
         //获取url地址
         if (!$gameServerUrl) {
             $this->_utilMsg->showMsg('发送消息给游戏服务端失败', -2);
         }
         $isOk = $this->_sendMsg(array('work_order_id' => $_POST['Id'], 'service_id' => $userClass['_serviceId'] ? $userClass['_serviceId'] : '001', 'content' => $replyContent, 'server_url' => $gameServerUrl, 'status' => $_POST['status']));
         if ($isOk !== true) {
             $this->_utilMsg->showMsg($isOk, -2);
         }
     }
     $this->_modelWorkOrderQa->add($addQaArr);
     #------改变房间工单,用户回复数------#
     $userClass->setUpdateInfo(1);
     $userClass->addToReplyNum(1);
     if ($_POST['owner_user_id'] == $userClass['_id'] && $_POST['cur_status'] == 1) {
         $userClass->setIncompleteOrderNum(-1);
     }
     //用户完成一个工单
     if ($_POST['cur_status'] == 1) {
         //如果为未回复将房间未完成工单数减1
         $roomClass = $this->_utilRooms->getRoom($_POST['room_id']);
         if (is_object($roomClass)) {
             $roomClass->completeOrder(1);
             //完成一个工单数
             $roomClass->setUpdateInfo(1);
         }
     }
     #------改变房间工单,用户回复数------#
     $workOrderUpdateArr = array('status' => $_POST['status'], 'answer_num' => 'answer_num+1', 'owner_user_id' => $userClass['_id']);
     //变为待处理,提问数+1
     $this->_modelWorkOrder->update($workOrderUpdateArr, "Id={$_POST['Id']}");
     $this->_utilMsg->showMsg(false);
 }
Ejemplo n.º 16
0
 public function AddApply($data)
 {
     //检查申请原因
     if (!trim($data['apply_info'])) {
         return array('status' => 0, 'info' => '申请原因、数据为空', 'data' => NULL);
     }
     //检查发送类型
     if (!in_array($data['send_type'], $this->_sendType)) {
         return array('status' => 0, 'info' => '发送类型ID错误', 'data' => NULL);
     }
     //检查玩家类型
     if (!in_array($data['player_type'], $this->_playerType)) {
         return array('status' => 0, 'info' => '玩家类型错误', 'data' => NULL);
     }
     //检查申请类型
     $type = $data['type'];
     $game_type = $data['game_type'];
     $list_type = $data['list_type'];
     $ApplyType = $this->_getGlobalData(self::APPLY_TYPE);
     if (!isset($ApplyType[$list_type][$game_type][$type])) {
         return array('status' => 0, 'info' => '申请类型不存在', 'data' => NULL);
     }
     //检查服务器、运营商、游戏
     if ($data['server_id'] > 0) {
         $gameser_list = $this->_getGlobalData('gameser_list');
         $info = false;
         if (!isset($gameser_list[$data['server_id']])) {
             $info = '服务器ID不存在';
         } elseif ($data['operator_id'] != -1 && $gameser_list[$data['server_id']]['operator_id'] != $data['operator_id']) {
             $info = '运营商ID错误';
         } elseif ($gameser_list[$data['server_id']]['game_type_id'] != $data['game_type']) {
             $info = '游戏ID错误';
         }
         if ($info) {
             return array('status' => 0, 'info' => $info, 'data' => NULL);
         }
     }
     //检查发送数据
     if ($data['send_data']) {
         if (!is_string($data['send_data'])) {
             $data['send_data'] = serialize($data['send_data']);
         }
     } else {
         return array('status' => 0, 'info' => '发送数据为空', 'data' => NULL);
     }
     if (!is_string($data['receiver_object'])) {
         $data['receiver_object'] = serialize($data['receiver_object']);
     }
     $data = $this->_getData($data, $this->_addFields);
     $userClass = $this->_utilRbac->getUserClass();
     $data['apply_user_id'] = $userClass['_id'];
     $data['apply_ip'] = Tools::getClientIP();
     $data['create_time'] = CURRENT_TIME;
     $data['is_send'] = 0;
     return $this->add($data);
 }
Ejemplo n.º 17
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));
     }
 }
Ejemplo n.º 18
0
 /**
  * 用户退出房间
  */
 private function _outRoom()
 {
     $userClass = $this->_utilRbac->getUserClass();
     if ($userClass->outRoom()) {
         $userClass->setUpdateInfo(1);
         $this->_utilMsg->showMsg(false);
     } else {
         $this->_utilMsg->showMsg('退出回复专区失败,或者房间关闭了出口', -2, Tools::url(CONTROL, 'Room'));
     }
 }
Ejemplo n.º 19
0
 /**
  * 用户退出房间
  */
 private function _outRoom()
 {
     $userClass = $this->_utilRbac->getUserClass();
     if ($userClass->outRoom()) {
         $userClass->setUpdateInfo(1);
         $this->_utilMsg->showMsg(false);
     } else {
         $this->_utilMsg->showMsg(Tools::getLang('OUT_ROOMERROR1', __CLASS__), -2, Tools::url(CONTROL, 'Room'));
     }
 }
Ejemplo n.º 20
0
 public function edit($postArr)
 {
     if (empty($postArr['Id'])) {
         return array('href' => Tools::url('ProgramDateWork', 'Index'), 'msg' => '参数错误', 'status' => -1);
     }
     if (empty($postArr['content'])) {
         return array('href' => 2, 'msg' => '内容不能为空', 'status' => -1);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $task = $this->findById($postArr['Id']);
     if ($task['actual_time']) {
         return array('href' => 1, 'msg' => '此工作已经完成,您不能编辑', 'status' => -1);
     }
     if ($task['user_id'] != $userClass['_id']) {
         return array('href' => 1, 'msg' => '您不能编辑只内容', 'status' => -1);
     }
     $this->update(array('content' => $postArr['content']), "Id={$postArr['Id']}");
     return array('href' => Tools::url('ProgramDateWork', 'Index', array('zp' => 'Program')), 'msg' => '修改成功', 'status' => 1);
 }
Ejemplo n.º 21
0
 /**
  * 回复留言对话
  */
 public function actionReplyDialog()
 {
     if ($this->_isPost()) {
         $this->_modelVerify = $this->_getGlobalData('Model_Verify', 'object');
         $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
         $userClass = $this->_utilRbac->getUserClass();
         $dataList = $this->_modelVerify->findById($_POST['Id']);
         $contentArr = $dataList['log'];
         if ($contentArr) {
             $contentArr = unserialize($contentArr);
             if (!is_array($contentArr)) {
                 $contentArr = array();
             }
         } else {
             $contentArr = array();
         }
         if ($dataList['status'] != $_POST['status']) {
             //如果更改过状态
             $newLog = $this->_addLog(array('status' => $_POST['status'], 'action' => 'modify'));
             array_push($contentArr, $newLog);
         }
         if ($dataList['department_id'] != $_POST['department_id']) {
             $department = $this->_getGlobalData('department');
             $content = "to Dep  <font color='#FF0000'><b>{$department[$_POST['department_id']]['name']}</b></font> ";
             if (empty($_POST['content'])) {
                 $content = $this->_addLog(array('msg' => $content));
             }
         }
         if (!empty($_POST['content'])) {
             //如果content不为空的话,就继续加留言
             $content .= ':' . $_POST['content'];
             $content = $this->_addLog(array('msg' => $content));
         }
         if (!empty($content)) {
             array_push($contentArr, $content);
         }
         $updateArr = array('log' => serialize($contentArr), 'department_id' => $_POST['department_id'], 'status' => $_POST['status']);
         if ($_POST['status'] == Model_Verify::FINISH_STATUS) {
             $updateArr['finish_user_id'] = $userClass['_id'];
         }
         if ($this->_modelVerify->update($updateArr, "Id={$_POST['Id']}")) {
             #------发送邮件------#
             $this->_utilUserMailManage = $this->_getGlobalData('Util_UserMailManage', 'object');
             $this->_utilUserMailManage->addUser($dataList['user_id']);
             $mail = array('title' => "Buglist change status:{$dataList['title']}", 'href' => Tools::url(CONTROL, 'Detail', array('Id' => $dataList['Id'], 'work_order_id' => $dataList['work_order_id'])), 'type' => 3);
             $this->_utilUserMailManage->addMail($mail);
             $this->_utilUserMailManage->send();
             #------发送邮件------#
             $this->_utilMsg->showMsg(false);
         } else {
             $this->_utilMsg->showMsg(Tools::getLang('ADD_MSG_ERROR', __CLASS__), -2);
         }
     }
 }
Ejemplo n.º 22
0
 public function add($postArr)
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $addArr = array();
     $addArr['user_id'] = $userClass['_id'];
     $addArr['title'] = $postArr['CardName'];
     unset($postArr['CardName']);
     $addArr['img'] = $postArr['CardImage'];
     unset($postArr['CardImage']);
     $addArr['operator_id'] = $postArr['operator_id'];
     unset($postArr['operator_id']);
     $addArr['create_time'] = CURRENT_TIME;
     $addArr['tools'] = serialize($addArr['tools']);
     $addArr['post_data'] = serialize($postArr);
     if (parent::add($addArr)) {
         return array('msg' => '添加礼包成功', 'status' => 1, 'href' => 1);
     } else {
         return array('msg' => '添加礼包失败', 'status' => -2, 'href' => 1);
     }
 }
Ejemplo n.º 23
0
 /**
  * 新增一条记录
  * @param string $msg
  */
 public function add($msg = null, $constraint = FALSE)
 {
     if ($constraint === false) {
         if (in_array(CONTROL, array('Index', 'Default', 'Log', 'InterfaceFaq', 'InterfacePassport', 'InterfaceUpdate', 'InterfaceWorkOrder'))) {
             return;
         }
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $insertArr = array();
     $insertArr['user_id'] = $userClass['_id'] ? $userClass['_id'] : 0;
     $insertArr['time'] = CURRENT_TIME;
     $insertArr['ip'] = ip2long(Tools::getClientIP());
     $insertArr['control'] = strtolower(CONTROL);
     $insertArr['action'] = strtolower(ACTION);
     $insertArr['doaction'] = strtolower($_GET['doaction']);
     if ($msg) {
         $insertArr['msg'] = $msg;
     }
     parent::add($insertArr);
 }
Ejemplo n.º 24
0
 /**
  * 投票详细
  */
 private function _voteShow()
 {
     $this->_modelVote = $this->_getGlobalData('Model_Vote', 'object');
     if ($this->_isPost()) {
         //投票
         $data = $this->_modelVote->vote($_POST);
         $this->_utilMsg->showMsg($data['msg'], $data['status'], $data['href']);
     } else {
         //显示投票详情
         $data = $this->_modelVote->findById($_GET['Id']);
         if ($data) {
             if ($data['start_time'] > CURRENT_TIME) {
                 $this->_utilMsg->showMsg('投票时间还未开始', -1);
             }
             $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
             $userClass = $this->_utilRbac->getUserClass();
             $users = $this->_getGlobalData('user');
             $data['word_user_id'] = $users[$data['user_id']]['nick_name'];
             $data['start_time'] = date('Y-m-d H:i:s', $data['start_time']);
             $data['end_time'] = date('Y-m-d H:i:s', $data['end_time']);
             $data['content'] = unserialize($data['content']);
             $data['vote_user'] = unserialize($data['vote_user']);
             $data['my_status'] = $this->_modelVote->getUserStatus($userClass['_id'], $data['vote_user']);
             #------如果是马上显示或是已经过了结束时间就可以显示投票结果------#
             if ($data['is_open'] || $data['end_time'] < CURRENT_TIME) {
                 $result = $data['result'] ? unserialize($data['result']) : array();
                 $voteResult = array();
                 foreach ($data['content'] as $key => $option) {
                     $voteResult[$option] = floatval($result[$key]);
                 }
                 $this->_view->assign('voteResult', json_encode($voteResult));
             }
             #------如果是马上显示或是已经过了结束时间就可以显示投票结果------#
             #------得到详细日志------#
             $this->_modelVoteLog = $this->_getGlobalData('Model_VoteLog', 'object');
             $voteLogList = $this->_modelVoteLog->findByVoteId($data['Id']);
             foreach ($voteLogList as &$log) {
                 $log['word_user_id'] = $users[$log['user_id']]['nick_name'];
             }
             $this->_view->assign('voteLogList', $voteLogList);
             #------得到详细日志------#
             $mySource = $data['vote_user'][$userClass['_id']];
             $this->_view->assign('mySource', $mySource);
             $this->_view->assign('data', $data);
             $this->_view->set_tpl(array('body' => 'ServiceTools/VoteShow.html'));
             $this->_utilMsg->createNavBar();
             $this->_view->display();
         } else {
             $this->_utilMsg->showMsg(false);
         }
     }
 }
Ejemplo n.º 25
0
 /**
  * 设置在线状态
  */
 public function actionSetOnline()
 {
     $utilOnline = $this->_getGlobalData('Util_Online', 'object');
     $utilOnline->setOnlineUser();
     //设置在线用户
     $utilOnline->cleanOffOnlineUser();
     //清除在线用户
     $userClass = $this->_utilRbac->getUserClass();
     $mailTotalCount = $userClass->getUserMail()->get_total();
     $mailNotReadCount = $userClass->getUserMail()->get_notReadCount();
     $ajaxArr = array('mail_total' => $mailTotalCount, 'mail_not_read' => $mailNotReadCount, 'incomplete_order_num' => $userClass['_incompleteOrderNum']);
     $this->_returnAjaxJson(array('status' => 1, 'data' => $ajaxArr));
 }
Ejemplo n.º 26
0
 public function edit($postArr)
 {
     if (!$postArr) {
         return array('status' => 0, 'msg' => '请填定完成的资料');
     }
     if (!$postArr['Id']) {
         return array('status' => 0, 'msg' => '您需要编辑的公告不存在');
     }
     if (!$postArr['title']) {
         return array('status' => 0, 'msg' => '请填定完成的资料');
     }
     if (!$postArr['content']) {
         return array('status' => 0, 'msg' => '请填定完成的资料');
     }
     if ($postArr['kind'] == '') {
         return array('status' => 0, 'msg' => '请选择分类');
     }
     if (!count($postArr['users'])) {
         return array('status' => 0, 'msg' => '请选择用户');
     }
     $users = serialize($postArr['users']);
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $updateArr = array();
     $updateArr['user_id'] = $userClass['_id'];
     $updateArr['title'] = $postArr['title'];
     $updateArr['content'] = $postArr['content'];
     $updateArr['create_time'] = CURRENT_TIME;
     $updateArr['kind'] = $postArr['kind'];
     $updateArr['not_read'] = $users;
     if (parent::add($updateArr)) {
         $id = $this->returnLastInsertId();
         #------向用户发送消息------#
         $sendMsg = array();
         $sendMsg['type'] = $updateArr['kind'] ? '2' : '1';
         $sendMsg['title'] = $postArr['title'];
         $sendMsg['href'] = Tools::url('ServiceTools', 'NoticeShow', array('Id' => $id, 'doaction' => 'show'));
         $this->_utilUserMailManage = $this->_getGlobalData('Util_UserMailManage', 'object');
         $this->_utilUserMailManage->addUser($postArr['users']);
         $this->_utilUserMailManage->addMail($sendMsg);
         $this->_utilUserMailManage->send();
         $error = $this->_utilUserMailManage->getFailureUser();
         #------向用户发送消息------#
         $this->delById($postArr['Id']);
         $this->_modelBulletinDate = $this->_getGlobalData('Model_BulletinDate', 'object');
         $this->_modelBulletinDate->addBulletin($id);
         return array('status' => 1, 'msg' => $error);
     } else {
         return array('status' => 0, 'msg' => '添加失败');
     }
 }
Ejemplo n.º 27
0
 public function add($postArr)
 {
     if (empty($postArr['title'])) {
         return array('status' => -2, 'msg' => '标题不能为空', 'href' => 2);
     }
     if (empty($postArr['content'])) {
         return array('status' => -2, 'msg' => '内容不能为空', 'href' => 2);
     }
     $addArr = array();
     $addArr['org_id'] = $postArr['org_id'];
     $addArr['reply_user_id'] = $postArr['reply_user_id'];
     $addArr['source'] = $postArr['source'];
     $addArr['quality_status'] = $postArr['quality_status'];
     $addArr['quality_user_id'] = $postArr['quality_user_id'];
     $addArr['scores'] = $postArr['scores'];
     $addArr['feedback'] = $postArr['feedback'];
     $addArr['title'] = $postArr['title'];
     $addArr['content'] = $postArr['content'];
     if ($postArr['work_order_id']) {
         $addArr['work_order_id'] = $postArr['work_order_id'];
         #------添加日志------#
         $this->_modelOrderLog = $this->_getGlobalData('Model_OrderLog', 'object');
         $this->_modelOrderLog->addLog(array('Id' => $_POST['work_order_id']), Model_OrderLog::ADD_DOC);
         #------添加日志------#
     }
     if ($postArr['qa_id']) {
         $addArr['qa_id'] = $postArr['qa_id'];
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $addArr['create_user_id'] = $userClass['_id'];
     $addArr['create_time'] = CURRENT_TIME;
     if (parent::add($addArr)) {
         return array('status' => 1, 'msg' => '添加成功', 'href' => Tools::url(CONTROL, 'Document'));
     } else {
         return array('status' => 1, 'msg' => '添加失败', 'href' => 2);
     }
 }
Ejemplo n.º 28
0
 /**
  * 复检动作
  */
 public function actionAgain()
 {
     if ($this->_isPost()) {
         $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
         $userClass = $this->_utilRbac->getUserClass();
         $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object');
         $updateArr = array('again_content' => $_POST['again_content'], 'again_time' => CURRENT_TIME, 'again_user_id' => $userClass['_id']);
         if ($this->_modelQuality->update($updateArr, "Id={$_POST['Id']}")) {
             $this->_utilMsg->showMsg(false);
         } else {
             $this->_utilMsg->showMsg('复检失败', -2);
         }
     }
 }
Ejemplo n.º 29
0
 /**
  * 用户邮件
  */
 private function _mailIndex()
 {
     #------初始化------#
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $this->_modelUserMail = $this->_getGlobalData('Model_UserMail', 'object');
     $this->_loadCore('Help_SqlSearch');
     $this->_loadCore('Help_Page');
     $mailType = $this->_getGlobalData('mail_type');
     #------初始化------#
     $userClass = $this->_utilRbac->getUserClass();
     $helpSqlSearch = new Help_SqlSearch();
     $helpSqlSearch->set_tableName($this->_modelUserMail->tName());
     $helpSqlSearch->set_conditions("user_id={$userClass['_id']}");
     if ($_GET['mail_type'] != '') {
         $helpSqlSearch->set_conditions("type={$_GET['mail_type']}");
         $this->_view->assign('selectedMailType', $_GET['mail_type']);
     }
     if ($_GET['read'] != '') {
         $helpSqlSearch->set_conditions("is_read='{$_GET['read']}'");
         $this->_view->assign('selectedRead', $_GET['read']);
     }
     if ($_GET['is_read'] != '') {
         $helpSqlSearch->set_orderBy('is_read asc,create_time desc');
     } else {
         $helpSqlSearch->set_orderBy('create_time desc');
     }
     $helpSqlSearch->setPageLimit($_GET['page'], PAGE_SIZE);
     $sql = $helpSqlSearch->createSql();
     $dataList = $this->_modelUserMail->select($sql);
     if ($dataList) {
         Tools::import('Util_FontColor');
         foreach ($dataList as &$list) {
             $list['word_is_read'] = Util_FontColor::getMailRead($list['is_read']);
             $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
             $list['word_type'] = Util_FontColor::getMailType($list['type'], $mailType[$list['type']]);
         }
         $conditions = $helpSqlSearch->get_conditions();
         $helpPage = new Help_Page(array('total' => $this->_modelUserMail->findCount($conditions), 'perpage' => PAGE_SIZE));
         $this->_view->assign('pageBox', $helpPage->show());
         $this->_view->assign('dataList', $dataList);
     }
     $mailType[''] = '所有';
     $this->_view->assign('selectMailType', $mailType);
     $this->_view->assign('selectRead', array('1' => '已读', '0' => '未读', '' => '所有'));
     $this->_view->set_tpl(array('body' => 'User/MailIndex.html'));
     $this->_utilMsg->createNavBar();
     $this->_view->display();
 }
Ejemplo n.º 30
0
 /**
  * 用户计算器
  * @param $expire 默认180秒
  */
 public function userCount($expire = 180)
 {
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     if (!is_object($userClass)) {
         return;
     }
     $isTimeOut = $this->get(COUNT_USER . $userClass['_id']);
     if (!$isTimeOut) {
         $gameTypes = $userClass->getUserGameTypeIds();
         $operatorIds = $userClass->getUserOperatorIds();
         if (!count($gameTypes) || !count($operatorIds)) {
             return;
         }
         //如果没有负责的游戏或是负责的运营商,就退出
         $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object');
         $count = $this->_modelWorkOrder->select("select count(Id) as count from {$this->_modelWorkOrder->tName()} where game_type in (" . implode(',', $gameTypes) . ") and operator_id in (" . implode(',', $operatorIds) . ") and owner_user_id = {$userClass['_id']} and status=1", 1);
         $count = $count['count'];
         $this->set(COUNT_USER . $userClass['_id'], true, $expire);
         $userClass->setupIncomplete($count);
         $userClass->setUpdateInfo(1);
     }
 }