This commit is contained in:
笔记本里的永平
2025-07-21 15:32:24 +08:00
5 changed files with 24 additions and 19 deletions

View File

@@ -97,9 +97,6 @@ Route::group('v1', function () {
Route::get('autoCreate', 'app\api\controller\AllotRuleController@autoCreateAllotRules');// 自动创建分配规则 √
});
Route::group('scenarios', function () {
Route::any('', 'app\cunkebao\controller\plan\PostExternalApiV1Controller@index');
});
});
});

View File

@@ -118,8 +118,13 @@ Route::group('v1/', function () {
Route::group('v1/frontend', function () {
Route::group('v1/api/scenarios', function () {
Route::any('', 'app\cunkebao\controller\plan\PostExternalApiV1Controller@index');
});
//小程序
Route::group('v1/frontend', function () {
Route::group('business/poster', function () {
Route::post('getone', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@getPosterTaskData');
Route::post('decryptphone', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@getPhoneNumber');
@@ -129,5 +134,4 @@ Route::group('v1/frontend', function () {
return [];

View File

@@ -96,7 +96,8 @@ class PostExternalApiV1Controller extends Controller
if (!$trafficPool) {
$trafficPoolId =Db::name('traffic_pool')->insertGetId([
'identifier' => $identifier,
'mobile' => $params['phone']
'mobile' => !empty($params['phone']) ? $params['phone'] : '',
'createTime' => time()
]);
}else{
$trafficPoolId = $trafficPool['id'];

View File

@@ -150,13 +150,18 @@ class PosterWeChatMiniProgram extends Controller
}
if(isset($sceneConf['tips'])) {
$sTip = $sceneConf['tips'];
} else {
$sTip = '';
}
$data = [
'id' => $task['id'],
'name' => $task['name'],
'poster' => ['sUrl' => $posterUrl],
'sTip' => '',
'sTip' => $sTip,
];

View File

@@ -191,7 +191,6 @@ class Adapter implements WeChatServiceInterface
}
//筛选出设备在线微信在线
$wechatIdAccountIdMap = $this->getWeChatIdsAccountIdsMapByDeviceIds($task_info['reqConf']['device']);
if (empty($wechatIdAccountIdMap)) {
continue;
}
@@ -213,11 +212,9 @@ class Adapter implements WeChatServiceInterface
continue;
}
// 判断24h内加的好友数量friend_task 先固定10个人 getLast24hAddedFriendsCount
$last24hAddedFriendsCount = $this->getLast24hAddedFriendsCount($wechatId);
if ($last24hAddedFriendsCount >= 10) {
if ($last24hAddedFriendsCount >= 20) {
continue;
}
@@ -233,14 +230,15 @@ class Adapter implements WeChatServiceInterface
$task['processed_wechat_ids'] = $task['processed_wechat_ids'] . ',' . $wechatId; // 处理失败任务用,用于过滤已处理的微信号
break;
}
Db::name('task_customer')
$res = Db::name('task_customer')
->where('id', $task['id'])
->update([
'status' => $friendAddTaskCreated ? 1 : 3,
'fail_reason' => $friendAddTaskCreated ? '' : '已经是好友了',
'processed_wechat_ids' => $task['processed_wechat_ids'],
'updated_at' => time()
]); // ~~不用管,回头再添加再判断即可~~
'updateTime' => time()
]);
// ~~不用管,回头再添加再判断即可~~
// 失败一定是另一个进程/定时器在检查的
}
@@ -254,9 +252,9 @@ class Adapter implements WeChatServiceInterface
$tasks = Db::name('task_customer')
->whereIn('status', [1,2])
->where('updated_at', '>=', (time() - 86400 * 3))
->where('updateTime', '>=', (time() - 86400 * 3))
->limit(50)
->order('updated_at DESC')
->order('updateTime DESC')
->select();
if (empty($tasks)) {
@@ -296,7 +294,7 @@ class Adapter implements WeChatServiceInterface
Db::name('task_customer')
->where('id', $task['id'])
->update(['status' => 4, 'updated_at' => time()]);
->update(['status' => 4, 'updateTime' => time()]);
$wechatFriendRecord = $this->getWeChatAccoutIdAndFriendIdByWeChatIdAndFriendPhone($passedWeChatId, $task['phone']);
$msgConf = is_string($task_info['msgConf']) ? json_decode($task_info['msgConf'], 1) : $task_info['msgConf'];
@@ -316,7 +314,7 @@ class Adapter implements WeChatServiceInterface
if (isset($latestFriendTask['status']) && $latestFriendTask['status'] == 1) {
Db::name('task_customer')
->where('id', $task['id'])
->update(['status' => 2, 'updated_at' => time()]);
->update(['status' => 2, 'updateTime' => time()]);
break;
}
@@ -324,7 +322,7 @@ class Adapter implements WeChatServiceInterface
if (isset($latestFriendTask['status']) && $latestFriendTask['status'] == 2) {
Db::name('task_customer')
->where('id', $task['id'])
->update(['status' => 3, 'fail_reason' => $latestFriendTask['extra'] ?? '未知原因', 'updated_at' => time()]);
->update(['status' => 3, 'fail_reason' => $latestFriendTask['extra'] ?? '未知原因', 'updateTime' => time()]);
break;
}
}