代码提交

This commit is contained in:
wong
2025-06-11 09:25:35 +08:00
parent 224d89f8e1
commit 7cefc2b189
7 changed files with 181 additions and 231 deletions

View File

@@ -5,6 +5,7 @@ namespace app\cunkebao\controller\plan;
use app\common\model\PlanScene as PlansSceneModel;
use app\cunkebao\controller\BaseController;
use library\ResponseHelper;
use think\Db;
/**
* 获客场景控制器
@@ -18,13 +19,15 @@ class GetPlanSceneListV1Controller extends BaseController
*/
protected function getSceneList(): array
{
return PlansSceneModel::where(
[
'status' => PlansSceneModel::STATUS_ACTIVE
]
)
->order('sort desc')
->select()->toArray();
$list = PlansSceneModel::where(['status' => PlansSceneModel::STATUS_ACTIVE])->order('sort desc')->select()->toArray();
$userInfo = $this->getUserInfo();
foreach($list as &$val){
$val['scenarioTags'] = json_decode($val['scenarioTags'],true);
$val['count'] = 0;
$val['growth'] = "0%";
}
unset($val);
return $list;
}
/**
@@ -38,4 +41,27 @@ class GetPlanSceneListV1Controller extends BaseController
$this->getSceneList()
);
}
/**
* 获取场景详情
*
*/
public function detail()
{
$id = $this->request->param('id','');
if(empty($id)){
ResponseHelper::error('参数缺失');
}
$data = PlansSceneModel::where(['status' => PlansSceneModel::STATUS_ACTIVE,'id' => $id])->find();
if(empty($data)){
ResponseHelper::error('场景不存在');
}
$data['scenarioTags'] = json_decode($data['scenarioTags'],true);
return ResponseHelper::success($data);
}
}