BlogLabelController.php
2.7 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
<?php
namespace App\Http\Controllers\Bside\Blog;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Blog\BlogLabelLogic;
use App\Http\Requests\Bside\Blog\BlogLabelRequest;
use App\Models\Blog\BlogLabel as BlogLabelModel;
use Illuminate\Http\Request;
class BlogLabelController extends BaseController
{
/**
* @name :博客标签列表
* @author :liyuhang
* @method
*/
public function lists(BlogLabelModel $blogLabelModel){
$this->map['project_id'] = $this->user['project_id'];
$lists = $blogLabelModel->lists($this->map,$this->page,$this->row,$this->order,['id','name','created_at','updated_at']);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @name :添加标签
* @return void
* @author :liyuhang
* @method
*/
public function add(BlogLabelRequest $request,BlogLabelLogic $blogLabelLogic){
$request->validated();
$blogLabelLogic->add_blog_label();
$this->response('success');
}
/**
* @remark :批量添加
* @name :batchAdd
* @author :lyh
* @method :post
* @time :2023/8/28 14:25
*/
public function batchAdd(BlogLabelLogic $logic){
$this->request->validate([
'name'=>['required','array']
],[
'name.required' => 'name不能为空',
'name.array' => 'name为数组'
]);
$data = $logic->batchAdd();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @name :编辑标签
* @author :liyuhang
* @method
*/
public function edit(BlogLabelRequest $request,BlogLabelLogic $blogLabelLogic){
$request->validate([
'id'=>['required']
],[
'id.required' => 'ID不能为空'
]);
$blogLabelLogic->edit_blog_label();
$this->response('success');
}
/**
* @name :编辑标签状态/排序
* @author :liyuhang
* @method
*/
public function status(BlogLabelLogic $blogLabelLogic){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => 'ID不能为空',
]);
$blogLabelLogic->status_blog_label();
$this->response('success');
}
/**
* @name :删除标签(批量删除)
* @author :liyuhang
* @method
*/
public function del(BlogLabelLogic $blogLabelLogic){
$this->request->validate([
'id'=>['required','array'],
],[
'id.required' => 'ID不能为空',
'id.array' => 'ID为数组',
]);
$blogLabelLogic->del_blog_label();
$this->response('success');
}
}