场景获客支持拉群

This commit is contained in:
wong
2026-01-08 10:45:41 +08:00
parent b2e84a2259
commit e469537ac5
13 changed files with 1089 additions and 10564 deletions

View File

@@ -39,6 +39,18 @@ class PostUpdateAddFriendPlanV1Controller extends BaseController
return ResponseHelper::error('请选择设备', 400);
}
// 拉群配置校验
$groupInviteEnabled = !empty($params['groupInviteEnabled']) ? 1 : 0;
if ($groupInviteEnabled) {
if (empty($params['groupName'])) {
return ResponseHelper::error('拉群群名不能为空', 400);
}
if (empty($params['groupFixedMembers']) || !is_array($params['groupFixedMembers'])) {
return ResponseHelper::error('固定成员不能为空', 400);
}
}
// 检查计划是否存在
$plan = Db::name('customer_acquisition_task')
->where('id', $params['planId'])
@@ -94,7 +106,11 @@ class PostUpdateAddFriendPlanV1Controller extends BaseController
$sceneConf['distributionEnabled'],
$sceneConf['distributionChannels'],
$sceneConf['customerRewardAmount'],
$sceneConf['addFriendRewardAmount']
$sceneConf['addFriendRewardAmount'],
// 拉群相关字段单独存表,不放到 sceneConf
$sceneConf['groupInviteEnabled'],
$sceneConf['groupName'],
$sceneConf['groupFixedMembers']
);
// 将分销配置添加到sceneConf中
@@ -109,6 +125,12 @@ class PostUpdateAddFriendPlanV1Controller extends BaseController
'msgConf' => json_encode($msgConf, JSON_UNESCAPED_UNICODE),
'tagConf' => json_encode($tagConf, JSON_UNESCAPED_UNICODE),
'status' => !empty($params['status']) ? 1 : 0,
// 拉群配置
'groupInviteEnabled' => $groupInviteEnabled,
'groupName' => $params['groupName'] ?? '',
'groupFixedMembers' => !empty($params['groupFixedMembers'])
? json_encode($params['groupFixedMembers'], JSON_UNESCAPED_UNICODE)
: json_encode([], JSON_UNESCAPED_UNICODE),
'updateTime' => time(),
];