算力功能改版

This commit is contained in:
wong
2025-12-09 15:01:38 +08:00
parent c9a5d3091f
commit 3e145ca123
18 changed files with 763 additions and 203 deletions

View File

@@ -13,9 +13,12 @@ class PostTransferFriends extends BaseController
{
$wechatId = $this->request->param('wechatId', '');
$inherit = $this->request->param('inherit', '');
$greeting = $this->request->param('greeting', '');
$firstMessage = $this->request->param('firstMessage', '');
$devices = $this->request->param('devices', []);
$companyId = $this->getUserInfo('companyId');
if (empty($wechatId)){
return ResponseHelper::error('迁移的微信不能为空');
}
@@ -23,13 +26,16 @@ class PostTransferFriends extends BaseController
if (empty($devices)){
return ResponseHelper::error('迁移的设备不能为空');
}
if (empty($greeting)){
return ResponseHelper::error('打招呼不能为空');
}
if (!is_array($devices)){
return ResponseHelper::error('迁移的设备必须为数组');
}
$wechat = Db::name('wechat_customer')->alias('wc')
->join('wechat_account wa', 'wc.wechatId = wa.wechatId')
->where(['wc.wechatId' => $wechatId, 'wc.companyId' => $companyId])
->where(['wc.wechatId' => $wechatId])
->field('wa.*')
->find();
@@ -53,11 +59,6 @@ class PostTransferFriends extends BaseController
'id' => 'poster-3',
'name' => '点击咨询',
'src' => 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/%E7%82%B9%E5%87%BB%E5%92%A8%E8%AF%A2-FTiyAMAPop2g9LvjLOLDz0VwPg3KVu.gif'
],
'$posters' => [
'id' => 'poster-3',
'name' => '点击咨询',
'src' => 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/%E7%82%B9%E5%87%BB%E5%92%A8%E8%AF%A2-FTiyAMAPop2g9LvjLOLDz0VwPg3KVu.gif'
]
];
$reqConf = [
@@ -66,18 +67,38 @@ class PostTransferFriends extends BaseController
'endTime' => '18:00',
'remarkType' => 'phone',
'addFriendInterval' => 60,
'greeting' => '您好,我是'. $wechat['nickname'] .'的辅助客服,请通过'
'greeting' => !empty($greeting) ? $greeting :'这个是'. $wechat['nickname'] .'的新号,之前那个号没用了,重新加一下您'
];
if (!empty($firstMessage)){
$msgConf = [
[
'day' => 0,
'messages' => [
[
'id' => 1,
'type' => 'text',
'content' => $firstMessage,
'intervalUnit' => 'seconds',
'sendInterval' => 5,
]
]
]
];
}else{
$msgConf = [];
}
// 使用容器获取控制器实例,而不是直接实例化
$createAddFriendPlan = app('app\cunkebao\controller\plan\PostCreateAddFriendPlanV1Controller');
$taskId = Db::name('customer_acquisition_task')->insertGetId([
'name' => '迁移好友('. $wechat['nickname'] .'',
'sceneId' => 10,
'sceneConf' => json_encode($sceneConf),
'reqConf' => json_encode($reqConf),
'sceneConf' => json_encode($sceneConf,256),
'reqConf' => json_encode($reqConf,256),
'tagConf' => json_encode([]),
'msgConf' => json_encode($msgConf,256),
'userId' => $this->getUserInfo('id'),
'companyId' => $companyId,
'status' => 0,