Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
4 个修改的文件
包含
49 行增加
和
9 行删除
| @@ -117,13 +117,16 @@ class VideoTask extends Command | @@ -117,13 +117,16 @@ class VideoTask extends Command | ||
| 117 | } | 117 | } |
| 118 | $keywordInfo = $this->getKeywordImage($val->id,$task_project->project_id,$domainInfo['domain']); | 118 | $keywordInfo = $this->getKeywordImage($val->id,$task_project->project_id,$domainInfo['domain']); |
| 119 | if(!empty($keywordInfo['product_list'])){ | 119 | if(!empty($keywordInfo['product_list'])){ |
| 120 | + if(!empty($task_project->logo_img)){ | ||
| 121 | + $logo_bg['logo'] = $task_project->logo_img; | ||
| 122 | + } | ||
| 120 | $array = [ | 123 | $array = [ |
| 121 | 'project_id' => $task_project->project_id, | 124 | 'project_id' => $task_project->project_id, |
| 122 | 'keyword_id' => $val->id, | 125 | 'keyword_id' => $val->id, |
| 123 | 'keyword' => $val->title, | 126 | 'keyword' => $val->title, |
| 124 | 'data' => json_encode(['url' => $keywordInfo['url'],'title' => $keywordInfo['title'], | 127 | 'data' => json_encode(['url' => $keywordInfo['url'],'title' => $keywordInfo['title'], |
| 125 | 'description' => $keywordInfo['keyword_content'], 'images' => $keywordInfo['product_list'], | 128 | 'description' => $keywordInfo['keyword_content'], 'images' => $keywordInfo['product_list'], |
| 126 | - 'keywords' => $keywordInfo['keyword_list'], 'logo_bg' => $logo_bg]), | 129 | + 'keywords' => $keywordInfo['keyword_list'], 'logo_bg' => $logo_bg , 'template_data' => $task_project->template_data]), |
| 127 | 'status' => KeywordVideoTaskLog::STATUS_INIT, | 130 | 'status' => KeywordVideoTaskLog::STATUS_INIT, |
| 128 | 'updated_at' => date('Y-m-d H:i:s'), | 131 | 'updated_at' => date('Y-m-d H:i:s'), |
| 129 | 'created_at' => date('Y-m-d H:i:s'), | 132 | 'created_at' => date('Y-m-d H:i:s'), |
| @@ -162,7 +165,8 @@ class VideoTask extends Command | @@ -162,7 +165,8 @@ class VideoTask extends Command | ||
| 162 | 'description' => $valData['description'], | 165 | 'description' => $valData['description'], |
| 163 | 'images' => $valData['images'], | 166 | 'images' => $valData['images'], |
| 164 | 'logo'=> $valData['logo_bg']['logo'] ?? '', | 167 | 'logo'=> $valData['logo_bg']['logo'] ?? '', |
| 165 | - 'bg'=> $valData['logo_bg']['bg'] ?? '' | 168 | + 'bg'=> $valData['logo_bg']['bg'] ?? '', |
| 169 | + 'template_id'=> ((array)$valData['template_data'])['template_id'], | ||
| 166 | ], | 170 | ], |
| 167 | 'task_id' => $task_id, | 171 | 'task_id' => $task_id, |
| 168 | 'callback_url' => env('APP_URL') . '/api/video_task_callback', | 172 | 'callback_url' => env('APP_URL') . '/api/video_task_callback', |
| @@ -7,13 +7,14 @@ | @@ -7,13 +7,14 @@ | ||
| 7 | * @time :2024/2/26 9:23 | 7 | * @time :2024/2/26 9:23 |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | -namespace App\Http\Controllers\Aside\Com; | 10 | +namespace App\Http\Controllers\Aside\KeywordVideo; |
| 11 | 11 | ||
| 12 | use App\Enums\Common\Code; | 12 | use App\Enums\Common\Code; |
| 13 | use App\Http\Controllers\Aside\BaseController; | 13 | use App\Http\Controllers\Aside\BaseController; |
| 14 | use App\Models\Com\KeywordVideoTask; | 14 | use App\Models\Com\KeywordVideoTask; |
| 15 | use App\Models\Com\KeywordVideoTaskLog; | 15 | use App\Models\Com\KeywordVideoTaskLog; |
| 16 | use App\Models\Domain\DomainInfo; | 16 | use App\Models\Domain\DomainInfo; |
| 17 | +use Illuminate\Support\Facades\Cache; | ||
| 17 | 18 | ||
| 18 | class KeywordVideoController extends BaseController | 19 | class KeywordVideoController extends BaseController |
| 19 | { | 20 | { |
| @@ -114,6 +115,8 @@ class KeywordVideoController extends BaseController | @@ -114,6 +115,8 @@ class KeywordVideoController extends BaseController | ||
| 114 | 'status'=>$this->param['status'] ?? 0, | 115 | 'status'=>$this->param['status'] ?? 0, |
| 115 | 'sort'=>$this->param['sort'] ?? 0, | 116 | 'sort'=>$this->param['sort'] ?? 0, |
| 116 | 'keywords'=>$this->param['keywords'] ?? '', | 117 | 'keywords'=>$this->param['keywords'] ?? '', |
| 118 | + 'logo_img'=>$this->param['logo_img'] ?? '', | ||
| 119 | + 'template_data'=>isset($this->param['template_data']) ? json_encode($this->param['template_data'],true) : null | ||
| 117 | ]; | 120 | ]; |
| 118 | $rs = $keywordModel->add($data); | 121 | $rs = $keywordModel->add($data); |
| 119 | if($rs === false){ | 122 | if($rs === false){ |
| @@ -136,6 +139,9 @@ class KeywordVideoController extends BaseController | @@ -136,6 +139,9 @@ class KeywordVideoController extends BaseController | ||
| 136 | 'id.required' => '主键标识不为空', | 139 | 'id.required' => '主键标识不为空', |
| 137 | ]); | 140 | ]); |
| 138 | $keywordModel = new KeywordVideoTask(); | 141 | $keywordModel = new KeywordVideoTask(); |
| 142 | + if(isset($this->param['template_data']) && !empty($this->param['template_data'])){ | ||
| 143 | + $this->param['template_data'] = json_encode($this->param['template_data'],true); | ||
| 144 | + } | ||
| 139 | $rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]); | 145 | $rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]); |
| 140 | if($rs === false){ | 146 | if($rs === false){ |
| 141 | $this->response('编辑失败',Code::SYSTEM_ERROR); | 147 | $this->response('编辑失败',Code::SYSTEM_ERROR); |
| @@ -193,4 +199,26 @@ class KeywordVideoController extends BaseController | @@ -193,4 +199,26 @@ class KeywordVideoController extends BaseController | ||
| 193 | $count = $taskLogModel->formatQuery(['created_at'=>['between',[$start_of_month,$end_of_month]]])->count(); | 199 | $count = $taskLogModel->formatQuery(['created_at'=>['between',[$start_of_month,$end_of_month]]])->count(); |
| 194 | $this->response('success',Code::SUCCESS,['count'=>$count]); | 200 | $this->response('success',Code::SUCCESS,['count'=>$count]); |
| 195 | } | 201 | } |
| 202 | + | ||
| 203 | + /** | ||
| 204 | + * @remark :获取模版库模版 | ||
| 205 | + * @name :get_template | ||
| 206 | + * @author :lyh | ||
| 207 | + * @method :post | ||
| 208 | + * @time :2024/11/1 11:48 | ||
| 209 | + */ | ||
| 210 | + public function get_template(){ | ||
| 211 | + $data = Cache::get('template_data'); | ||
| 212 | + if(empty($data)){ | ||
| 213 | + $url = 'http://216.250.255.116:7866/get_template'; | ||
| 214 | + $header = [ | ||
| 215 | + 'accept: application/json' | ||
| 216 | + ]; | ||
| 217 | + $data = http_get($url,$header); | ||
| 218 | + if(!empty($data)){ | ||
| 219 | + Cache::put('template_data',$data,12 * 3600); | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + $this->response('success',Code::SUCCESS,$data); | ||
| 223 | + } | ||
| 196 | } | 224 | } |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Models\Com; | 10 | namespace App\Models\Com; |
| 11 | 11 | ||
| 12 | +use App\Helper\Arr; | ||
| 12 | use App\Models\Base; | 13 | use App\Models\Base; |
| 13 | 14 | ||
| 14 | class KeywordVideoTask extends Base | 15 | class KeywordVideoTask extends Base |
| @@ -17,4 +18,10 @@ class KeywordVideoTask extends Base | @@ -17,4 +18,10 @@ class KeywordVideoTask extends Base | ||
| 17 | const STATUS_CLOSE = 1;//停止 | 18 | const STATUS_CLOSE = 1;//停止 |
| 18 | 19 | ||
| 19 | protected $table = 'gl_keyword_video_task'; | 20 | protected $table = 'gl_keyword_video_task'; |
| 21 | + | ||
| 22 | + public function getTemplateDataAttribute($value) | ||
| 23 | + { | ||
| 24 | + $value = Arr::s2a($value); | ||
| 25 | + return $value; | ||
| 26 | + } | ||
| 20 | } | 27 | } |
| @@ -348,12 +348,13 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -348,12 +348,13 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 348 | * 生成视频的项目 | 348 | * 生成视频的项目 |
| 349 | */ | 349 | */ |
| 350 | Route::prefix('keyword_video')->group(function () { | 350 | Route::prefix('keyword_video')->group(function () { |
| 351 | - Route::any('/', [Aside\Com\KeywordVideoController::class, 'lists'])->name('keyword_video_lists'); | ||
| 352 | - Route::any('/createKeywordTask', [Aside\Com\KeywordVideoController::class, 'createKeywordTask'])->name('keyword_video_createKeywordTask'); | ||
| 353 | - Route::any('/edit', [Aside\Com\KeywordVideoController::class, 'edit'])->name('keyword_video_edit'); | ||
| 354 | - Route::any('/getVideoTaskLog', [Aside\Com\KeywordVideoController::class, 'getVideoTaskLog'])->name('keyword_video_getVideoTaskLog'); | ||
| 355 | - Route::any('/taskNum', [Aside\Com\KeywordVideoController::class, 'taskNum'])->name('keyword_video_taskNum'); | ||
| 356 | - Route::any('/getVideoCount', [Aside\Com\KeywordVideoController::class, 'getVideoCount'])->name('keyword_video_getVideoCount'); | 351 | + Route::any('/', [Aside\KeywordVideo\KeywordVideoController::class, 'lists'])->name('keyword_video_lists'); |
| 352 | + Route::any('/createKeywordTask', [Aside\KeywordVideo\KeywordVideoController::class, 'createKeywordTask'])->name('keyword_video_createKeywordTask'); | ||
| 353 | + Route::any('/edit', [Aside\KeywordVideo\KeywordVideoController::class, 'edit'])->name('keyword_video_edit'); | ||
| 354 | + Route::any('/getVideoTaskLog', [Aside\KeywordVideo\KeywordVideoController::class, 'getVideoTaskLog'])->name('keyword_video_getVideoTaskLog'); | ||
| 355 | + Route::any('/taskNum', [Aside\KeywordVideo\KeywordVideoController::class, 'taskNum'])->name('keyword_video_taskNum'); | ||
| 356 | + Route::any('/getVideoCount', [Aside\KeywordVideo\KeywordVideoController::class, 'getVideoCount'])->name('keyword_video_getVideoCount'); | ||
| 357 | + Route::any('/get_template', [Aside\KeywordVideo\KeywordVideoController::class, 'get_template'])->name('keyword_get_template'); | ||
| 357 | }); | 358 | }); |
| 358 | 359 | ||
| 359 | // 公共主题模版 | 360 | // 公共主题模版 |
-
请 注册 或 登录 后发表评论