|
@@ -19,6 +19,7 @@ use App\Models\PostImgs;
|
|
use App\Models\PostLike;
|
|
use App\Models\PostLike;
|
|
use App\Models\PostShare;
|
|
use App\Models\PostShare;
|
|
use App\Models\Topic;
|
|
use App\Models\Topic;
|
|
|
|
+use App\Service\AliYunVodService;
|
|
use App\Service\DetectionService;
|
|
use App\Service\DetectionService;
|
|
use App\Traits\PostTrait;
|
|
use App\Traits\PostTrait;
|
|
use App\Traits\UserTrait;
|
|
use App\Traits\UserTrait;
|
|
@@ -41,6 +42,7 @@ class PostRepositories
|
|
PostCollect $postCollect,
|
|
PostCollect $postCollect,
|
|
PostShare $postShare,
|
|
PostShare $postShare,
|
|
DetectionService $detectionService,
|
|
DetectionService $detectionService,
|
|
|
|
+ AliYunVodService $aliYunVodService,
|
|
Topic $topic)
|
|
Topic $topic)
|
|
{
|
|
{
|
|
$this->post = $post;
|
|
$this->post = $post;
|
|
@@ -51,6 +53,7 @@ class PostRepositories
|
|
$this->postShare = $postShare;
|
|
$this->postShare = $postShare;
|
|
$this->detectionService = $detectionService;
|
|
$this->detectionService = $detectionService;
|
|
$this->topic = $topic;
|
|
$this->topic = $topic;
|
|
|
|
+ $this->aliYunVodService = $aliYunVodService;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -104,6 +107,18 @@ class PostRepositories
|
|
if ($detectionImageResult['code']<0) {
|
|
if ($detectionImageResult['code']<0) {
|
|
return jsonError('图片违规,请修正哦');
|
|
return jsonError('图片违规,请修正哦');
|
|
}
|
|
}
|
|
|
|
+ $videoUrl = "";
|
|
|
|
+ if(isset($request['video']) && $request['video']){
|
|
|
|
+ for($i=0;$i<3;$i++){
|
|
|
|
+ $videoUrl = $this->aliYunVodService->getPlayUrlByVideoId($request['video']);
|
|
|
|
+ if($videoUrl){
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(empty($videoUrl)){
|
|
|
|
+ return jsonError('发布失败,请重试');
|
|
|
|
+ }
|
|
|
|
|
|
$data = [
|
|
$data = [
|
|
'uid' => $userInfo['uid'],
|
|
'uid' => $userInfo['uid'],
|
|
@@ -112,7 +127,7 @@ class PostRepositories
|
|
'avatar' => $userInfo['avatar']??'',
|
|
'avatar' => $userInfo['avatar']??'',
|
|
'type' => $request['type'],
|
|
'type' => $request['type'],
|
|
'img' => $request['img'],
|
|
'img' => $request['img'],
|
|
- 'video' => isset($request['video'])? $request['video'] : '',
|
|
|
|
|
|
+ 'video' => $videoUrl,
|
|
'topic_ids' => implode(',', $topicIds),
|
|
'topic_ids' => implode(',', $topicIds),
|
|
'title' => isset($request['title'])? $request['title'] : '',
|
|
'title' => isset($request['title'])? $request['title'] : '',
|
|
'content' => $request['content'],
|
|
'content' => $request['content'],
|