chore: 添加静态资源文件和版本配置文件
添加大量图片、字体、音频等静态资源文件,包括用户界面图片、模板文件和安装界面素材 添加系统版本配置文件(.version)和常量定义文件(.constant) 更新供应商依赖文件,包括Symfony VarDumper组件和相关许可证文件 添加验证码配置文件(captcha.php)和.gitignore规则
This commit is contained in:
102
app/services/work/WorkGroupChatMemberServices.php
Normal file
102
app/services/work/WorkGroupChatMemberServices.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\services\work;
|
||||
|
||||
|
||||
use app\dao\work\WorkGroupChatMemberDao;
|
||||
use app\services\BaseServices;
|
||||
use app\services\user\UserServices;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* 企业微信群成员
|
||||
* Class WorkGroupChatMemberServices
|
||||
* @package app\services\work
|
||||
* @mixin WorkGroupChatMemberDao
|
||||
*/
|
||||
class WorkGroupChatMemberServices extends BaseServices
|
||||
{
|
||||
/**
|
||||
* @var WorkGroupChatMemberDao
|
||||
*/
|
||||
#[Inject]
|
||||
protected WorkGroupChatMemberDao $dao;
|
||||
|
||||
/**
|
||||
* 获取群成员
|
||||
* @param int $chatId
|
||||
* @param string $name
|
||||
* @return array
|
||||
*/
|
||||
public function getChatMemberList(int $chatId, string $name = '')
|
||||
{
|
||||
[$page, $limit] = $this->getPageValue();
|
||||
$list = $this->dao->getDataList(['group_id' => $chatId, 'name_like' => $name, 'status' => 1], ['*'], $page, $limit, 'create_time', [
|
||||
'member' => function ($query) {
|
||||
$query->field(['name', 'userid', 'gender', 'avatar', 'id', 'mobile']);
|
||||
},
|
||||
'client' => function ($query) {
|
||||
$query->field(['name', 'external_userid', 'gender', 'avatar', 'id']);
|
||||
}
|
||||
]);
|
||||
$clientId = $mobile = [];
|
||||
|
||||
foreach ($list as &$item) {
|
||||
$item['group_chat_num'] = $this->dao->getChatSum($item['userid']);
|
||||
if ($item['group_chat_num'] > 0) {
|
||||
$item['group_chat_num']--;
|
||||
}
|
||||
if (isset($item['client']['id'])) {
|
||||
$clientId[] = $item['client']['id'];
|
||||
}
|
||||
if (isset($item['member'])) {
|
||||
$mobile[] = $item['member']['mobile'];
|
||||
}
|
||||
}
|
||||
/** @var WorkClientFollowServices $followService */
|
||||
$followService = app()->make(WorkClientFollowServices::class);
|
||||
$followList = $followService->getDataList(['client_id' => $clientId], ['id', 'client_id',], 0, 0, 'create_time', ['tags']);
|
||||
if ($followList) {
|
||||
foreach ($list as &$item) {
|
||||
$newTag = [];
|
||||
if (isset($item['client']['id'])) {
|
||||
foreach ($followList as $value) {
|
||||
if ($item['client']['id'] == $value['client_id'] && !empty($value['tags'])) {
|
||||
$newTag = array_column($value['tags'], 'tag_name');
|
||||
}
|
||||
}
|
||||
$item['tags'] = $newTag;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($mobile) {
|
||||
/** @var UserServices $userService */
|
||||
$userService = app()->make(UserServices::class);
|
||||
$userList = $userService->getList(['phone' => $mobile], 'phone,uid', 0, 0);
|
||||
if ($userList) {
|
||||
foreach ($list as &$item) {
|
||||
$newTag = [];
|
||||
if (isset($item['member'])) {
|
||||
foreach ($userList as $value) {
|
||||
if ($item['member']['mobile'] == $value['phone'] && !empty($value['label'])) {
|
||||
$newTag = array_column($value['label'], 'label_name');
|
||||
}
|
||||
}
|
||||
$item['tags'] = $newTag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$count = $this->dao->count(['group_id' => $chatId, 'name_like' => $name, 'status' => 1]);
|
||||
return compact('list', 'count');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user