|
@@ -9,6 +9,7 @@ |
|
@@ -9,6 +9,7 @@ |
|
9
|
|
9
|
|
|
10
|
namespace App\Http\Logic\Aside\Ticket;
|
10
|
namespace App\Http\Logic\Aside\Ticket;
|
|
11
|
|
11
|
|
|
|
|
12
|
+use App\Enums\Common\Code;
|
|
12
|
use App\Helper\Arr;
|
13
|
use App\Helper\Arr;
|
|
13
|
use App\Http\Logic\Aside\BaseLogic;
|
14
|
use App\Http\Logic\Aside\BaseLogic;
|
|
14
|
use App\Models\Blog\Blog;
|
15
|
use App\Models\Blog\Blog;
|
|
@@ -23,8 +24,10 @@ use App\Models\Product\KeywordRelated; |
|
@@ -23,8 +24,10 @@ use App\Models\Product\KeywordRelated; |
|
23
|
use App\Models\Product\Product;
|
24
|
use App\Models\Product\Product;
|
|
24
|
use App\Models\RouteMap\RouteMap;
|
25
|
use App\Models\RouteMap\RouteMap;
|
|
25
|
use App\Models\Ticket\TicketUploadData;
|
26
|
use App\Models\Ticket\TicketUploadData;
|
|
|
|
27
|
+use App\Models\WorkOrder\TicketProject;
|
|
26
|
use App\Services\ProjectServer;
|
28
|
use App\Services\ProjectServer;
|
|
27
|
use Illuminate\Support\Facades\DB;
|
29
|
use Illuminate\Support\Facades\DB;
|
|
|
|
30
|
+use Illuminate\Support\Facades\Http;
|
|
28
|
|
31
|
|
|
29
|
class TicketUploadDataLogic extends BaseLogic
|
32
|
class TicketUploadDataLogic extends BaseLogic
|
|
30
|
{
|
33
|
{
|
|
@@ -47,6 +50,9 @@ class TicketUploadDataLogic extends BaseLogic |
|
@@ -47,6 +50,9 @@ class TicketUploadDataLogic extends BaseLogic |
|
47
|
$this->map['text'] = ['like','%'.$this->map['text'].'%'];
|
50
|
$this->map['text'] = ['like','%'.$this->map['text'].'%'];
|
|
48
|
}
|
51
|
}
|
|
49
|
ProjectServer::useProject($map['project_id']);
|
52
|
ProjectServer::useProject($map['project_id']);
|
|
|
|
53
|
+ if(empty($map['type'])){
|
|
|
|
54
|
+ $map['type'] = $this->model::TYPE_SIX;//6.0数据
|
|
|
|
55
|
+ }
|
|
50
|
$data = $this->model->lists($map,$page,$row,$order);
|
56
|
$data = $this->model->lists($map,$page,$row,$order);
|
|
51
|
if(!empty($data) && !empty($data['list'])){
|
57
|
if(!empty($data) && !empty($data['list'])){
|
|
52
|
foreach ($data['list'] as &$v){
|
58
|
foreach ($data['list'] as &$v){
|
|
@@ -154,22 +160,98 @@ class TicketUploadDataLogic extends BaseLogic |
|
@@ -154,22 +160,98 @@ class TicketUploadDataLogic extends BaseLogic |
|
154
|
if($info === false){
|
160
|
if($info === false){
|
|
155
|
$this->fail('当前数据不存在或已被删除');
|
161
|
$this->fail('当前数据不存在或已被删除');
|
|
156
|
}
|
162
|
}
|
|
157
|
- //审核成功执行
|
|
|
|
158
|
- if($this->param['status'] == 1){
|
|
|
|
159
|
- ProjectServer::useProject($info['project_id']);
|
|
|
|
160
|
- if($info['type'] == 1){
|
|
|
|
161
|
- $this->saveProductData($info);
|
|
|
|
162
|
- }elseif ($info['type'] == 2){
|
|
|
|
163
|
- $this->saveBlogData($info);
|
|
|
|
164
|
- }else{
|
|
|
|
165
|
- $this->saveNewsData($info);
|
163
|
+ if($info['project_type'] == $this->model::TYPE_SIX){//6.0数据
|
|
|
|
164
|
+ //审核成功执行
|
|
|
|
165
|
+ if($this->param['status'] == $this->model::STATUS_SUCCESS){
|
|
|
|
166
|
+ ProjectServer::useProject($info['project_id']);
|
|
|
|
167
|
+ if($info['type'] == $this->model::TYPE_PRODUCT){
|
|
|
|
168
|
+ $this->saveProductData($info);
|
|
|
|
169
|
+ }elseif ($info['type'] == $this->model::TYPE_BLOG){
|
|
|
|
170
|
+ $this->saveBlogData($info);
|
|
|
|
171
|
+ }else{
|
|
|
|
172
|
+ $this->saveNewsData($info);
|
|
|
|
173
|
+ }
|
|
|
|
174
|
+ DB::disconnect('custom_mysql');
|
|
|
|
175
|
+ }
|
|
|
|
176
|
+ }else{
|
|
|
|
177
|
+ if($this->param['status'] == $this->model::STATUS_SUCCESS){
|
|
|
|
178
|
+ $ticketProjectMdoel = new TicketProject();
|
|
|
|
179
|
+ $projectInfo = $ticketProjectMdoel->read(['post_id' => $info['post_id']]);
|
|
|
|
180
|
+ if($projectInfo === false){
|
|
|
|
181
|
+ $this->fail('当前项目不存在或数据未同步');
|
|
|
|
182
|
+ }
|
|
|
|
183
|
+ $projectInfo['website'] = 'https://devmark.globalso.com/';
|
|
|
|
184
|
+ $action = $this->model->saveAction($info['type']);
|
|
|
|
185
|
+ $url = $projectInfo['website'].'wp-admin/admin-ajax.php?action='.$action;
|
|
|
|
186
|
+ if(empty($action)){
|
|
|
|
187
|
+ $this->fail('未知请求,请联系管理员!');
|
|
|
|
188
|
+ }
|
|
|
|
189
|
+ if($info['type'] == $this->model::TYPE_PRODUCT){
|
|
|
|
190
|
+ $this->save5ProductData($info,$url);
|
|
|
|
191
|
+ }else{
|
|
|
|
192
|
+ $this->save5NewsData($info,$url);
|
|
|
|
193
|
+ }
|
|
166
|
}
|
194
|
}
|
|
167
|
- DB::disconnect('custom_mysql');
|
|
|
|
168
|
}
|
195
|
}
|
|
169
|
$data = $this->model->edit(['status'=>$this->param['status'],'operator_id'=>$this->manager['id'],'remark'=>$this->param['remark'] ?? ''],['id'=>$this->param['id']]);
|
196
|
$data = $this->model->edit(['status'=>$this->param['status'],'operator_id'=>$this->manager['id'],'remark'=>$this->param['remark'] ?? ''],['id'=>$this->param['id']]);
|
|
170
|
return $this->success($data);
|
197
|
return $this->success($data);
|
|
171
|
}
|
198
|
}
|
|
172
|
|
199
|
|
|
|
|
200
|
+ /**
|
|
|
|
201
|
+ * @remark :保存5.0产品数据
|
|
|
|
202
|
+ * @name :save5ProductData
|
|
|
|
203
|
+ * @author :lyh
|
|
|
|
204
|
+ * @method :post
|
|
|
|
205
|
+ * @time :2025/11/10 14:18
|
|
|
|
206
|
+ */
|
|
|
|
207
|
+ public function save5ProductData($info,$url){
|
|
|
|
208
|
+ $response = Http::withHeaders([])->asForm()->post($url, [
|
|
|
|
209
|
+ 'title' => $info['text']['title'],
|
|
|
|
210
|
+ 'cate_id' => $info['text']['cate_id'] ?? '',
|
|
|
|
211
|
+ 'content'=>$info['text']['content'] ?? '',
|
|
|
|
212
|
+ 'short_description'=>$info['text']['short_description'] ?? '',
|
|
|
|
213
|
+ 'images'=>$info['text']['images'] ?? '',
|
|
|
|
214
|
+ ]);
|
|
|
|
215
|
+ if ($response->successful()) {
|
|
|
|
216
|
+ $result = $response->json(); // 获取 JSON 响应体
|
|
|
|
217
|
+ if ($result && $result['status'] == 200) {
|
|
|
|
218
|
+ return $this->success();
|
|
|
|
219
|
+ }
|
|
|
|
220
|
+ }
|
|
|
|
221
|
+ $this->fail('未知请求,请联系管理员!');
|
|
|
|
222
|
+ }
|
|
|
|
223
|
+
|
|
|
|
224
|
+ /**
|
|
|
|
225
|
+ * @remark :保存新闻
|
|
|
|
226
|
+ * @name :save5NewsData
|
|
|
|
227
|
+ * @author :lyh
|
|
|
|
228
|
+ * @method :post
|
|
|
|
229
|
+ * @time :2025/11/10 14:43
|
|
|
|
230
|
+ */
|
|
|
|
231
|
+ public function save5NewsData($info,$url){
|
|
|
|
232
|
+ $response = Http::withHeaders([])->asForm()->post($url, [
|
|
|
|
233
|
+ 'title' => $info['text']['title'],
|
|
|
|
234
|
+ 'cate' => $info['text']['cate_id'] ?? '',
|
|
|
|
235
|
+ 'content'=>$info['text']['content'] ?? '',
|
|
|
|
236
|
+ 'images'=>$info['text']['images'] ?? '',
|
|
|
|
237
|
+ ]);
|
|
|
|
238
|
+ if ($response->successful()) {
|
|
|
|
239
|
+ $result = $response->json(); // 获取 JSON 响应体
|
|
|
|
240
|
+ if ($result && $result['status'] == 200) {
|
|
|
|
241
|
+ return $this->success();
|
|
|
|
242
|
+ }
|
|
|
|
243
|
+ }
|
|
|
|
244
|
+ $this->fail('未知请求,请联系管理员!');
|
|
|
|
245
|
+ }
|
|
|
|
246
|
+
|
|
|
|
247
|
+
|
|
|
|
248
|
+ /**
|
|
|
|
249
|
+ * @remark :设置排序
|
|
|
|
250
|
+ * @name :setProductSort
|
|
|
|
251
|
+ * @author :lyh
|
|
|
|
252
|
+ * @method :post
|
|
|
|
253
|
+ * @time :2025/11/10 14:11
|
|
|
|
254
|
+ */
|
|
173
|
public function setProductSort($mdoel){
|
255
|
public function setProductSort($mdoel){
|
|
174
|
$info = $mdoel->orderBy('sort','desc')->first();
|
256
|
$info = $mdoel->orderBy('sort','desc')->first();
|
|
175
|
if(empty($info)){
|
257
|
if(empty($info)){
|