Commit 722e8d42 authored by zhuwei's avatar zhuwei

发起微聊用户数

parent f15d008e
......@@ -39,15 +39,16 @@ class OperationData extends Basic
public function chatUserNum(){
$params = $this->params;
$where['create_time'] = ['between', [$params['create_time_start']. ' 00:00:00', $params['create_time_end'] . ' 23:59:59']];
//todo 发起微聊用户数
// 发起微聊用户数
$chatRelationModel = new ChatRelation();
$where['from_id'] = ['LIKE','%user_%'];
$relationResult = $chatRelationModel->getChatUserNumOperation($where);
$result["chat_user_num"] = 0;
$group = '';
$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);
}
/**
......
......@@ -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);
$return = Db::table($this->table)
->where($params)
->count();
dump($this->getLastSql($return));
if($group){
$return = Db::table($this->table)
->where($params)
->group($group)
->count();
}else{
$return = Db::table($this->table)
->where($params)
->count();
}
//dump($this->getLastSql($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