代码优化

This commit is contained in:
wong
2025-07-07 16:06:03 +08:00
parent c0b88eb967
commit 2d4a1ee6ce

View File

@@ -247,8 +247,10 @@ class Adapter implements WeChatServiceInterface
{
$tasks = Db::name('task_customer')
->whereIn('status', [1,2,3])
->whereIn('status', [1,2])
->where('updated_at', '>=', (time() - 86400 * 3))
->limit(50)
->order('updated_at DESC')
->select();
if (empty($tasks)) {
@@ -284,15 +286,14 @@ class Adapter implements WeChatServiceInterface
if ($passedWeChatId && !empty($task_info['msgConf'])) {
Db::name('task_customer')
->where('id', $task['id'])
->update(['status' => 4, 'updated_at' => time()]);
$wechatFriendRecord = $this->getWeChatAccoutIdAndFriendIdByWeChatIdAndFriendPhone($passedWeChatId, $task['phone']);
$msgConf = is_string($task_info['msgConf']) ? json_decode($task_info['msgConf'], 1) : $task_info['msgConf'];
$wechatFriendRecord && $this->sendMsgToFriend($wechatFriendRecord['id'], $wechatFriendRecord['wechatAccountId'], $msgConf);
} else {