海报小程序相关代码提交
This commit is contained in:
@@ -21,25 +21,31 @@ class GetChatroomListV1Controller extends BaseController
|
||||
$limit = $this->request->param('limit', 20);
|
||||
$keyword = $this->request->param('keyword', '');
|
||||
try {
|
||||
|
||||
$wechatIds = Db::name('device')->alias('d')
|
||||
->join('device_wechat_login dwl','dwl.deviceId=d.id AND dwl.companyId='.$this->getUserInfo('companyId'))
|
||||
->where(['d.companyId' => $this->getUserInfo('companyId'),'d.deleteTime' => 0])
|
||||
->column('dwl.wechatId');
|
||||
|
||||
|
||||
$where = [];
|
||||
if ($this->getUserInfo('isAdmin') == 1) {
|
||||
$where[] = ['g.companyId', '=', $this->getUserInfo('companyId')];
|
||||
$where[] = ['g.deleteTime', '=', 0];
|
||||
$where[] = ['g.ownerWechatId', 'in', $wechatIds];
|
||||
} else {
|
||||
$where[] = ['g.companyId', '=', $this->getUserInfo('companyId')];
|
||||
$where[] = ['g.deleteTime', '=', 0];
|
||||
$where[] = ['g.ownerWechatId', 'in', $wechatIds];
|
||||
//$where[] = ['g.userId', '=', $this->getUserInfo('id')];
|
||||
}
|
||||
|
||||
if(!empty($keyword)){
|
||||
$where[] = ['g.name', 'like', '%'.$keyword.'%'];
|
||||
}
|
||||
|
||||
|
||||
$data = WechatChatroom::alias('g')
|
||||
->field(['g.id', 'g.chatroomId', 'g.name', 'g.avatar','g.ownerWechatId', 'g.identifier', 'g.createTime',
|
||||
'wa.nickname as ownerNickname','wa.avatar as ownerAvatar','wa.alias as ownerAlias'])
|
||||
->Join('wechat_account wa', 'g.ownerWechatId = wa.wechatId', 'LEFT')
|
||||
->join('wechat_account wa', 'g.ownerWechatId = wa.wechatId', 'LEFT')
|
||||
->where($where);
|
||||
|
||||
$total = $data->count();
|
||||
|
||||
Reference in New Issue
Block a user