| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- /**
- * app 打包 初始化
- */
- namespace App\Jobs;
- use App\Models\Mysql\PackModel;
- use GuzzleHttp\Client;
- use Illuminate\Bus\Queueable;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Queue\SerializesModels;
- class InitAppPackJob implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- protected $params = [];
- /**
- * @param array $params
- */
- public function __construct(array $params = [])
- {
- $this->params = $params;
- }
- /**
- *
- * @return void
- */
- public function handle()
- {
- $formData = [
- 'timeout' => 30,
- 'headers' => [
- 'X-TOKEN' => env('PACK_TOKEN', 'NrVcnuCUveQbr'),
- 'Content-Type' => 'application/json',
- 'Accept' => 'application/json',
- ],
- 'json' => [$this->params],
- ];
- logger('--母包初始化--',$formData);
- $url = env('PACK_URL', 'http://dispatch_php.test.wg8.site') . '/api/channel/init/mom';
- $Client = new Client();
- try {
- $res = $Client->post($url, $formData);
- } catch (\Exception $exception) {
- logger('母包初始化失败!-' . $exception->getMessage(), $this->params);
- return;
- }
- logger('--母包初始化返回数据--'.$res->getBody()->getContents());
- }
- }
|