私域操盘手 - 动态获取流量来源的selection 选择器列表数据

This commit is contained in:
柳清爽
2025-05-13 15:06:24 +08:00
parent 55ea2bf7e3
commit e359661ac4
4 changed files with 95 additions and 10 deletions

View File

@@ -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');
});
// 工作台相关

View File

@@ -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());

View File

@@ -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());
}
}
}