cqp 1 ماه پیش
والد
کامیت
e7de22e4b2
3فایلهای تغییر یافته به همراه6 افزوده شده و 3 حذف شده
  1. 4 2
      app/Console/Commands/ToDoReminder.php
  2. 1 1
      app/Model/TodoList.php
  3. 1 0
      app/Service/OrderService.php

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

@@ -87,8 +87,10 @@ class ToDoReminder extends Command
                     }
 
                     // 先发送微信消息(接口可能失败)
+                    $message = "";
                     try {
                         list($status, $msg) = $this->sendReminder($todo, $wxService, $wxInfo);
+                        $message = $msg;
                         if(! $status) {
                             Log::error("发送待办提醒失败 todo_id: {$todo->id}", ['msg' => $msg]);
                         }
@@ -97,10 +99,10 @@ class ToDoReminder extends Command
                     }
 
                     // 再更新数据库(单条事务保护即可)
-                    DB::transaction(function () use ($todo, $now) {
+                    DB::transaction(function () use ($todo, $now,$message) {
                         $todo->last_remind_time = $now;
                         $todo->status = TodoList::status_one;
-                        $todo->last_time_result = $msg ?? "成功";
+                        $todo->last_time_result = $message;
                         $todo->save();
                     });
                 }

+ 1 - 1
app/Model/TodoList.php

@@ -10,7 +10,7 @@ class TodoList extends UseScopeBaseModel
     protected $dateFormat = 'U';
     const employee_column = "crt_id";
 
-    public static $field = ['title','id','type','remind_start','man_type','organization_name','crt_id','crt_time','contact','address','content','status','remind_interval','last_remind_time'];
+    public static $field = ['title','id','type','remind_start','man_type','organization_name','crt_id','crt_time','contact','address','content','status','remind_interval','last_remind_time','last_time_result'];
 
     const type_one = 1;
     const type_two = 2;

+ 1 - 0
app/Service/OrderService.php

@@ -882,6 +882,7 @@ class OrderService extends Service
 
             $data['data'][$key]['type_title'] = TodoList::$type_name[$value['type']] ?? "";
             $data['data'][$key]['status_title'] = TodoList::$status_name[$value['status']] ?? "";
+            $data['data'][$key]['last_time_result'] = $value['last_time_result'] ?? "成功";
         }
 
         return $data;