2025-09-16 09:57:06 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\chukebao\controller;
|
|
|
|
|
|
|
|
|
|
use library\ResponseHelper;
|
|
|
|
|
use think\Db;
|
|
|
|
|
|
|
|
|
|
class CustomerServiceController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public function getList(){
|
|
|
|
|
$accountId = $this->getUserInfo('s2_accountId');
|
|
|
|
|
if (empty($accountId)){
|
|
|
|
|
return ResponseHelper::error('请先登录');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$accountIds1= Db::table('s2_wechat_friend')->where(['accountId' => $accountId,'isDeleted' => 0])->group('wechatAccountId')->column('wechatAccountId');
|
|
|
|
|
$accountIds2 = Db::table('s2_wechat_chatroom')->where(['accountId' => $accountId,'isDeleted' => 0])->group('wechatAccountId')->column('wechatAccountId');
|
|
|
|
|
// 确保即使有空数组也不会报错,并且去除重复值
|
|
|
|
|
$accountIds = array_unique(array_merge($accountIds1 ?: [], $accountIds2 ?: []));
|
|
|
|
|
|
|
|
|
|
$list = Db::table('s2_wechat_account')
|
|
|
|
|
->whereIn('id',$accountIds)
|
|
|
|
|
->order('id desc')
|
|
|
|
|
->group('id')
|
|
|
|
|
->select();
|
|
|
|
|
foreach ($list as $k=>&$v){
|
2025-09-17 16:51:11 +08:00
|
|
|
$v['createTime'] = !empty($v['createTime']) && is_numeric($v['createTime']) ? date('Y-m-d H:i:s',$v['createTime']) : '';
|
|
|
|
|
$v['updateTime'] = !empty($v['updateTime']) && is_numeric($v['updateTime']) ? date('Y-m-d H:i:s',$v['updateTime']) : '';
|
2025-09-16 09:57:06 +08:00
|
|
|
$v['labels'] = json_decode($v['labels'],true);
|
|
|
|
|
unset(
|
|
|
|
|
$v['accountUserName'],
|
|
|
|
|
$v['accountRealName'],
|
|
|
|
|
$v['accountNickname'],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
unset($v);
|
|
|
|
|
|
|
|
|
|
return ResponseHelper::success($list);
|
|
|
|
|
}
|
|
|
|
|
}
|