场景获客优化

This commit is contained in:
wong
2025-08-12 15:02:00 +08:00
parent f6b620383c
commit 67fac4b2f2
3 changed files with 82 additions and 16 deletions

View File

@@ -2,6 +2,7 @@
namespace app\cunkebao\controller\plan;
use app\cunkebao\controller\BaseController;
use library\ResponseHelper;
use think\Controller;
use think\Db;
@@ -9,7 +10,7 @@ use think\Db;
/**
* 更新获客计划控制器
*/
class PostUpdateAddFriendPlanV1Controller extends Controller
class PostUpdateAddFriendPlanV1Controller extends BaseController
{
/**
* 更新计划任务
@@ -62,12 +63,6 @@ class PostUpdateAddFriendPlanV1Controller extends Controller
'endTime' => $params['endTime'] ?? '',
];
if (isset($params['wechatGroups'])){
$params['wechatGroups'] = $params['groupSelected'];
}
// 其余参数归为sceneConf
$sceneConf = $params;
unset(
@@ -101,10 +96,12 @@ class PostUpdateAddFriendPlanV1Controller extends Controller
'reqConf' => json_encode($reqConf, JSON_UNESCAPED_UNICODE),
'msgConf' => json_encode($msgConf, JSON_UNESCAPED_UNICODE),
'tagConf' => json_encode($tagConf, JSON_UNESCAPED_UNICODE),
'status' => !empty($params['status']) ? 1 : 0,
'updateTime' => time(),
];
try {
// 更新数据
$result = Db::name('customer_acquisition_task')
@@ -242,11 +239,11 @@ class PostUpdateAddFriendPlanV1Controller extends Controller
//群获客
if ($params['sceneId'] == 7) {
if (!empty($params['groupSelected']) && is_array($params['groupSelected'])) {
if (!empty($params['wechatGroups']) && is_array($params['wechatGroups'])) {
$rows = Db::name('wechat_group_member')->alias('gm')
->join('wechat_account wa', 'gm.identifier = wa.wechatId')
->where('gm.companyId', $this->getUserInfo('companyId'))
->whereIn('gm.groupId', $params['groupSelected'])
->whereIn('gm.groupId', $params['wechatGroups'])
->group('gm.identifier')
->column('wa.id,wa.wechatId,wa.alias,wa.phone');