info = $info; } /** * Execute the job. */ public function handle(): void { myLog('wechatCheck')->info('开始处理微信提审', [ 'info' => $this->info ]); $traceContext = TraceContext::newFromParent($this->info['traceInfo']); $id = $this->info['id']; $record = DB::table('video_wechat_check') ->join('videos', 'videos.id', 'video_wechat_check.video_id') ->where(['video_wechat_check.id' => $id, 'video_wechat_check.is_enabled' => 1, 'video_wechat_check.status' => 0]) ->select('video_wechat_check.*', 'videos.name as video_name', 'videos.cover_image as video_cover_image') ->first(); if(!$record) { myLog('WechatCheck')->info('当前状态不支持提审', [ 'traceInfo' => $traceContext->getTraceInfo() ]); return; } $accessToken = Redis::get(AccessTokenService::getAccessTokenRedisKey($record->appid ?: config('wechat.duanju.masterAppid'))); $medias = DB::table('video_series_wechat_check') ->where('video_id', $record->video_id) ->where(['sync_status' => 4, 'is_enabled' => 1]) ->where('media_id', '<>', 0) ->get(); $cover_material_id = $this->getMaterialId($record->video_cover_image, $accessToken); $authorized_material_id = $this->getMaterialId($record->authorized_img, $accessToken); $publish_license_material_id = $this->getMaterialId($record->production_license_img, $accessToken); $postData = [ 'name' => $record->video_name, 'media_count' => $medias->count(), 'media_id_list' => $medias->pluck('media_id')->toArray(), 'producer' => $record->producer, 'cover_material_id' =>$cover_material_id, 'authorized_material_id' => $authorized_material_id, 'publish_license' => $record->publish_license, '' ]; if($record->drama_id) { $postData['drama_id'] = $record->drama_id; } HttpRequestService::simplePost(WechatURL::vod_auditdrama . $accessToken, ); } public function getMaterialId($url, $accessToken){ $result = HttpRequestService::post(WechatURL::media_upload. $accessToken, [ 'multipart' => [ [ 'name' => 'type', 'contents' => 'image', ], [ 'name' => 'media', 'contents' => file_get_contents($url), 'filename' => Arr::last(explode('/', $url)), ] ] ]); return $result; } }