私域操盘手 - 动态获取流量来源的selection 选择器列表数据
This commit is contained in:
@@ -42,7 +42,8 @@ Route::group('v1/', function () {
|
||||
// 流量池相关
|
||||
Route::group('traffic/pool', function () {
|
||||
Route::get('', 'app\cunkebao\controller\traffic\GetPotentialListWithInCompanyV1Controller@index');
|
||||
Route::get('types', 'app\cunkebao\controller\traffic\GetPotentialTypeListV1Controller@index');
|
||||
Route::get('types', 'app\cunkebao\controller\traffic\GetPotentialTypeSectionV1Controller@index');
|
||||
Route::get('sources', 'app\cunkebao\controller\traffic\GetTrafficSourceSectionV1Controller@index');
|
||||
});
|
||||
|
||||
// 工作台相关
|
||||
|
||||
@@ -10,9 +10,14 @@ use library\ResponseHelper;
|
||||
/**
|
||||
* 流量池控制器
|
||||
*/
|
||||
class GetPotentialTypeListV1Controller extends BaseController
|
||||
class GetPotentialTypeSectionV1Controller extends BaseController
|
||||
{
|
||||
protected function getTypeList(): array
|
||||
/**
|
||||
* 返回流量处理状态选项
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
protected function getTypeSectionCols(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
@@ -39,7 +44,7 @@ class GetPotentialTypeListV1Controller extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 潜在客户的全部状态
|
||||
* 获取流量池状态筛选列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
@@ -47,7 +52,7 @@ class GetPotentialTypeListV1Controller extends BaseController
|
||||
{
|
||||
try {
|
||||
return ResponseHelper::success(
|
||||
$this->getTypeList()
|
||||
$this->getTypeSectionCols()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
return ResponseHelper::error($e->getMessage(), $e->getCode());
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\cunkebao\controller\traffic;
|
||||
|
||||
use app\common\model\TrafficSource as TrafficSourceModel;
|
||||
use app\cunkebao\controller\BaseController;
|
||||
use library\ResponseHelper;
|
||||
|
||||
/**
|
||||
* 流量池控制器
|
||||
*/
|
||||
class GetTrafficSourceSectionV1Controller extends BaseController
|
||||
{
|
||||
/**
|
||||
* 动态获取流量来源的selection 选择器列表数据
|
||||
*
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function getSourceSectionCols(): array
|
||||
{
|
||||
return (array)TrafficSourceModel::where(
|
||||
[
|
||||
'companyId' => $this->getUserInfo('companyId')
|
||||
]
|
||||
)
|
||||
->field('fromd name,id')->group('fromd')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流量来源筛选列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
return ResponseHelper::success(
|
||||
$this->getSourceSectionCols()
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
return ResponseHelper::error($e->getMessage(), $e->getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user