|
@@ -2,13 +2,20 @@
|
|
|
|
|
|
namespace App\Jobs\Video;
|
|
namespace App\Jobs\Video;
|
|
|
|
|
|
|
|
+use App\Service\Miniprogram\Wechat\AccessTokenService;
|
|
|
|
+use App\Service\Util\Support\Http\WechatURL;
|
|
use App\Service\Util\Support\Trace\TraceContext;
|
|
use App\Service\Util\Support\Trace\TraceContext;
|
|
|
|
+use App\Service\Util\Support\Http\HttpRequestService;
|
|
|
|
+use GuzzleHttp\Psr7\Utils;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
|
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
+use Illuminate\Support\Arr;
|
|
|
|
+use Illuminate\Support\Facades\Redis;
|
|
|
|
+use Predis\Command\Traits\DB;
|
|
|
|
|
|
class WechatCheck implements ShouldQueue
|
|
class WechatCheck implements ShouldQueue
|
|
{
|
|
{
|
|
@@ -33,5 +40,60 @@ class WechatCheck implements ShouldQueue
|
|
]);
|
|
]);
|
|
$traceContext = TraceContext::newFromParent($this->info['traceInfo']);
|
|
$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;
|
|
}
|
|
}
|
|
}
|
|
}
|