2026-03-21 02:55:24 +08:00
|
|
|
<?php
|
|
|
|
|
// +----------------------------------------------------------------------
|
2026-03-29 11:22:52 +08:00
|
|
|
// | Author: ScottPan Team
|
2026-03-21 02:55:24 +08:00
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
namespace app\controller\admin\v1\work;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use app\controller\admin\AuthController;
|
|
|
|
|
use app\services\work\WorkGroupChatMemberServices;
|
|
|
|
|
use app\services\work\WorkGroupChatServices;
|
|
|
|
|
use app\services\work\WorkGroupChatStatisticServices;
|
|
|
|
|
use think\annotation\Inject;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 企业微信群
|
|
|
|
|
* Class GroupChat
|
|
|
|
|
* @package app\controller\admin\v1\work
|
|
|
|
|
*/
|
|
|
|
|
class GroupChat extends AuthController
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var WorkGroupChatServices
|
|
|
|
|
*/
|
|
|
|
|
#[Inject]
|
|
|
|
|
protected WorkGroupChatServices $services;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取群列表
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
$where = $this->request->getMore([
|
|
|
|
|
['userids', []],
|
|
|
|
|
['time', ''],
|
|
|
|
|
['name', '']
|
|
|
|
|
]);
|
|
|
|
|
return $this->success($this->services->getList($where));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 同步企业微信群
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function synchGroupChat(WorkGroupChatMemberServices $services)
|
|
|
|
|
{
|
|
|
|
|
$this->services->delete([["id","<>",0]]);
|
|
|
|
|
$services->delete([["id","<>",0]]);
|
|
|
|
|
$this->services->authGroupChat();
|
|
|
|
|
return $this->success('已加入消息队列,请稍后查看');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 群成员
|
|
|
|
|
* @param WorkGroupChatMemberServices $services
|
|
|
|
|
* @param $id
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function chatMember(WorkGroupChatMemberServices $services, $id)
|
|
|
|
|
{
|
|
|
|
|
if (!$id) {
|
|
|
|
|
return $this->fail('缺少参数');
|
|
|
|
|
}
|
|
|
|
|
return $this->success($services->getChatMemberList((int)$id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 客户群统计
|
|
|
|
|
* @param $id
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function chatStatistics($id)
|
|
|
|
|
{
|
|
|
|
|
if (!$id) {
|
|
|
|
|
return $this->fail('缺少参数');
|
|
|
|
|
}
|
|
|
|
|
$time = $this->request->get('time', '');
|
|
|
|
|
return $this->success($this->services->getChatStatistics((int)$id, $time));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 客户群统计列表数据
|
|
|
|
|
* @param WorkGroupChatStatisticServices $services
|
|
|
|
|
* @param $id
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function chatStatisticsList(WorkGroupChatStatisticServices $services, $id)
|
|
|
|
|
{
|
|
|
|
|
if (!$id) {
|
|
|
|
|
return $this->fail('缺少参数');
|
|
|
|
|
}
|
|
|
|
|
$time = $this->request->get('time', '');
|
|
|
|
|
return $this->success($services->getChatStatisticsList((int)$id, $time));
|
|
|
|
|
}
|
|
|
|
|
}
|