私域操盘手 - 流量池列表返工_潜在客户游离状态列表

This commit is contained in:
柳清爽
2025-05-13 12:10:39 +08:00
parent 05c5f6c8e3
commit 869ce043fc
4 changed files with 164 additions and 33 deletions

View File

@@ -0,0 +1,83 @@
<?php
namespace app\cunkebao\controller\traffic;
use app\common\model\TrafficPool as TrafficPoolModel;
use app\common\model\WechatFriendShip as WechatFriendShipModel;
use app\cunkebao\controller\BaseController;
use library\ResponseHelper;
/**
* 流量池控制器
*/
class GetDissociateListWithInCompanyV1Controller extends BaseController
{
/**
* 构建查询条件
*
* @param array $params
* @return array
*/
protected function makeWhere(array $params = []): array
{
// 关键词搜索同时搜索IMEI和备注
if (!empty($keyword = $this->request->param('keyword'))) {
$where[] = ['exp', "p.identifier LIKE '%{$keyword}%'"];
}
$where['s.companyId'] = $this->getUserInfo('companyId');
return array_merge($where, $params);
}
/**
* 获取流量池列表
*
* @param array $where
* @return \think\Paginator
*/
protected function getPoolListByCompanyId(array $where): \think\Paginator
{
$query = TrafficPoolModel::alias('t')
->field(
[
't.identifier', 't.mobile', 't.wechatId',
's.id', 's.fromd', 's.status', 's.createTime'
]
)
->join('traffic_source s', 't.identifier=s.identifier')
->order('s.id desc');
foreach ($where as $key => $value) {
if (is_numeric($key) && is_array($value) && isset($value[0]) && $value[0] === 'exp') {
$query->whereExp('', $value[1]);
continue;
}
$query->where($key, $value);
}
return $query->paginate($this->request->param('limit/d', 10), false, ['page' => $this->request->param('page/d', 1)]);
}
/**
* 获取流量池列表
*
* @return \think\response\Json
*/
public function index()
{
try {
$result = $this->getPoolListByCompanyId( $this->makeWhere() );
return ResponseHelper::success(
[
'list' => $result->items(),
'total' => $result->total(),
]
);
} catch (\Exception $e) {
return ResponseHelper::error($e->getMessage(), $e->getCode());
}
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace app\cunkebao\controller\traffic;
use app\common\model\TrafficPool as TrafficPoolModel;
use app\common\model\WechatFriendShip as WechatFriendShipModel;
use app\cunkebao\controller\BaseController;
use library\ResponseHelper;
/**
* 流量池控制器
*/
class GetDissociateTypeListV1Controller extends BaseController
{
/**
* 获取流量池列表
*
* @param array $where
* @return \think\Paginator
*/
protected function getPoolListByCompanyId(array $where): \think\Paginator
{
$query = TrafficPoolModel::alias('t')
->field(
[
't.identifier', 't.mobile', 't.wechatId',
's.id', 's.fromd', 's.status', 's.createTime'
]
)
->join('traffic_source s', 't.identifier=s.identifier')
->order('s.id desc');
foreach ($where as $key => $value) {
if (is_numeric($key) && is_array($value) && isset($value[0]) && $value[0] === 'exp') {
$query->whereExp('', $value[1]);
continue;
}
$query->where($key, $value);
}
return $query->paginate($this->request->param('limit/d', 10), false, ['page' => $this->request->param('page/d', 1)]);
}
/**
* 获取流量池列表
*
* @return \think\response\Json
*/
public function index()
{
try {
$result = $this->getPoolListByCompanyId( $this->makeWhere() );
return ResponseHelper::success(
[
'list' => $result->items(),
'total' => $result->total(),
]
);
} catch (\Exception $e) {
return ResponseHelper::error($e->getMessage(), $e->getCode());
}
}
}

View File

@@ -1,13 +0,0 @@
<?php
namespace app\cunkebao\controller\traffic;
use think\Controller;
use think\facade\Request;
/**
* 流量池控制器
*/
class TrafficPool extends Controller
{
}