| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace App\Console\Commands;
- use App\Models\SignContract;
- use App\Servers\ESign\ESignContractServer;
- use Illuminate\Console\Command;
- /**
- * 合同签署任务
- * Class SignContractCommand
- * @package App\Console\Commands
- */
- class SignContractCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'sign:contract';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '合同签署任务';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $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'];
- //获取文件状态
- $file_status = ESignContractServer::creatServer()->getFileStatus($value->{'file_id'});
- $this->info('文件状态:'.$file_status);
- 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']]);
- }
- }
- $this->info('合同签署发起完成-end');
- return true;
- }
- }
|