|
@@ -6,16 +6,14 @@ use App\Service\Miniprogram\Wechat\AccessTokenService;
|
|
use App\Service\Util\Support\Http\WechatURL;
|
|
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 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\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\Arr;
|
|
use Illuminate\Support\Facades\Redis;
|
|
use Illuminate\Support\Facades\Redis;
|
|
-use Predis\Command\Traits\DB;
|
|
|
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class WechatCheck implements ShouldQueue
|
|
class WechatCheck implements ShouldQueue
|
|
{
|
|
{
|
|
@@ -35,7 +33,7 @@ class WechatCheck implements ShouldQueue
|
|
*/
|
|
*/
|
|
public function handle(): void
|
|
public function handle(): void
|
|
{
|
|
{
|
|
- myLog('wechatCheck')->info('开始处理微信提审', [
|
|
|
|
|
|
+ myLog('WechatCheck')->info('开始处理微信提审', [
|
|
'info' => $this->info
|
|
'info' => $this->info
|
|
]);
|
|
]);
|
|
$traceContext = TraceContext::newFromParent($this->info['traceInfo']);
|
|
$traceContext = TraceContext::newFromParent($this->info['traceInfo']);
|
|
@@ -53,8 +51,8 @@ class WechatCheck implements ShouldQueue
|
|
]);
|
|
]);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- $accessToken = Redis::get(AccessTokenService::getAccessTokenRedisKey($record->appid ?:
|
|
|
|
- config('wechat.duanju.masterAppid')));
|
|
|
|
|
|
+ $appid = $record->appid ?: config('wechat.duanju.masterAppid');
|
|
|
|
+ $accessToken = Redis::get(AccessTokenService::getAccessTokenRedisKey($appid));
|
|
$medias = DB::table('video_series_wechat_check')
|
|
$medias = DB::table('video_series_wechat_check')
|
|
->where('video_id', $record->video_id)
|
|
->where('video_id', $record->video_id)
|
|
->where(['sync_status' => 4, 'is_enabled' => 1])
|
|
->where(['sync_status' => 4, 'is_enabled' => 1])
|
|
@@ -62,7 +60,13 @@ class WechatCheck implements ShouldQueue
|
|
->get();
|
|
->get();
|
|
$cover_material_id = $this->getMaterialId($record->video_cover_image, $accessToken);
|
|
$cover_material_id = $this->getMaterialId($record->video_cover_image, $accessToken);
|
|
$authorized_material_id = $this->getMaterialId($record->authorized_img, $accessToken);
|
|
$authorized_material_id = $this->getMaterialId($record->authorized_img, $accessToken);
|
|
- $publish_license_material_id = $this->getMaterialId($record->production_license_img, $accessToken);
|
|
|
|
|
|
+ if(!($cover_material_id && $authorized_material_id)) {
|
|
|
|
+ myLog('WechatCheck')->error('上传短剧封面和授权材料到临时素材失败, 请重新提审', [
|
|
|
|
+ 'appid' => $appid,
|
|
|
|
+ 'traceInfo' => $traceContext->getTraceInfo()
|
|
|
|
+ ]);
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
$postData = [
|
|
$postData = [
|
|
'name' => $record->video_name,
|
|
'name' => $record->video_name,
|
|
'media_count' => $medias->count(),
|
|
'media_count' => $medias->count(),
|
|
@@ -70,14 +74,31 @@ class WechatCheck implements ShouldQueue
|
|
'producer' => $record->producer,
|
|
'producer' => $record->producer,
|
|
'cover_material_id' =>$cover_material_id,
|
|
'cover_material_id' =>$cover_material_id,
|
|
'authorized_material_id' => $authorized_material_id,
|
|
'authorized_material_id' => $authorized_material_id,
|
|
- 'publish_license' => $record->publish_license,
|
|
|
|
- ''
|
|
|
|
|
|
+ 'registration_number' => $record->registration_number,
|
|
];
|
|
];
|
|
if($record->drama_id) {
|
|
if($record->drama_id) {
|
|
$postData['drama_id'] = $record->drama_id;
|
|
$postData['drama_id'] = $record->drama_id;
|
|
}
|
|
}
|
|
- HttpRequestService::simplePost(WechatURL::vod_auditdrama . $accessToken, );
|
|
|
|
-
|
|
|
|
|
|
+ $result = HttpRequestService::simplePost(WechatURL::vod_auditdrama . $accessToken, $postData);
|
|
|
|
+ if(false === $result || (0 != ($result['errcode'] ?? 0)) || (! ($result['drama_id'] ?? ''))) {
|
|
|
|
+ myLog('WechatCheck')->error('提审请求失败', [
|
|
|
|
+ 'appid' => $appid,
|
|
|
|
+ 'post' => $postData,
|
|
|
|
+ 'result' => $result,
|
|
|
|
+ 'traceInfo' => $traceContext->getTraceInfo()
|
|
|
|
+ ]);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ $drama_id = $result['drama_id'];
|
|
|
|
+ $now = date('Y-m-d H:i:s');
|
|
|
|
+ DB::table('video_wechat_check')
|
|
|
|
+ ->where('id', $record->id)
|
|
|
|
+ ->update([
|
|
|
|
+ 'status' =>1,
|
|
|
|
+ 'apply_at' => $now,
|
|
|
|
+ 'drama_id' => $drama_id,
|
|
|
|
+ 'updated_at' => $now,
|
|
|
|
+ ]);
|
|
}
|
|
}
|
|
|
|
|
|
public function getMaterialId($url, $accessToken){
|
|
public function getMaterialId($url, $accessToken){
|
|
@@ -94,6 +115,6 @@ class WechatCheck implements ShouldQueue
|
|
]
|
|
]
|
|
]
|
|
]
|
|
]);
|
|
]);
|
|
- return $result;
|
|
|
|
|
|
+ return $result['media_id'] ?? '';
|
|
}
|
|
}
|
|
}
|
|
}
|