|
|
|
@ -4,6 +4,7 @@ namespace App\Jobs; |
|
|
|
|
|
|
|
use App\Models\Agent; |
|
|
|
use App\Models\MiniProgramTemplate; |
|
|
|
use App\Models\MiniProgramUploadLog; |
|
|
|
use App\Service\UploadMiniProgram; |
|
|
|
use Exception; |
|
|
|
use GuzzleHttp\Exception\GuzzleException; |
|
|
|
@ -58,7 +59,16 @@ class UploadMiniProgramQueue implements ShouldQueue |
|
|
|
if (!$agent || !$template) return; |
|
|
|
|
|
|
|
try { |
|
|
|
new UploadMiniProgram($agent, $template); |
|
|
|
# 如果已经有上传成功的版本则不再上传
|
|
|
|
$not_uploaded = MiniProgramUploadLog::where([ |
|
|
|
'is_success' => 0, |
|
|
|
'agent_id' => $this->agent_id, |
|
|
|
'template_id' => $this->template_id, |
|
|
|
])->doesntExist(); |
|
|
|
|
|
|
|
if ($not_uploaded) { |
|
|
|
new UploadMiniProgram($agent, $template); |
|
|
|
} |
|
|
|
} catch (GuzzleException | \Exception $e) { |
|
|
|
throw new Exception($agent->id . '-' . $agent->appid . $e->getMessage()); |
|
|
|
} |
|
|
|
|