AiVideoController.php
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* @remark :
* @name :AiVideoController.php
* @author :lyh
* @method :post
* @time :2025/3/5 11:00
*/
namespace App\Http\Controllers\Bside\Ai;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Ai\AiVideoLogic;
use App\Models\Ai\AiVideo;
class AiVideoController extends BaseController
{
/**
* @remark :获取aiVideo列表
* @name :lists
* @author :lyh
* @method :post
* @time :2025/3/5 14:12
*/
public function lists(AiVideo $aiVideo){
$lists = $aiVideo->lists($this->map,$this->page,$this->row,'id',['id','title','route','video_url','image','task_id','status','created_at','updated_at']);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['image'] = getImageUrl($v['image']);
if(!empty($v['route'])){
$v['route'] = $this->user['test_domain'] . 'video/' . $v['route'];
}
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :获取详情
* @name :getInfo
* @author :lyh
* @method :post
* @time :2025/3/5 14:22
*/
public function getInfo(AiVideo $aiVideo){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => '主键不能为空',
]);
$info = $aiVideo->read(['id'=>$this->param['id']]);
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :发布任务
* @name :sendTask
* @author :lyh
* @method :post
* @time :2025/3/5 14:29
*/
public function sendTask(AiVideoLogic $aiVideoLogic){
$this->request->validate([
'title'=>['required'],
'description'=>['required'],
'images'=>['required'],
],[
'title.required' => '标题不能为空',
'description.required' => '短描述不能为空',
'images.required' => '图片集合不能为空',
]);
$result = $aiVideoLogic->sendTask();
$this->response('success',Code::SUCCESS,$result);
}
/**
* @remark :更新任务
* @name :save
* @author :lyh
* @method :post
* @time :2025/3/6 10:51
*/
public function save(AiVideoLogic $aiVideoLogic){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => '关键字不能为空',
]);
$aiVideoLogic->videoSave();
$this->response('success');
}
/**
* @remark :删除ai视频
* @name :delete
* @author :lyh
* @method :post
* @time :2025/3/6 9:56
*/
public function delete(AiVideoLogic $aiVideoLogic)
{
$this->request->validate([
'ids'=>['required'],
],[
'ids.required' => 'ID不能为空'
]);
$result = $aiVideoLogic->videoDelete();
$this->response('success',Code::SUCCESS,$result);
}
}