私域操盘手 - 流量池潜在用户的状态类型筛选功能
This commit is contained in:
@@ -12,52 +12,42 @@ use library\ResponseHelper;
|
||||
*/
|
||||
class GetDissociateTypeListV1Controller extends BaseController
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取流量池列表
|
||||
*
|
||||
* @param array $where
|
||||
* @return \think\Paginator
|
||||
*/
|
||||
protected function getPoolListByCompanyId(array $where): \think\Paginator
|
||||
protected function getTypeList(): array
|
||||
{
|
||||
$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 [
|
||||
[
|
||||
'id' => 1,
|
||||
'name' => '待处理'
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'name' => '处理中'
|
||||
],
|
||||
[
|
||||
'id' => 4,
|
||||
'name' => '已拒绝'
|
||||
],
|
||||
[
|
||||
'id' => 5,
|
||||
'name' => '已过期'
|
||||
],
|
||||
[
|
||||
'id' => 6,
|
||||
'name' => '已取消'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流量池列表
|
||||
* 潜在客户的全部状态
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$result = $this->getPoolListByCompanyId( $this->makeWhere() );
|
||||
|
||||
return ResponseHelper::success(
|
||||
[
|
||||
'list' => $result->items(),
|
||||
'total' => $result->total(),
|
||||
]
|
||||
$this->getTypeList()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
return ResponseHelper::error($e->getMessage(), $e->getCode());
|
||||
|
||||
Reference in New Issue
Block a user