- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明 Made-with: Cursor
56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Author: ScottPan Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\dao\work;
|
|
|
|
|
|
use app\dao\BaseDao;
|
|
use app\model\work\WorkGroupChat;
|
|
use crmeb\traits\SearchDaoTrait;
|
|
|
|
/**
|
|
* 企业微信群
|
|
* Class WorkGroupChatDao
|
|
* @package app\dao\work
|
|
*/
|
|
class WorkGroupChatDao extends BaseDao
|
|
{
|
|
|
|
use SearchDaoTrait;
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
protected function setModel(): string
|
|
{
|
|
return WorkGroupChat::class;
|
|
}
|
|
|
|
/**
|
|
* @param array $where
|
|
* @return \crmeb\basic\BaseModel
|
|
*/
|
|
public function groupChat(array $where)
|
|
{
|
|
return $this->getModel()->when(!empty($where['chat_id']), function ($query) use ($where) {
|
|
$query->whereIn('owner', function ($query) use ($where) {
|
|
$query->name('work_group_msg_task')->when(!empty($where['status']), function ($query) use ($where) {
|
|
$query->where('status', $where['status']);
|
|
})->whereIn('chat_id', $where['chat_id'])->field('userid');
|
|
});
|
|
})->when(!empty($where['owner']), function ($query) use ($where) {
|
|
$query->whereIn('owner', $where['owner']);
|
|
})->when(!empty($where['name']), function ($query) use ($where) {
|
|
$query->whereLike('name', '%' . $where['name'] . '%');
|
|
})->when(!empty($where['chat_id']), function ($query) use ($where) {
|
|
if (is_array($where['chat_id'])) {
|
|
$query->whereIn('chat_id', $where['chat_id']);
|
|
} else {
|
|
$query->where('chat_id', $where['chat_id']);
|
|
}
|
|
});
|
|
}
|
|
}
|