panghu 11 ماه پیش
والد
کامیت
b129677c79
1فایلهای تغییر یافته به همراه25 افزوده شده و 23 حذف شده
  1. 25 23
      app/Console/Commands/SignContractCommand.php

+ 25 - 23
app/Console/Commands/SignContractCommand.php

@@ -44,32 +44,34 @@ class SignContractCommand extends Command
      */
     public function handle()
     {
-        $this->info('发起合同签署检查');
-        //获取所有文件待转的记录
-        $list = SignContract::where('status',0)->where('is_del',0)->get();
+        while (true){
+            $this->info('发起合同签署检查');
+            //获取所有文件待转的记录
+            $list = SignContract::where('status',0)->where('is_del',0)->get();
 
-        foreach ($list as $value){
-            $sign_id = $value->{'id'};
-            $file_id = $value->{'file_id'};
-            $sign_json = $value->{'sign_json'};
-            $file_path = $value->{'local_file'};
-            // 获取所有信息
-            $pathInfo = pathinfo($file_path);
-            $file_name = $pathInfo['filename'];
+            foreach ($list as $value){
+                $sign_id = $value->{'id'};
+                $file_id = $value->{'file_id'};
+                $sign_json = $value->{'sign_json'};
+                $file_path = $value->{'local_file'};
+                // 获取所有信息
+                $pathInfo = pathinfo($file_path);
+                $file_name = $pathInfo['filename'];
 
-            //获取文件状态
-            $file_status = ESignContractServer::creatServer()->getFileStatus($value->{'file_id'});
-            if(!in_array($file_status,[2,5])){
-                continue;
+                //获取文件状态
+                $file_status = ESignContractServer::creatServer()->getFileStatus($value->{'file_id'});
+                if(!in_array($file_status,[2,5])){
+                    continue;
+                }
+                //发起合同签署
+                $result = ESignContractServer::creatServer()->setContractContract($sign_id,$file_id,$sign_json,$file_name);
+                if ($result['code'] == 0){
+                    SignContract::where('id',$sign_id)->where('is_del',0)->update(['status'=>10,'msg'=>$result['msg']]);
+                }
             }
-            //发起合同签署
-            $result = ESignContractServer::creatServer()->setContractContract($sign_id,$file_id,$sign_json,$file_name);
-            if ($result['code'] == 0){
-                SignContract::where('id',$sign_id)->where('is_del',0)->update(['status'=>10,'msg'=>$result['msg']]);
-            }
-        }
 
-        $this->info('合同签署发起完成');
-        return true;
+            $this->info('合同签署发起完成');
+            sleep(5);
+        }
     }
 }