diff --git a/Server/application/api/config/route.php b/Server/application/api/config/route.php index f6fecbfa..79d3bc47 100644 --- a/Server/application/api/config/route.php +++ b/Server/application/api/config/route.php @@ -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'); - }); }); }); \ No newline at end of file diff --git a/Server/application/cunkebao/config/route.php b/Server/application/cunkebao/config/route.php index 69290e14..430c9516 100644 --- a/Server/application/cunkebao/config/route.php +++ b/Server/application/cunkebao/config/route.php @@ -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 []; \ No newline at end of file diff --git a/Server/application/cunkebao/controller/plan/PostExternalApiV1Controller.php b/Server/application/cunkebao/controller/plan/PostExternalApiV1Controller.php index 1d4c6a5a..10c91780 100644 --- a/Server/application/cunkebao/controller/plan/PostExternalApiV1Controller.php +++ b/Server/application/cunkebao/controller/plan/PostExternalApiV1Controller.php @@ -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']; diff --git a/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php b/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php index 495b7ae7..bc18298c 100644 --- a/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php +++ b/Server/extend/WeChatDeviceApi/Adapters/ChuKeBao/Adapter.php @@ -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; } }