Commit 722e8d42 authored by zhuwei's avatar zhuwei

发起微聊用户数

parent f15d008e
...@@ -39,15 +39,16 @@ class OperationData extends Basic ...@@ -39,15 +39,16 @@ class OperationData extends Basic
public function chatUserNum(){ public function chatUserNum(){
$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']];
// 发起微聊用户数
//todo 发起微聊用户数
$chatRelationModel = new ChatRelation(); $chatRelationModel = new ChatRelation();
$where['from_id'] = ['LIKE','%user_%']; $where['from_id'] = ['LIKE','%user_%'];
$relationResult = $chatRelationModel->getChatUserNumOperation($where); $group = '';
$result["chat_user_num"] = 0; $res = $chatRelationModel->getChatUserNumOperation($where,$group);
$result["chat_user_all_num"] = $res;
$group = 'from_id';
$res = $chatRelationModel->getChatUserNumOperation($where,$group);
$result["chat_user_num"] = $res;
return $this->response(200, 'success', $result); return $this->response(200, 'success', $result);
} }
/** /**
......
...@@ -119,13 +119,27 @@ class ChatRelation extends Model ...@@ -119,13 +119,27 @@ class ChatRelation extends Model
} }
} }
public function getChatUserNumOperation($params) /**
* 发起微聊用户数
* @param $params
* @param $group
* @return int|string
*/
public function getChatUserNumOperation($params,$group)
{ {
//dump($params); //dump($params);
$return = Db::table($this->table) if($group){
->where($params) $return = Db::table($this->table)
->count(); ->where($params)
dump($this->getLastSql($return)); ->group($group)
->count();
}else{
$return = Db::table($this->table)
->where($params)
->count();
}
//dump($this->getLastSql($return));
return $return; return $return;
} }
......
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