From 3c7fd04a10bc3708dbc3b29d38e09f94378a528a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=B8=85=E7=88=BD?= Date: Tue, 22 Apr 2025 11:03:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=AE=A1=E5=90=8E=E5=8F=B0=20-=20?= =?UTF-8?q?=E6=B5=81=E9=87=8F=E6=B1=A0=E8=BF=94=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/common/model/TrafficPool.php | 19 +++ .../application/superadmin/config/route.php | 4 +- .../traffic/GetPoolListController.php | 119 ++++++++++++++++++ 3 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 Server/application/common/model/TrafficPool.php create mode 100644 Server/application/superadmin/controller/traffic/GetPoolListController.php diff --git a/Server/application/common/model/TrafficPool.php b/Server/application/common/model/TrafficPool.php new file mode 100644 index 00000000..c7ce2450 --- /dev/null +++ b/Server/application/common/model/TrafficPool.php @@ -0,0 +1,19 @@ +each(function ($item) { + $item->gender = $this->formatGender($item->gender); + $item->addTime = $this->formatDate($item->addTime); + $item->tags = $this->handlTags($item->tags); + }); + + return $list; + } + + /** + * 构建查询. + * + * @return TrafficPoolModel|\think\Paginator + */ + protected function gePoolList(): \think\Paginator + { + $query = TrafficPoolModel::alias('tp') + ->field([ + 'ts.id', + 'tp.wechatId', + 'ts.createTime as addTime', + 'ts.fromd as source', + 'c.name as projectName', + 'wa.avatar', + 'wa.gender', + 'wa.nickname', + 'wa.region', + 'wt.tags' + ]) + ->join('traffic_source ts', 'tp.identifier = ts.identifier', 'RIGHT') + ->join('company c', 'ts.companyId = c.companyId', 'LEFT') + ->join('wechat_account wa', 'tp.wechatId = wa.wechatId', 'LEFT') + ->join('wechat_tag wt', 'wa.wechatId = wt.wechatId', 'LEFT'); + + return $query->paginate($this->request->param('limit/d', 10), false, ['page' => $this->request->param('page/d', 1)]); + } + + /** + * 获取客户池列表 + * + * @return \think\response\Json + */ + public function index() + { + $list = $this->gePoolList(); + + return json([ + 'code' => 200, + 'msg' => '获取成功', + 'data' => [ + 'list' => $this->makeReturnedValue($list)->items(), + 'total' => $list->total(), + 'page' => $list->currentPage(), + 'limit' => $list->listRows() + ] + ]); + } +} \ No newline at end of file