panghu пре 1 година
родитељ
комит
392128056f
1 измењених фајлова са 27 додато и 0 уклоњено
  1. 27 0
      app/Console/Commands/TestCommand.php

+ 27 - 0
app/Console/Commands/TestCommand.php

@@ -11,7 +11,9 @@ use App\Models\Firm;
 use App\Models\IndentNum;
 use App\Models\Member;
 use App\Models\MemberSeal;
+use App\Models\SignContract;
 use App\Models\SignMember;
+use App\Models\SignRecord;
 use App\Models\SignSeal;
 use App\Models\SignSealAuth;
 use App\Servers\ESign\comm\EsignLogHelper;
@@ -66,6 +68,31 @@ class TestCommand extends Command
      */
     public function handle()
     {
+        $json = '{"action":"SIGN_MISSON_COMPLETE","timestamp":1749611210534,"signFlowId":"42f0db42a2ef48cc84914671e62735d3","signOrder":1,"operateTime":1749611210000,"signResult":2,"resultDescription":"\u7b7e\u7f72\u5b8c\u6210","operator":{"psnId":"337834e20a344e8b83c5fe115d230578","psnAccount":{"accountMobile":"19981858243"}}}';
+
+        $data = json_decode($json,true);
+        if ($data['action'] == 'SIGN_MISSON_COMPLETE'){
+//        file_put_contents('sign_misson_complete.txt', json_encode($data));
+            //合同签署
+            $signFlowStatus = $data['signResult'];
+            $signFlowId = $data['signFlowId'];
+            $organization = isset($data['organization']) ? $data['organization'] : '';
+            $operator = $data['operator'];
+            if (!empty($signFlowId)){
+                $sign = SignContract::where('flow_id',$signFlowId)->first();
+                $sign_id = $sign->{'id'};
+                if (!empty($operator)){
+                    $psnId = $operator['psnId'];
+                    SignRecord::where('sign_id',$sign_id)->where('authType','PSN')->where('id_no',$psnId)->update(['status'=>$signFlowStatus]);
+                }
+                if (!empty($organization)){
+                    $orgId = $organization['orgId'];
+                    SignRecord::where('sign_id',$sign_id)->where('authType','ORG')->where('id_no',$orgId)->update(['status'=>$signFlowStatus]);
+                }
+            }
+        }
+        dd(111);
+
 //        $file_id = '0a1feb9ddf3f4da198ec0bb7d0c3225a';
 //        $file_status = ESignContractServer::creatServer()->getFileStatus($file_id);
 //        dd($file_status);