cqp 3 ヶ月 前
コミット
58a92228e3
1 ファイル変更9 行追加2 行削除
  1. 9 2
      app/Console/Commands/ToDoReminder.php

+ 9 - 2
app/Console/Commands/ToDoReminder.php

@@ -42,7 +42,11 @@ class ToDoReminder extends Command
      */
     public function handle()
     {
-        $this->handleReminders();
+        try {
+            $this->handleReminders();
+        }catch (\Exception $exception){
+            Log::error("发送待办提醒异常", ['msg' => $exception->getMessage()]);
+        }
     }
 
     public function handleReminders()
@@ -57,8 +61,11 @@ class ToDoReminder extends Command
             ->select(TodoList::$field)
             ->orderBy('id')
             ->chunkById(10, function ($data) use ($now, $wxService, $appid) {
+
+                $crtIds = $data->pluck('crt_id')->toArray();
+
                 // 查找关联员工 openid
-                $wxInfo = WxEmployeeOfficial::where('employee_id', array_column($data,'crt_id'))
+                $wxInfo = WxEmployeeOfficial::where('employee_id', $crtIds)
                     ->where('type', WxEmployeeOfficial::login_type_two)
                     ->where('appid', $appid)
                     ->pluck('open_id','id')