添加好友优化
This commit is contained in:
@@ -97,9 +97,6 @@ Route::group('v1', function () {
|
|||||||
Route::get('autoCreate', 'app\api\controller\AllotRuleController@autoCreateAllotRules');// 自动创建分配规则 √
|
Route::get('autoCreate', 'app\api\controller\AllotRuleController@autoCreateAllotRules');// 自动创建分配规则 √
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group('scenarios', function () {
|
|
||||||
Route::any('', 'app\cunkebao\controller\plan\PostExternalApiV1Controller@index');
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -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::group('business/poster', function () {
|
||||||
Route::post('getone', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@getPosterTaskData');
|
Route::post('getone', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@getPosterTaskData');
|
||||||
Route::post('decryptphone', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@getPhoneNumber');
|
Route::post('decryptphone', 'app\cunkebao\controller\plan\PosterWeChatMiniProgram@getPhoneNumber');
|
||||||
@@ -129,5 +134,4 @@ Route::group('v1/frontend', function () {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
@@ -96,7 +96,8 @@ class PostExternalApiV1Controller extends Controller
|
|||||||
if (!$trafficPool) {
|
if (!$trafficPool) {
|
||||||
$trafficPoolId =Db::name('traffic_pool')->insertGetId([
|
$trafficPoolId =Db::name('traffic_pool')->insertGetId([
|
||||||
'identifier' => $identifier,
|
'identifier' => $identifier,
|
||||||
'mobile' => $params['phone']
|
'mobile' => !empty($params['phone']) ? $params['phone'] : '',
|
||||||
|
'createTime' => time()
|
||||||
]);
|
]);
|
||||||
}else{
|
}else{
|
||||||
$trafficPoolId = $trafficPool['id'];
|
$trafficPoolId = $trafficPool['id'];
|
||||||
|
|||||||
@@ -191,7 +191,6 @@ class Adapter implements WeChatServiceInterface
|
|||||||
}
|
}
|
||||||
//筛选出设备在线微信在线
|
//筛选出设备在线微信在线
|
||||||
$wechatIdAccountIdMap = $this->getWeChatIdsAccountIdsMapByDeviceIds($task_info['reqConf']['device']);
|
$wechatIdAccountIdMap = $this->getWeChatIdsAccountIdsMapByDeviceIds($task_info['reqConf']['device']);
|
||||||
|
|
||||||
if (empty($wechatIdAccountIdMap)) {
|
if (empty($wechatIdAccountIdMap)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -213,11 +212,9 @@ class Adapter implements WeChatServiceInterface
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 判断24h内加的好友数量,friend_task 先固定10个人 getLast24hAddedFriendsCount
|
// 判断24h内加的好友数量,friend_task 先固定10个人 getLast24hAddedFriendsCount
|
||||||
$last24hAddedFriendsCount = $this->getLast24hAddedFriendsCount($wechatId);
|
$last24hAddedFriendsCount = $this->getLast24hAddedFriendsCount($wechatId);
|
||||||
if ($last24hAddedFriendsCount >= 10) {
|
if ($last24hAddedFriendsCount >= 20) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,14 +230,15 @@ class Adapter implements WeChatServiceInterface
|
|||||||
$task['processed_wechat_ids'] = $task['processed_wechat_ids'] . ',' . $wechatId; // 处理失败任务用,用于过滤已处理的微信号
|
$task['processed_wechat_ids'] = $task['processed_wechat_ids'] . ',' . $wechatId; // 处理失败任务用,用于过滤已处理的微信号
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Db::name('task_customer')
|
$res = Db::name('task_customer')
|
||||||
->where('id', $task['id'])
|
->where('id', $task['id'])
|
||||||
->update([
|
->update([
|
||||||
'status' => $friendAddTaskCreated ? 1 : 3,
|
'status' => $friendAddTaskCreated ? 1 : 3,
|
||||||
'fail_reason' => $friendAddTaskCreated ? '' : '已经是好友了',
|
'fail_reason' => $friendAddTaskCreated ? '' : '已经是好友了',
|
||||||
'processed_wechat_ids' => $task['processed_wechat_ids'],
|
'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')
|
$tasks = Db::name('task_customer')
|
||||||
->whereIn('status', [1,2])
|
->whereIn('status', [1,2])
|
||||||
->where('updated_at', '>=', (time() - 86400 * 3))
|
->where('updateTime', '>=', (time() - 86400 * 3))
|
||||||
->limit(50)
|
->limit(50)
|
||||||
->order('updated_at DESC')
|
->order('updateTime DESC')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
if (empty($tasks)) {
|
if (empty($tasks)) {
|
||||||
@@ -296,7 +294,7 @@ class Adapter implements WeChatServiceInterface
|
|||||||
|
|
||||||
Db::name('task_customer')
|
Db::name('task_customer')
|
||||||
->where('id', $task['id'])
|
->where('id', $task['id'])
|
||||||
->update(['status' => 4, 'updated_at' => time()]);
|
->update(['status' => 4, 'updateTime' => time()]);
|
||||||
|
|
||||||
$wechatFriendRecord = $this->getWeChatAccoutIdAndFriendIdByWeChatIdAndFriendPhone($passedWeChatId, $task['phone']);
|
$wechatFriendRecord = $this->getWeChatAccoutIdAndFriendIdByWeChatIdAndFriendPhone($passedWeChatId, $task['phone']);
|
||||||
$msgConf = is_string($task_info['msgConf']) ? json_decode($task_info['msgConf'], 1) : $task_info['msgConf'];
|
$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) {
|
if (isset($latestFriendTask['status']) && $latestFriendTask['status'] == 1) {
|
||||||
Db::name('task_customer')
|
Db::name('task_customer')
|
||||||
->where('id', $task['id'])
|
->where('id', $task['id'])
|
||||||
->update(['status' => 2, 'updated_at' => time()]);
|
->update(['status' => 2, 'updateTime' => time()]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,7 +322,7 @@ class Adapter implements WeChatServiceInterface
|
|||||||
if (isset($latestFriendTask['status']) && $latestFriendTask['status'] == 2) {
|
if (isset($latestFriendTask['status']) && $latestFriendTask['status'] == 2) {
|
||||||
Db::name('task_customer')
|
Db::name('task_customer')
|
||||||
->where('id', $task['id'])
|
->where('id', $task['id'])
|
||||||
->update(['status' => 3, 'fail_reason' => $latestFriendTask['extra'] ?? '未知原因', 'updated_at' => time()]);
|
->update(['status' => 3, 'fail_reason' => $latestFriendTask['extra'] ?? '未知原因', 'updateTime' => time()]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user