渠道代码提交

This commit is contained in:
wong
2025-12-18 10:34:50 +08:00
parent d8183909ca
commit 1cb7903e37
5 changed files with 774 additions and 505 deletions

View File

@@ -441,6 +441,7 @@ class PlanSceneV1Controller extends BaseController
{
$params = $this->request->param();
$taskId = isset($params['taskId']) ? intval($params['taskId']) : 0;
$channelId = isset($params['channelId']) ? intval($params['channelId']) : 0;
if($taskId <= 0) {
return ResponseHelper::error('任务ID或场景ID不能为空', 400);
@@ -451,8 +452,24 @@ class PlanSceneV1Controller extends BaseController
return ResponseHelper::error('任务不存在', 400);
}
// 如果提供了channelId验证渠道是否存在且有效
if ($channelId > 0) {
$channel = Db::name('distribution_channel')
->where([
['id', '=', $channelId],
['companyId', '=', $task['companyId']],
['status', '=', 'enabled'],
['deleteTime', '=', 0]
])
->find();
if (!$channel) {
return ResponseHelper::error('分销渠道不存在或已被禁用', 400);
}
}
$posterWeChatMiniProgram = new PosterWeChatMiniProgram();
$result = $posterWeChatMiniProgram->generateMiniProgramCodeWithScene($taskId);
$result = $posterWeChatMiniProgram->generateMiniProgramCodeWithScene($taskId, $channelId);
$result = json_decode($result, true);
if ($result['code'] == 200){
return ResponseHelper::success($result['data'], '获取小程序码成功');