/** * 更改分数ajax */ public function actionChanageScores() { if ($this->_isAjax()) { $scores = $_GET['scores']; $qaId = Tools::coerceInt($_GET['qa_id']); $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object'); if ($this->_modelQuality->update(array('scores' => $scores), "qa_id={$qaId}")) { $this->_returnAjaxJson(array('status' => 1, 'msg' => '更改分数成功')); } else { $this->_returnAjaxJson(array('status' => 0, 'msg' => '更改分数失败')); } } }
private function _documentAdd() { if ($this->_isPost()) { $this->_modelQualityDocument = $this->_getGlobalData('Model_QualityDocument', 'object'); $data = $this->_modelQualityDocument->add($_POST); $this->_utilMsg->showMsg($data['msg'], $data['status'], $data['href']); } else { $orgList = Model::getTtwoArrConvertOneArr($this->_getGlobalData('org'), 'Id', 'name'); //组列表 $users = Model::getTtwoArrConvertOneArr($this->_getGlobalData('user'), 'Id', 'nick_name'); //用户列表 $source = $this->_getGlobalData('verify_source'); //来源 $socres = Tools::getLang('QUALITY_SOURCE', 'Common'); //分数 $feedBack = array('1' => '是', '0' => '否'); $verifyStatus = $this->_getGlobalData('verify_status'); if ($_GET['Id']) { $workOrderId = Tools::coerceInt($_GET['work_order_id']); $qaId = Tools::coerceInt($_GET['qa_id']); $id = Tools::coerceInt($_GET['Id']); $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object'); $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object'); $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object'); $qualityDetail = $this->_modelQuality->findById($id); $userClass = $this->_utilRbac->getUserClassById($qualityDetail['reply_user_id']); $workOrderDetail = $this->_modelWorkOrder->findById($workOrderId); $selected = array(); $selected['title'] = $workOrderDetail['title']; $selected['source'] = $workOrderDetail['source']; $selected['org_id'] = $userClass['_orgId']; $selected['reply_user_id'] = $qualityDetail['reply_user_id']; $selected['quality_user_id'] = $qualityDetail['quality_user_id']; $selected['option_id'] = $qualityDetail['option_id']; $selected['scores'] = $qualityDetail['scores']; $this->_view->assign('selected', $selected); } $this->_view->assign('verifyStatus', $verifyStatus); $this->_view->assign('orgList', $orgList); $this->_view->assign('users', $users); $this->_view->assign('source', $source); $this->_view->assign('socres', $socres); $this->_view->assign('feedBack', $feedBack); $this->_utilMsg->createNavBar(); $this->_view->set_tpl(array('body' => 'QualityCheck/DocumentAdd.html')); $this->_view->display(); } }
/** * 统计并且存入表. * key=0的为总数,其它的都会user_id,统计完成后会自动入库. * @param int $startTime * @param int $endTime */ public function user($startTime, $endTime) { $addArrs = array(); $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object'); $workOrderList = $this->_modelWorkOrder->select("select * from {$this->_modelWorkOrder->tName()} where create_time between {$startTime} and {$endTime}"); if ($workOrderList) { foreach ($workOrderList as $list) { $addArrs[0]['game_type_num'][$list['game_type']]++; $addArrs[0]['question_type_num'][$list['question_type']]++; $addArrs[0]['source_num'][$list['source']]++; $addArrs[0]['operator_num'][$list['operator_id']]++; $addArrs[0]['vip_level_num'][$list['vip_level']]++; $addArrs[0]['evaluation_num'][$list['evaluation_status']]++; $curUserId = $list['owner_user_id']; $addArrs[$curUserId]['game_type_num'][$list['game_type']]++; //游戏类型计数 $addArrs[$curUserId]['question_type_num'][$list['question_type']]++; //问题类型计数 $addArrs[$curUserId]['source_num'][$list['source']]++; //来源计数 $addArrs[$curUserId]['operator_num'][$list['operator_id']]++; //运营商计数 $addArrs[$curUserId]['vip_level_num'][$list['vip_level']]++; //VIP等级计数 $addArrs[$curUserId]['evaluation_num'][$list['evaluation_status']]++; //评价计数 } } $this->_modelWorkOrderQa = $this->_getGlobalData('Model_WorkOrderQa', 'object'); $workOrderQaList = $this->_modelWorkOrderQa->select("select * from {$this->_modelWorkOrderQa->tName()} where create_time between {$startTime} and {$endTime} and qa=1"); if ($workOrderQaList) { foreach ($workOrderQaList as $list) { $curUserId = $list['user_id']; $list['is_quality'] = $list['is_quality'] ? '1' : '0'; $addArrs[0]['reply_quality_num'][$list['is_quality']]++; //总数,被质检增加 $addArrs[$curUserId]['reply_quality_num'][$list['is_quality']]++; //用户被质检数增加 if ($list['is_timeout'] != null) { $addArrs[0]['reply_timeout_num'][$list['is_timeout']]++; //总数超时,增加 $addArrs[$curUserId]['reply_timeout_num'][$list['is_timeout']]++; //用户超时,增加 } } } $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object'); $qualityList = $this->_modelQuality->select("select * from {$this->_modelQuality->tName()} where quality_time between {$startTime} and {$endTime}"); if ($qualityList) { foreach ($qualityList as $list) { $curUserId = $list['quality_user_id']; $addArrs[0]['quality_option_num'][$list['option_id']]++; $addArrs[0]['quality_status_num'][$list['status']]++; $addArrs[$curUserId]['quality_option_num'][$list['option_id']]++; $addArrs[$curUserId]['quality_status_num'][$list['status']]++; if ($list['scores'] > 0) { $addArrs[0]['quality_scores']['bonus'] += $list['scores']; $addArrs[0]['quality_scores']['bonus_num']++; $addArrs[$curUserId]['quality_scores']['bonus'] += $list['scores']; $addArrs[$curUserId]['quality_scores']['bonus_num']++; } else { $addArrs[0]['quality_scores']['deeduction'] += $list['scores']; $addArrs[0]['quality_scores']['deeduction_num']++; $addArrs[$curUserId]['quality_scores']['deeduction'] += $list['scores']; $addArrs[$curUserId]['quality_scores']['deeduction_num']++; } } } $insertArr = array(); foreach ($addArrs as $key => $list) { if ($key === '' || $key === null) { continue; } $list['user_id'] = $key; $list['create_time'] = $startTime; $list['game_type_num'] = serialize((array) $list['game_type_num']); $list['question_type_num'] = serialize((array) $list['question_type_num']); $list['source_num'] = serialize((array) $list['source_num']); $list['operator_num'] = serialize((array) $list['operator_num']); $list['vip_level_num'] = serialize((array) $list['vip_level_num']); $list['evaluation_num'] = serialize((array) $list['evaluation_num']); $list['reply_quality_num'] = serialize((array) $list['reply_quality_num']); $list['reply_timeout_num'] = serialize((array) $list['reply_timeout_num']); $list['quality_option_num'] = serialize((array) $list['quality_option_num']); $list['quality_status_num'] = serialize((array) $list['quality_status_num']); $list['quality_scores'] = serialize((array) $list['quality_scores']); $this->add($list); array_push($insertArr, $list); } }
/** * 根据用户统计 */ private function _getStatusUser() { if (is_array($this->_users)) { $users = implode(',', $this->_users); } else { $users = $this->_users; } $addArrs = array(); $this->_modelWorkOrder = $this->_getGlobalData('Model_WorkOrder', 'object'); $sql = "select Id,game_type,question_type,source,operator_id,vip_level,evaluation_status,evaluation_desc,create_time from {$this->_modelWorkOrder->tName()} where create_time between {$this->_statsTime['start']} and {$this->_statsTime['end']} and owner_user_id in (" . $users . ")"; $gameType = NULL; if ($this->_gameType) { if (is_array($this->_gameType)) { $gameType = implode(',', $this->_gameType); } $sql .= " and game_type in ({$gameType})"; } $workOrderList = $this->_modelWorkOrder->select($sql); if ($workOrderList) { //1游戏BUG //2游戏设置不满意 //3回复不清晰 //4回复错误 //5客服服务态度恶劣 //6其他 $evaluationDesc = array(1 => 32, 2 => 32, 3 => 3, 4 => 3, 5 => 3, 6 => 32, '' => 3); //32扩展为游戏差评、3保留为服务差评 foreach ($workOrderList as $list) { $addArrs['game_type_num'][$list['game_type']]++; $addArrs['question_type_num'][$list['question_type']]++; $addArrs['source_num'][$list['source']]++; $addArrs['operator_num'][$list['operator_id']]++; $addArrs['vip_level_num'][$list['vip_level']]++; //对差评进行扩展 if ($list['evaluation_status'] == 3) { $addArrs['evaluation_num'][$evaluationDesc[$list['evaluation_desc']]]++; $addArrs['evaluation_desc_num'][$list['evaluation_desc']]++; } else { $addArrs['evaluation_num'][$list['evaluation_status']]++; } // $addArrs['evaluation_num'][$list['evaluation_status']]++; // if ($list['evaluation_desc'])$addArrs['evaluation_desc_num'][$list['evaluation_desc']]++; } $isEvNum = $addArrs['evaluation_num'][1] + $addArrs['evaluation_num'][2] + $addArrs['evaluation_num'][3] + $addArrs['evaluation_num'][32]; $addArrs['evaluation_num']['satisfaction'] = $addArrs['evaluation_num'][1] / ($isEvNum - $addArrs['evaluation_num'][32]) * 100; //服务满意度 $totalEvNum = $addArrs['evaluation_num'][0] + $isEvNum; $addArrs['evaluation_num']['ev_percentage'] = $isEvNum / $totalEvNum * 100; //评价率 } $this->_modelWorkOrderQa = $this->_getGlobalData('Model_WorkOrderQa', 'object'); $sql = "select Id,is_quality,is_timeout,create_time from {$this->_modelWorkOrderQa->tName()} where create_time between {$this->_statsTime['start']} and {$this->_statsTime['end']} and qa=1 and user_id in (" . $users . ")"; if ($gameType) { $sql .= " and game_type_id in ({$gameType})"; } $workOrderQaList = $this->_modelWorkOrderQa->select($sql); if ($workOrderQaList) { foreach ($workOrderQaList as $list) { $list['is_quality'] = $list['is_quality'] ? '1' : '0'; $addArrs['reply_quality_num'][$list['is_quality']]++; //总数,被质检增加 if ($list['is_timeout'] != null) { $addArrs['reply_timeout_num'][$list['is_timeout']]++; //总数超时,增加 } } } $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object'); $sql = "select option_id,status,scores from {$this->_modelQuality->tName()} where quality_time between {$this->_statsTime['start']} and {$this->_statsTime['end']} and (quality_user_id in ({$users}) or reply_user_id in ({$users})) "; if ($gameType) { $sql .= " and game_type_id in ({$gameType})"; } $qualityList = $this->_modelQuality->select($sql); if ($qualityList) { foreach ($qualityList as $list) { $addArrs['quality_option_num'][$list['option_id']]++; $addArrs['quality_status_num'][$list['status']]++; if ($list['scores'] > 0) { $addArrs['quality_scores']['bonus'] += $list['scores']; $addArrs['quality_scores']['bonus_num']++; } elseif ($list['scores'] < 0) { $addArrs['quality_scores']['deeduction'] += $list['scores']; $addArrs['quality_scores']['deeduction_num']++; } } } foreach ($addArrs as $key => &$list) { $list['game_type_num'] = (array) $list['game_type_num']; $list['question_type_num'] = (array) $list['question_type_num']; $list['source_num'] = (array) $list['source_num']; $list['operator_num'] = (array) $list['operator_num']; $list['vip_level_num'] = (array) $list['vip_level_num']; $list['evaluation_num'] = (array) $list['evaluation_num']; $list['reply_quality_num'] = (array) $list['reply_quality_num']; $list['reply_timeout_num'] = (array) $list['reply_timeout_num']; $list['quality_option_num'] = (array) $list['quality_option_num']; $list['quality_status_num'] = (array) $list['quality_status_num']; $list['quality_scores'] = (array) $list['quality_scores']; } return $addArrs; }
/** * 详细统计 * @param array $date * @param array $users */ public function statsDetail($date, $users, $gameIds = NULL, $operators = null) { #------获取工单总数统计------# $sql = "select evaluation_status,evaluation_desc,create_time,owner_user_id,is_verify,status from {$this->tName()} where create_time between {$date['start']} and {$date['end']} and owner_user_id in (" . implode(',', $users) . ")"; if ($gameIds) { if (is_array($gameIds)) { $gameIds = implode(',', $gameIds); } $sql .= " and game_type in ({$gameIds})"; } if ($operators) { if (is_array($operators)) { $operators = implode(',', $operators); } $sql .= " and operator_id in ({$operators})"; } // echo "<p>".$sql; $dataList = $this->select($sql); if ($dataList) { $evArr = array(); //1游戏BUG //2游戏设置不满意 //3回复不清晰 //4回复错误 //5客服服务态度恶劣 //6其他 $evaluationDesc = array(1 => 32, 2 => 32, 3 => 3, 4 => 3, 5 => 3, 6 => 32, '' => 3); //32扩展为游戏差评、3保留为服务差评 $workOrderList = array(); foreach ($dataList as $list) { $workOrderList['total']['total']['total']++; // $workOrderList['total']['total']['ev_'.$list['evaluation_status']]++; $workOrderList['total'][date('Y-m-d', $list['create_time'])]['total']++; // $workOrderList['total'][date('Y-m-d',$list['create_time'])]['ev_'.$list['evaluation_status']]++; if ($list['is_verify'] && in_array($list['status'], array(3, 4))) { $workOrderList['total']['total']['verify']++; $workOrderList['total'][date('Y-m-d', $list['create_time'])]['verify']++; $workOrderList[$list['owner_user_id']]['total']['verify']++; $workOrderList[$list['owner_user_id']][date('Y-m-d', $list['create_time'])]['verify']++; } $workOrderList[$list['owner_user_id']]['total']['total']++; // $workOrderList[$list['owner_user_id']]['total']['ev_'.$list['evaluation_status']]++; $workOrderList[$list['owner_user_id']][date('Y-m-d', $list['create_time'])]['total']++; // $workOrderList[$list['owner_user_id']][date('Y-m-d',$list['create_time'])]['ev_'.$list['evaluation_status']]++; //对差评进行扩展 if ($list['evaluation_status'] == 3) { $tmpEv = $evaluationDesc[$list['evaluation_desc']]; $workOrderList['total']['total']['ev_' . $tmpEv]++; $workOrderList[$list['owner_user_id']]['total']['ev_' . $tmpEv]++; $workOrderList['total'][date('Y-m-d', $list['create_time'])]['ev_' . $tmpEv]++; $workOrderList[$list['owner_user_id']][date('Y-m-d', $list['create_time'])]['ev_' . $tmpEv]++; } else { $workOrderList['total']['total']['ev_' . $list['evaluation_status']]++; $workOrderList[$list['owner_user_id']]['total']['ev_' . $list['evaluation_status']]++; $workOrderList['total'][date('Y-m-d', $list['create_time'])]['ev_' . $list['evaluation_status']]++; $workOrderList[$list['owner_user_id']][date('Y-m-d', $list['create_time'])]['ev_' . $list['evaluation_status']]++; } } } $allDay = Tools::getdateArr($date['start'], $date['end']); foreach ($users as $user) { foreach ($allDay as $key => $value) { if (!isset($workOrderList['total'][$key])) { $workOrderList['total'][$key] = array(); } if (!isset($workOrderList[$user][$key])) { $workOrderList[$user][$key] = array(); } } krsort($workOrderList[$user]); } krsort($workOrderList['total']); #------获取工单总数统计------# #------获取回复总记录数------# $this->_modelWorkOrderQa = $this->_getGlobalData('Model_WorkOrderQa', 'object'); $sql = "select is_timeout,user_id,create_time from {$this->_modelWorkOrderQa->tName()} where create_time between {$date['start']} and {$date['end']} and qa=1 and user_id in (" . implode(',', $users) . ")"; if ($gameIds) { $sql .= " and game_type_id in ({$gameIds})"; } if ($operators) { if (is_array($operators)) { $operators = implode(',', $operators); } $sql .= " and operator_id in ({$operators})"; } // echo "<p>".$sql; $dataList = $this->_modelWorkOrderQa->select($sql); if ($dataList) { $qaList = array(); foreach ($dataList as $list) { $qaList['total']['total']['total_reply']++; $qaList['total']['total']['timeout_' . $list['is_timeout']]++; $qaList['total'][date('Y-m-d', $list['create_time'])]['total_reply']++; $qaList['total'][date('Y-m-d', $list['create_time'])]['timeout_' . $list['is_timeout']]++; $qaList[$list['user_id']]['total']['total_reply']++; $qaList[$list['user_id']]['total']['timeout_' . $list['is_timeout']]++; $qaList[$list['user_id']][date('Y-m-d', $list['create_time'])]['total_reply']++; $qaList[$list['user_id']][date('Y-m-d', $list['create_time'])]['timeout_' . $list['is_timeout']]++; } } $allDay = Tools::getdateArr($date['start'], $date['end']); foreach ($users as $user) { foreach ($allDay as $key => $value) { if (!isset($qaList['total'][$key])) { $qaList['total'][$key] = array(); } if (!isset($qaList[$user][$key])) { $qaList[$user][$key] = array(); } } krsort($qaList[$user]); } krsort($qaList['total']); #------获取回复总记录数------# #------质检统计------# $this->_modelQuality = $this->_getGlobalData('Model_Quality', 'object'); $sql = "select quality_user_id,reply_user_id,scores,quality_time from {$this->_modelQuality->tName()} where quality_time between {$date['start']} and {$date['end']} and (quality_user_id in (" . implode(',', $users) . ") or reply_user_id in (" . implode(',', $users) . ")) "; if ($gameIds) { $sql .= " and game_type_id in ({$gameIds})"; } if ($operators) { $sql .= " and operator_id in ({$operators})"; } // echo "<p>".$sql; $dataList = $this->_modelQuality->select($sql); if ($dataList) { $qualityList = array(); foreach ($dataList as $list) { $qualityList['total']['total']['total_quality']++; $qualityList['total'][date('Y-m-d', $list['quality_time'])]['total_quality']++; $qualityList['total']['total']['quality_num']++; $qualityList['total']['total']['reply_num']++; $qualityList['total'][date('Y-m-d', $list['quality_time'])]['quality_num']++; $qualityList['total'][date('Y-m-d', $list['quality_time'])]['reply_num']++; $qualityList[$list['quality_user_id']]['total']['quality_num']++; //质检回复量 $qualityList[$list['quality_user_id']][date('Y-m-d', $list['quality_time'])]['quality_num']++; $qualityList[$list['reply_user_id']]['total']['reply_num']++; //被质检回复量 $qualityList[$list['reply_user_id']][date('Y-m-d', $list['quality_time'])]['reply_num']++; if ($list['scores'] > 0) { $qualityList['total']['total']['bonus_num']++; $qualityList['total']['total']['bonus'] += $list['scores']; $qualityList['total'][date('Y-m-d', $list['quality_time'])]['bonus_num']++; $qualityList['total'][date('Y-m-d', $list['quality_time'])]['bonus'] += $list['scores']; $qualityList[$list['reply_user_id']]['total']['bonus_num']++; $qualityList[$list['reply_user_id']]['total']['bonus'] += $list['scores']; $qualityList[$list['reply_user_id']][date('Y-m-d', $list['quality_time'])]['bonus_num']++; $qualityList[$list['reply_user_id']][date('Y-m-d', $list['quality_time'])]['bonus'] += $list['scores']; } elseif ($list['scores'] < 0) { $qualityList['total']['total']['deduction_num']++; $qualityList['total']['total']['deduction'] += $list['scores']; $qualityList['total'][date('Y-m-d', $list['quality_time'])]['deduction_num']++; $qualityList['total'][date('Y-m-d', $list['quality_time'])]['deduction'] += $list['scores']; $qualityList[$list['reply_user_id']]['total']['deduction_num']++; $qualityList[$list['reply_user_id']]['total']['deduction'] += $list['scores']; $qualityList[$list['reply_user_id']][date('Y-m-d', $list['quality_time'])]['deduction_num']++; $qualityList[$list['reply_user_id']][date('Y-m-d', $list['quality_time'])]['deduction'] += $list['scores']; } } } $allDay = Tools::getdateArr($date['start'], $date['end']); foreach ($users as $user) { foreach ($allDay as $key => $value) { if (!isset($qualityList['total'][$key])) { $qualityList['total'][$key] = array(); } if (!isset($qualityList[$user][$key])) { $qualityList[$user][$key] = array(); } } krsort($qualityList[$user]); } krsort($qualityList['total']); #------质检统计------# #------BUGLIST------# $this->_modelVerify = $this->_getGlobalData('Model_Verify', 'object'); $sql = "select user_id,finish_user_id,create_time from {$this->_modelVerify->tName()} where create_time between {$date['start']} and {$date['end']} and (user_id in (" . implode(',', $users) . ") or finish_user_id in (" . implode(',', $users) . "))"; if ($gameIds) { $sql .= " and game_type_id in ({$gameIds})"; } if ($operators) { $sql .= " and operator_id in ({$operators})"; } // echo "<p>".$sql; $dataList = $this->_modelVerify->select($sql); if ($dataList) { $bugList = array(); foreach ($dataList as $list) { $curTime = date('Y-m-d', $list['create_time']); $bugList['total']['total']['submit']++; $bugList['total'][$curTime]['submit']++; $bugList[$list['user_id']]['total']['submit']++; $bugList[$list['user_id']][$curTime]['submit']++; if ($list['finish_user_id']) { $bugList['total']['total']['finish']++; $bugList['total'][$curTime]['finish']++; $bugList[$list['finish_user_id']]['total']['finish']++; $bugList[$list['finish_user_id']][$curTime]['finish']++; } } } $allDay = Tools::getdateArr($date['start'], $date['end']); foreach ($users as $user) { foreach ($allDay as $key => $value) { if (!isset($bugList['total'][$key])) { $bugList['total'][$key] = array(); } if (!isset($bugList[$user][$key])) { $bugList[$user][$key] = array(); } } krsort($bugList[$user]); } krsort($bugList['total']); #------BUGLIST------# $arrayList = array(); $arrayList['total'] = array_merge_recursive($workOrderList['total'], $qaList['total'], $qualityList['total'], $bugList['total']); foreach ($users as $user) { $arrayList[$user] = array_merge_recursive($workOrderList[$user], $qaList[$user], $qualityList[$user], $bugList[$user]); } return $arrayList; }