|
@@ -11,8 +11,14 @@ namespace App\Http\Controllers\Api\WorkOrder; |
|
@@ -11,8 +11,14 @@ namespace App\Http\Controllers\Api\WorkOrder; |
|
11
|
|
11
|
|
|
12
|
use App\Enums\Common\Code;
|
12
|
use App\Enums\Common\Code;
|
|
13
|
use App\Http\Controllers\Api\BaseController;
|
13
|
use App\Http\Controllers\Api\BaseController;
|
|
|
|
14
|
+use App\Models\Blog\BlogCategory;
|
|
|
|
15
|
+use App\Models\News\NewsCategory;
|
|
|
|
16
|
+use App\Models\Product\Category;
|
|
|
|
17
|
+use App\Models\Product\Keyword;
|
|
14
|
use App\Models\Ticket\TicketUploadData;
|
18
|
use App\Models\Ticket\TicketUploadData;
|
|
|
|
19
|
+use App\Services\ProjectServer;
|
|
15
|
use Illuminate\Http\Request;
|
20
|
use Illuminate\Http\Request;
|
|
|
|
21
|
+use Illuminate\Support\Facades\DB;
|
|
16
|
|
22
|
|
|
17
|
/**
|
23
|
/**
|
|
18
|
* @remark :上传产品/博客/新闻模块
|
24
|
* @remark :上传产品/博客/新闻模块
|
|
@@ -39,12 +45,12 @@ class TicketUploadDataController extends BaseController |
|
@@ -39,12 +45,12 @@ class TicketUploadDataController extends BaseController |
|
39
|
public function lists()
|
45
|
public function lists()
|
|
40
|
{
|
46
|
{
|
|
41
|
$this->request->validate([
|
47
|
$this->request->validate([
|
|
42
|
- 'project_id'=>'required',
|
|
|
|
43
|
- ],[
|
48
|
+ 'project_id' => 'required',
|
|
|
|
49
|
+ ], [
|
|
44
|
'project_id.required' => 'project_id不能为空',
|
50
|
'project_id.required' => 'project_id不能为空',
|
|
45
|
]);
|
51
|
]);
|
|
46
|
- $data = $this->model->lists($this->map,$this->page,$this->row,$this->order);
|
|
|
|
47
|
- $this->response('success',Code::SUCCESS,$data);
|
52
|
+ $data = $this->model->lists($this->map, $this->page, $this->row, $this->order);
|
|
|
|
53
|
+ $this->response('success', Code::SUCCESS, $data);
|
|
48
|
}
|
54
|
}
|
|
49
|
|
55
|
|
|
50
|
/**
|
56
|
/**
|
|
@@ -54,14 +60,15 @@ class TicketUploadDataController extends BaseController |
|
@@ -54,14 +60,15 @@ class TicketUploadDataController extends BaseController |
|
54
|
* @method :post
|
60
|
* @method :post
|
|
55
|
* @time :2025/9/25 10:35
|
61
|
* @time :2025/9/25 10:35
|
|
56
|
*/
|
62
|
*/
|
|
57
|
- public function info(){
|
63
|
+ public function info()
|
|
|
|
64
|
+ {
|
|
58
|
$this->request->validate([
|
65
|
$this->request->validate([
|
|
59
|
- 'id'=>'required',
|
|
|
|
60
|
- ],[
|
66
|
+ 'id' => 'required',
|
|
|
|
67
|
+ ], [
|
|
61
|
'id.required' => 'id不能为空',
|
68
|
'id.required' => 'id不能为空',
|
|
62
|
]);
|
69
|
]);
|
|
63
|
$data = $this->model->read($this->param);
|
70
|
$data = $this->model->read($this->param);
|
|
64
|
- $this->response('success',Code::SUCCESS,$data);
|
71
|
+ $this->response('success', Code::SUCCESS, $data);
|
|
65
|
}
|
72
|
}
|
|
66
|
|
73
|
|
|
67
|
/**
|
74
|
/**
|
|
@@ -74,23 +81,100 @@ class TicketUploadDataController extends BaseController |
|
@@ -74,23 +81,100 @@ class TicketUploadDataController extends BaseController |
|
74
|
public function save()
|
81
|
public function save()
|
|
75
|
{
|
82
|
{
|
|
76
|
$this->request->validate([
|
83
|
$this->request->validate([
|
|
77
|
- 'project_id'=>'required',
|
|
|
|
78
|
- 'type'=>'required',
|
|
|
|
79
|
- 'text'=>'required'
|
|
|
|
80
|
- ],[
|
84
|
+ 'project_id' => 'required',
|
|
|
|
85
|
+ 'type' => 'required',
|
|
|
|
86
|
+ 'text' => 'required'
|
|
|
|
87
|
+ ], [
|
|
81
|
'project_id.required' => 'project_id不能为空',
|
88
|
'project_id.required' => 'project_id不能为空',
|
|
82
|
'type.required' => '上传类型不能为空',
|
89
|
'type.required' => '上传类型不能为空',
|
|
83
|
- 'text'=>'数据详情不为空'
|
90
|
+ 'text' => '数据详情不为空'
|
|
84
|
]);
|
91
|
]);
|
|
85
|
//验证当前数据是否已提交
|
92
|
//验证当前数据是否已提交
|
|
86
|
- $this->param['text'] = json_encode($this->param['text'],true);
|
|
|
|
87
|
- $info = $this->model->read(['project_id'=>$this->$this->param['project_id'],'type'=>$this->param['type'],'text'=>$this->param['text'],'status'=>0]);
|
|
|
|
88
|
- if($info === false){
|
93
|
+ $this->param['text'] = json_encode($this->param['text'], true);
|
|
|
|
94
|
+ $info = $this->model->read(['project_id' => $this->$this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]);
|
|
|
|
95
|
+ if ($info === false) {
|
|
89
|
$id = $this->model->addReturnId($this->param);
|
96
|
$id = $this->model->addReturnId($this->param);
|
|
90
|
- }else{
|
97
|
+ } else {
|
|
91
|
$id = $info['id'];
|
98
|
$id = $info['id'];
|
|
92
|
}
|
99
|
}
|
|
93
|
- $data = ['id'=>$id];
|
|
|
|
94
|
- $this->response('success',Code::SUCCESS,$data);
|
100
|
+ $data = ['id' => $id];
|
|
|
|
101
|
+ $this->response('success', Code::SUCCESS, $data);
|
|
|
|
102
|
+ }
|
|
|
|
103
|
+
|
|
|
|
104
|
+ /**
|
|
|
|
105
|
+ * @remark :根据项目获取分类
|
|
|
|
106
|
+ * @name :getProductCate
|
|
|
|
107
|
+ * @author :lyh
|
|
|
|
108
|
+ * @method :post
|
|
|
|
109
|
+ * @time :2025/9/25 15:41
|
|
|
|
110
|
+ */
|
|
|
|
111
|
+ public function getProductCate()
|
|
|
|
112
|
+ {
|
|
|
|
113
|
+ $this->request->validate([
|
|
|
|
114
|
+ 'project_id' => 'required',
|
|
|
|
115
|
+ 'type' => 'required',
|
|
|
|
116
|
+ 'search' => 'required'
|
|
|
|
117
|
+ ], [
|
|
|
|
118
|
+ 'project_id.required' => 'project_id不能为空',
|
|
|
|
119
|
+ 'type.required' => 'type不能为空',
|
|
|
|
120
|
+ 'search.required' => '搜索参数不能为空',
|
|
|
|
121
|
+ ]);
|
|
|
|
122
|
+ ProjectServer::useProject($this->param['project_id']);
|
|
|
|
123
|
+ if ($this->param['type'] == 1) {
|
|
|
|
124
|
+ //todo::搜索获取分类
|
|
|
|
125
|
+ $productCateModel = new Category();
|
|
|
|
126
|
+ $data = $productCateModel->lists(['title' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
|
|
|
|
127
|
+ } else {
|
|
|
|
128
|
+ $keywordModel = new Keyword();
|
|
|
|
129
|
+ $data = $keywordModel->lists(['title' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
|
|
|
|
130
|
+ }
|
|
|
|
131
|
+ DB::disconnect('custom_mysql');
|
|
|
|
132
|
+ $this->response('success', Code::SUCCESS, $data);
|
|
|
|
133
|
+ }
|
|
|
|
134
|
+
|
|
|
|
135
|
+ /**
|
|
|
|
136
|
+ * @remark :获取博客分类
|
|
|
|
137
|
+ * @name :getBlogCate
|
|
|
|
138
|
+ * @author :lyh
|
|
|
|
139
|
+ * @method :post
|
|
|
|
140
|
+ * @time :2025/9/25 15:42
|
|
|
|
141
|
+ */
|
|
|
|
142
|
+ public function getBlogCate()
|
|
|
|
143
|
+ {
|
|
|
|
144
|
+ $this->request->validate([
|
|
|
|
145
|
+ 'project_id' => 'required',
|
|
|
|
146
|
+ 'search' => 'required'
|
|
|
|
147
|
+ ], [
|
|
|
|
148
|
+ 'project_id.required' => 'project_id不能为空',
|
|
|
|
149
|
+ 'search.required' => '搜索参数不能为空',
|
|
|
|
150
|
+ ]);
|
|
|
|
151
|
+ ProjectServer::useProject($this->param['project_id']);
|
|
|
|
152
|
+ $blogCateModel = new BlogCategory();
|
|
|
|
153
|
+ $data = $blogCateModel->lists(['name' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
|
|
|
|
154
|
+ DB::disconnect('custom_mysql');
|
|
|
|
155
|
+ $this->response('success', Code::SUCCESS, $data);
|
|
|
|
156
|
+ }
|
|
|
|
157
|
+
|
|
|
|
158
|
+ /**
|
|
|
|
159
|
+ * @remark :获取新闻分类
|
|
|
|
160
|
+ * @name :getNewsCate
|
|
|
|
161
|
+ * @author :lyh
|
|
|
|
162
|
+ * @method :post
|
|
|
|
163
|
+ * @time :2025/9/25 15:43
|
|
|
|
164
|
+ */
|
|
|
|
165
|
+ public function getNewsCate()
|
|
|
|
166
|
+ {
|
|
|
|
167
|
+ $this->request->validate([
|
|
|
|
168
|
+ 'project_id' => 'required',
|
|
|
|
169
|
+ 'search' => 'required'
|
|
|
|
170
|
+ ], [
|
|
|
|
171
|
+ 'project_id.required' => 'project_id不能为空',
|
|
|
|
172
|
+ 'search.required' => '搜索参数不能为空',
|
|
|
|
173
|
+ ]);
|
|
|
|
174
|
+ ProjectServer::useProject($this->param['project_id']);
|
|
|
|
175
|
+ $newsCateModel = new NewsCategory();
|
|
|
|
176
|
+ $data = $newsCateModel->lists(['name' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
|
|
|
|
177
|
+ DB::disconnect('custom_mysql');
|
|
|
|
178
|
+ $this->response('success', Code::SUCCESS, $data);
|
|
95
|
}
|
179
|
}
|
|
96
|
} |
180
|
} |