35 lines
1013 B
PHP
35 lines
1013 B
PHP
<?php
|
|
|
|
namespace app\chukebao\controller;
|
|
|
|
use library\ResponseHelper;
|
|
use think\Db;
|
|
|
|
class WechatGroupController extends BaseController
|
|
{
|
|
|
|
public function getList(){
|
|
|
|
$accountId = $this->getUserInfo('s2_accountId');
|
|
$userId = $this->getUserInfo('id');
|
|
$companyId = $this->getUserInfo('companyId');
|
|
|
|
$query = Db::table('s2_wechat_group')
|
|
->where(function ($query) use ($accountId,$companyId) {
|
|
$query->where('accountId', $accountId)->whereOr('departmentId', $companyId);
|
|
})
|
|
->whereIn('groupType',[1,2])
|
|
->order('groupType desc,sortIndex desc,id desc');
|
|
$list = $query->select();
|
|
$total = $query->count();
|
|
|
|
|
|
// 处理每个好友的数据
|
|
foreach ($list as $k => &$v) {
|
|
$v['createTime'] = !empty($v['createTime']) ? date('Y-m-d H:i:s', $v['createTime']) : '';
|
|
}
|
|
unset($v);
|
|
|
|
return ResponseHelper::success(['list'=>$list,'total'=>$total]);
|
|
}
|
|
} |