CustomModuleController.php
2.8 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
<?php
/**
* @remark :
* @name :CustomModuleController.php
* @author :lyh
* @method :post
* @time :2023/12/4 15:42
*/
namespace App\Http\Controllers\Aside\CustomModule;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\CustomModule\CustomModuleLogic;
use App\Models\CustomModule\CustomModule;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
/**
* @remark :自定义模块
* @name :CustomModuleController
* @author :lyh
* @method :post
* @time :2023/12/4 15:42
*/
class CustomModuleController extends BaseController
{
/**
* @remark :获取自定义模块列表
* @name :ModuleList
* @author :lyh
* @method :post
* @time :2023/12/4 15:43
*/
public function lists(){
ProjectServer::useProject($this->param['project_id']);
$customModule = new CustomModule();
$this->map['status'] = 0;
$lists = $customModule->lists($this->map,$this->page,$this->row,$this->order = ['topping_time','sort','id']);
DB::disconnect('custom_mysql');
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :获取当前数据详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/12/4 16:09
*/
public function info(CustomModuleLogic $logic){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => 'ID不能为空',
]);
$info = $logic->getCustomModuleInfo();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2023/12/4 15:45
*/
public function save(CustomModuleLogic $logic){
$this->request->validate([
'name'=>['required'],
],[
'name.required' => '模块名称不能为空',
]);
$logic->customModuleSave();
$this->response('success');
}
/**
* @remark :删除
* @name :del
* @author :lyh
* @method :post
* @time :2023/12/5 9:53
*/
public function del(CustomModuleLogic $logic){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => 'ID不能为空',
]);
$logic->customModuleDel();
$this->response('success');
}
/**
* @remark :一键指定
* @name :topping
* @author :lyh
* @method :post
* @time :2023/12/21 10:57
*/
public function topping(CustomModuleLogic $logic){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => 'ID不能为空',
]);
$logic->setTopping();
$this->response('success');
}
}