Commit b1fcb524 authored by zhuwei's avatar zhuwei

微聊分部门

parent e8d54cc1
...@@ -38,7 +38,7 @@ class OperationData extends Basic ...@@ -38,7 +38,7 @@ class OperationData extends Basic
* 发起微聊用户数 * 发起微聊用户数
* @return \think\Response * @return \think\Response
*/ */
public function chatUserNum() public function chatUserNum_old()
{ {
$params = $this->params; $params = $this->params;
$where['create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ]; $where['create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
...@@ -54,6 +54,43 @@ class OperationData extends Basic ...@@ -54,6 +54,43 @@ class OperationData extends Basic
return $this->response(200, 'success', $result); return $this->response(200, 'success', $result);
} }
public function chatUserNum()
{
$params = $this->params;
$where['create_time'] = [ 'between', [ $params['create_time_start'] . ' 00:00:00', $params['create_time_end'] . ' 23:59:59' ] ];
// 先查新所有部门
$district_list = $this->getDistrict();
$chatRelationModel = new ChatRelation();
foreach ($district_list as $key => $v) {
$result_["id"] = $v['id'];
$result_["district_name"] = $v['district_name'];
$chat_user_all_num = 0;
$chat_user_num = 0;
// 商场进场数
$agentIds = $this->getAgentIDsByDistrictId($v['id']);
foreach (explode(',',$agentIds) as $k1 => $v1) {
// 发起微聊用户数
$where['from_id'] = 'user_'.$v1;
$group = '';
$res = $chatRelationModel->getChatUserNumOperation($where, $group);
$chat_user_all_num += $res;
$group = 'from_id';
$res = $chatRelationModel->getChatUserNumOperation($where, $group);
$chat_user_num += $res;
}
$result_["chat_user_all_num"] = $chat_user_all_num;
$result_["chat_user_num"] = $chat_user_num;
$result[] = $result_;
}
return $this->response(200, 'success', $result);
}
/** /**
* 客户来电数 * 客户来电数
* @return \think\Response * @return \think\Response
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment