代码优化
This commit is contained in:
@@ -247,8 +247,10 @@ class Adapter implements WeChatServiceInterface
|
|||||||
{
|
{
|
||||||
|
|
||||||
$tasks = Db::name('task_customer')
|
$tasks = Db::name('task_customer')
|
||||||
->whereIn('status', [1,2,3])
|
->whereIn('status', [1,2])
|
||||||
|
->where('updated_at', '>=', (time() - 86400 * 3))
|
||||||
->limit(50)
|
->limit(50)
|
||||||
|
->order('updated_at DESC')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
if (empty($tasks)) {
|
if (empty($tasks)) {
|
||||||
@@ -284,15 +286,14 @@ class Adapter implements WeChatServiceInterface
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($passedWeChatId && !empty($task_info['msgConf'])) {
|
if ($passedWeChatId && !empty($task_info['msgConf'])) {
|
||||||
|
|
||||||
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, 'updated_at' => 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'];
|
||||||
|
|
||||||
$wechatFriendRecord && $this->sendMsgToFriend($wechatFriendRecord['id'], $wechatFriendRecord['wechatAccountId'], $msgConf);
|
$wechatFriendRecord && $this->sendMsgToFriend($wechatFriendRecord['id'], $wechatFriendRecord['wechatAccountId'], $msgConf);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user