Procházet zdrojové kódy

采购模板消息日志

hu hao před 5 roky
rodič
revize
eb396717bf

+ 1 - 1
app/Http/Controllers/ProcurementController.php

@@ -152,7 +152,7 @@ class ProcurementController extends Controller
         $procurement->update(['code'=>$procurement_code,'deadline'=>$deadline]);
         LogService::log(__METHOD__,"进入发送模板队列start",json_encode($procurement));
         dispatch(new ProcurementConfirmInform($procurement));  //推送发送订单通知消息模板  队列
-        ProcurementConfirmInform::dispatch($procurement);
+//        ProcurementConfirmInform::dispatch($procurement);
         LogService::log(__METHOD__,"进入发送模板队列end",json_encode($procurement));
         $procurement = $procurement->loadMissing(['initiator','ownerMaterial.material','ownerMaterial.owner.customer','ownerMaterial.file','supplier']);
         if ($procurement) return ['success' => true,'data' => $procurement];

+ 4 - 0
app/Http/Controllers/TestController.php

@@ -1265,4 +1265,8 @@ where purch.islower=1 and deliver.id>'.$id);
         }
         ProcurementCheckSheet::query()->insert($insert_);
     }
+    public function test111(){
+
+        dd(  Carbon::parse(1618826299)->toDateTimeString());
+    }
 }

+ 2 - 0
app/Jobs/ProcurementConfirmInform.php

@@ -25,6 +25,7 @@ class ProcurementConfirmInform implements ShouldQueue
     public function __construct(Procurement $procurement)
     {
         $this->procurement=$procurement;
+        LogService::log(__METHOD__," __construct",json_encode($this->procurement));
     }
 
     /**
@@ -34,6 +35,7 @@ class ProcurementConfirmInform implements ShouldQueue
      */
     public function handle()
     {
+        LogService::log(__METHOD__,"log procurement",json_encode($this->procurement));
         $pro=$this->procurement->loadMissing(['ownerMaterial.material.supplier.user.userDetail','ownerMaterial.owner.customer']);
         $suppliers=$pro->ownerMaterial->material->supplier ?? false;
         if(!$suppliers){

+ 4 - 3
app/Services/LogService.php

@@ -60,18 +60,19 @@ class LogService
         while (Redis::LLEN('LOGS') > 0) {
             $log = Redis::LPOP('LOGS');
             $arr = json_decode($log);
-            if ($length + strlen($arr->description) > 1024 * 512) {
+            $description = (is_string($arr->description)?$arr->description:json_encode($arr->description))??'';
+            if ($length + strlen($description) > 1024 * 512) {
                 Log::query()->insert($data);
                 $length = 0;
                 $data = [];
             }
-            $length = $length + strlen($arr->description);
+            $length = $length + strlen($description);
             $data[] = [
                 'class' => $arr->class,
                 'id_user' => $arr->id_user,
                 'ip' => $arr->ip,
                 'method' => $arr->method,
-                'description' => $arr->description,
+                'description' => $description,
                 'created_at' => $arr->created_at,
                 'updated_at' => $arr->updated_at,
             ];

+ 0 - 1
app/Services/ProcurementWeiXinSendMessageService.php

@@ -14,7 +14,6 @@ class ProcurementWeiXinSendMessageService
         $result = file_get_contents($url);
         $result = json_decode($result,true);
         if (array_key_exists("access_token", $result)) return $result['access_token'];
-        LogService::log(__METHOD__,"模板信息5",json_encode($result));
         return null;
     }
     //发送微信模版消息通知