AiVideoController.php
4.2 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?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;
use App\Models\Ai\AiVideoList;
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);
}
/**
* @remark :获取列表页数据
* @name :getAiBlogList
* @author :lyh
* @method :post
* @time :2025/2/21 16:22
*/
public function getAiVideoList(AiVideoList $aiVideoList){
$lists = $aiVideoList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['route'] = $this->user['domain'] . 'top-video/' . (($v['route'] > 1) ? $v['route'] : '');
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :获取列表页数据详情
* @name :getAiBlogListInfo
* @author :lyh
* @method :post
* @time :2025/2/21 16:26
*/
public function getAiBlogListInfo(AiVideoList $aiVideoList){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => '主键不能为空',
]);
$info = $aiVideoList->read($this->map);
$this->response('success',Code::SUCCESS,$info);
}
}