作者 刘锟

update

@@ -20,6 +20,7 @@ use App\Models\Devops\ServerConfig; @@ -20,6 +20,7 @@ use App\Models\Devops\ServerConfig;
20 use App\Models\Domain\DomainInfo; 20 use App\Models\Domain\DomainInfo;
21 use App\Models\Domain\DomainInfo as DomainInfoModel; 21 use App\Models\Domain\DomainInfo as DomainInfoModel;
22 use App\Models\HomeCount\Count; 22 use App\Models\HomeCount\Count;
  23 +use App\Models\Industry\ProjectIndustry;
23 use App\Models\Inquiry\InquirySet; 24 use App\Models\Inquiry\InquirySet;
24 use App\Models\Manage\BelongingGroup; 25 use App\Models\Manage\BelongingGroup;
25 use App\Models\Manage\ManageHr; 26 use App\Models\Manage\ManageHr;
@@ -51,23 +52,24 @@ class ProjectController extends BaseController @@ -51,23 +52,24 @@ class ProjectController extends BaseController
51 * @method :post 52 * @method :post
52 * @time :2023/8/30 10:11 53 * @time :2023/8/30 10:11
53 */ 54 */
54 - public function lists(Project $project){ 55 + public function lists(Project $project)
  56 + {
55 $query = $project->leftJoin('gl_project_payment', 'gl_project.id', '=', 'gl_project_payment.project_id') 57 $query = $project->leftJoin('gl_project_payment', 'gl_project.id', '=', 'gl_project_payment.project_id')
56 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') 58 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
57 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 59 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
58 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id') 60 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id')
59 ->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id') 61 ->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id')
60 - ->where('gl_project.delete_status',Project::TYPE_ZERO); 62 + ->where('gl_project.delete_status', Project::TYPE_ZERO);
61 $query = $this->searchParam($query); 63 $query = $this->searchParam($query);
62 $query = $this->orderByList($query); 64 $query = $this->orderByList($query);
63 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray(); 65 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
64 - if(!empty($lists) && !empty($lists['list'])){  
65 - foreach ($lists['list'] as $k => $v){ 66 + if (!empty($lists) && !empty($lists['list'])) {
  67 + foreach ($lists['list'] as $k => $v) {
66 $v = $this->handleParam($v); 68 $v = $this->handleParam($v);
67 $lists['list'][$k] = $v; 69 $lists['list'][$k] = $v;
68 } 70 }
69 } 71 }
70 - $this->response('success',Code::SUCCESS,$lists); 72 + $this->response('success', Code::SUCCESS, $lists);
71 } 73 }
72 74
73 75
@@ -75,7 +77,8 @@ class ProjectController extends BaseController @@ -75,7 +77,8 @@ class ProjectController extends BaseController
75 * 需要查询的字段 77 * 需要查询的字段
76 * @return array 78 * @return array
77 */ 79 */
78 - public function selectParam(){ 80 + public function selectParam()
  81 + {
79 $select = [ 82 $select = [
80 'gl_project.id AS id', 83 'gl_project.id AS id',
81 'gl_project.title AS title', 84 'gl_project.title AS title',
@@ -127,7 +130,8 @@ class ProjectController extends BaseController @@ -127,7 +130,8 @@ class ProjectController extends BaseController
127 * @method :post 130 * @method :post
128 * @time :2023/12/29 17:14 131 * @time :2023/12/29 17:14
129 */ 132 */
130 - public function orderByList($query){ 133 + public function orderByList($query)
  134 + {
131 $query = $query->orderBy('gl_project.uptime', 'desc')->orderBy('gl_project.id', 'desc'); 135 $query = $query->orderBy('gl_project.uptime', 'desc')->orderBy('gl_project.id', 'desc');
132 return $query; 136 return $query;
133 } 137 }
@@ -139,7 +143,8 @@ class ProjectController extends BaseController @@ -139,7 +143,8 @@ class ProjectController extends BaseController
139 * @method :post 143 * @method :post
140 * @time :2023/8/18 10:58 144 * @time :2023/8/18 10:58
141 */ 145 */
142 - public function searchParam(&$query){ 146 + public function searchParam(&$query)
  147 + {
143 //参数type 148 //参数type
144 $query = $this->searchType($query); 149 $query = $this->searchType($query);
145 //根据查看权限获取项目搜索条件(必带) 150 //根据查看权限获取项目搜索条件(必带)
@@ -164,18 +169,19 @@ class ProjectController extends BaseController @@ -164,18 +169,19 @@ class ProjectController extends BaseController
164 * @param $query 169 * @param $query
165 * @return mixed 170 * @return mixed
166 */ 171 */
167 - public function searchType(&$query){  
168 - if(isset($this->map['type'])){  
169 - $query->where('gl_project.extend_type', '!=' ,5);  
170 - if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])){ 172 + public function searchType(&$query)
  173 + {
  174 + if (isset($this->map['type'])) {
  175 + $query->where('gl_project.extend_type', '!=', 5);
  176 + if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])) {
171 $query->where('gl_project.type', $this->map['type']); 177 $query->where('gl_project.type', $this->map['type']);
172 - } elseif ($this->map['type'] == 8){  
173 - $query->where('gl_project_online_check.id', null)->where('gl_project.type',Project::TYPE_TWO);  
174 - }else{  
175 - $query->whereIn('gl_project.type', [Project::TYPE_FOUR,Project::TYPE_SIX]); 178 + } elseif ($this->map['type'] == 8) {
  179 + $query->where('gl_project_online_check.id', null)->where('gl_project.type', Project::TYPE_TWO);
  180 + } else {
  181 + $query->whereIn('gl_project.type', [Project::TYPE_FOUR, Project::TYPE_SIX]);
176 } 182 }
177 } 183 }
178 - if(isset($this->map['uptime']) && is_array($this->map['uptime'])){ 184 + if (isset($this->map['uptime']) && is_array($this->map['uptime'])) {
179 $query->whereBetween('gl_project.uptime', $this->map['uptime']); 185 $query->whereBetween('gl_project.uptime', $this->map['uptime']);
180 } 186 }
181 return $query; 187 return $query;
@@ -188,8 +194,9 @@ class ProjectController extends BaseController @@ -188,8 +194,9 @@ class ProjectController extends BaseController
188 * @method :post 194 * @method :post
189 * @time :2023/11/6 16:27 195 * @time :2023/11/6 16:27
190 */ 196 */
191 - public function searchUpgrade(&$query){  
192 - if(isset($this->map['is_upgrade'])){ 197 + public function searchUpgrade(&$query)
  198 + {
  199 + if (isset($this->map['is_upgrade'])) {
193 $query->where('gl_project.is_upgrade', $this->map['is_upgrade']); 200 $query->where('gl_project.is_upgrade', $this->map['is_upgrade']);
194 } 201 }
195 return $query; 202 return $query;
@@ -200,31 +207,32 @@ class ProjectController extends BaseController @@ -200,31 +207,32 @@ class ProjectController extends BaseController
200 * @param $query 207 * @param $query
201 * @return mixed 208 * @return mixed
202 */ 209 */
203 - public function searchContent(&$query){  
204 - if(!empty($this->map['domain_type']) && !empty($this->map['domain_search'])){  
205 - if($this->map['domain_type'] == 'domain'){ 210 + public function searchContent(&$query)
  211 + {
  212 + if (!empty($this->map['domain_type']) && !empty($this->map['domain_search'])) {
  213 + if ($this->map['domain_type'] == 'domain') {
206 $parsedUrl = parse_url($this->map['domain_search']); 214 $parsedUrl = parse_url($this->map['domain_search']);
207 $this->map['domain_search'] = $parsedUrl['host'] ?? $this->map['domain_search']; 215 $this->map['domain_search'] = $parsedUrl['host'] ?? $this->map['domain_search'];
208 - $ids = DomainInfo::where('domain', 'like', '%'.$this->map['domain_search'].'%')->pluck('id')->toArray(); 216 + $ids = DomainInfo::where('domain', 'like', '%' . $this->map['domain_search'] . '%')->pluck('id')->toArray();
209 $query->whereIn('gl_project_deploy_optimize.domain', $ids); 217 $query->whereIn('gl_project_deploy_optimize.domain', $ids);
210 - }else{  
211 - $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['domain_search'].'%'); 218 + } else {
  219 + $query->where('gl_project_deploy_build.test_domain', 'like', '%' . $this->map['domain_search'] . '%');
212 } 220 }
213 } 221 }
214 - if(!empty($this->map['search']) && !empty($this->map['search_type'])){ 222 + if (!empty($this->map['search']) && !empty($this->map['search_type'])) {
215 $query->where(function ($subQuery) { 223 $query->where(function ($subQuery) {
216 // 搜索域名 224 // 搜索域名
217 if ($this->map['search_type'] == 'domain') { 225 if ($this->map['search_type'] == 'domain') {
218 $parsedUrl = parse_url($this->map['search']); 226 $parsedUrl = parse_url($this->map['search']);
219 $this->map['search'] = $parsedUrl['host'] ?? $this->map['search']; 227 $this->map['search'] = $parsedUrl['host'] ?? $this->map['search'];
220 - $ids = DomainInfo::where('domain', 'like', '%'.$this->map['search'].'%')->pluck('id')->toArray(); 228 + $ids = DomainInfo::where('domain', 'like', '%' . $this->map['search'] . '%')->pluck('id')->toArray();
221 $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids); 229 $subQuery->whereIn('gl_project_deploy_optimize.domain', $ids);
222 - } else if($this->map['search_type'] == 'test_domain'){  
223 - $subQuery->where('gl_project_deploy_build.test_domain','like','%'.$this->map['search'].'%'); 230 + } else if ($this->map['search_type'] == 'test_domain') {
  231 + $subQuery->where('gl_project_deploy_build.test_domain', 'like', '%' . $this->map['search'] . '%');
224 } else { 232 } else {
225 // 搜索名称 233 // 搜索名称
226 - $subQuery->orwhere('gl_project.company','like','%'.$this->map['search'].'%')  
227 - ->orwhere('gl_project.title','like','%'.$this->map['search'].'%'); 234 + $subQuery->orwhere('gl_project.company', 'like', '%' . $this->map['search'] . '%')
  235 + ->orwhere('gl_project.title', 'like', '%' . $this->map['search'] . '%');
228 } 236 }
229 }); 237 });
230 } 238 }
@@ -238,15 +246,16 @@ class ProjectController extends BaseController @@ -238,15 +246,16 @@ class ProjectController extends BaseController
238 * @method :post 246 * @method :post
239 * @time :2023/11/9 10:16 247 * @time :2023/11/9 10:16
240 */ 248 */
241 - public function searchChannel(&$query){  
242 - if(isset($this->map['zone_id']) && !empty($this->map['zone_id'])){  
243 - $query->where('gl_project.channel','like','%"zone_id": "'.$this->map['zone_id'].'"%'); 249 + public function searchChannel(&$query)
  250 + {
  251 + if (isset($this->map['zone_id']) && !empty($this->map['zone_id'])) {
  252 + $query->where('gl_project.channel', 'like', '%"zone_id": "' . $this->map['zone_id'] . '"%');
244 } 253 }
245 - if(isset($this->map['channel_id']) && !empty($this->map['channel_id'])){  
246 - $query->where('gl_project.channel','like','%"channel_id": "'.$this->map['channel_id'].'"%'); 254 + if (isset($this->map['channel_id']) && !empty($this->map['channel_id'])) {
  255 + $query->where('gl_project.channel', 'like', '%"channel_id": "' . $this->map['channel_id'] . '"%');
247 } 256 }
248 - if(isset($this->map['user_id']) && !empty($this->map['user_id'])){  
249 - $query->where('gl_project.channel','like','%"user_id": "'.$this->map['user_id'].'"%'); 257 + if (isset($this->map['user_id']) && !empty($this->map['user_id'])) {
  258 + $query->where('gl_project.channel', 'like', '%"user_id": "' . $this->map['user_id'] . '"%');
250 } 259 }
251 return $query; 260 return $query;
252 } 261 }
@@ -258,14 +267,15 @@ class ProjectController extends BaseController @@ -258,14 +267,15 @@ class ProjectController extends BaseController
258 * @method :post 267 * @method :post
259 * @time :2023/9/7 18:40 268 * @time :2023/9/7 18:40
260 */ 269 */
261 - public function searchDept(&$query){  
262 - if(!empty($this->map['dept_id'])){  
263 - if($this->map['dept_id'] == 7 || $this->map['dept_id'] == 9){//7,9代表合并组H+F组  
264 - $query->whereIn('gl_project_deploy_build.dept_id', [7,9]);  
265 - }else{ 270 + public function searchDept(&$query)
  271 + {
  272 + if (!empty($this->map['dept_id'])) {
  273 + if ($this->map['dept_id'] == 7 || $this->map['dept_id'] == 9) {//7,9代表合并组H+F组
  274 + $query->whereIn('gl_project_deploy_build.dept_id', [7, 9]);
  275 + } else {
266 $query->where(function ($subQuery) { 276 $query->where(function ($subQuery) {
267 - $subQuery->orwhere('gl_project_deploy_build.dept_id',$this->map['dept_id'])  
268 - ->orwhere('gl_project_deploy_optimize.dept_id',$this->map['dept_id']); 277 + $subQuery->orwhere('gl_project_deploy_build.dept_id', $this->map['dept_id'])
  278 + ->orwhere('gl_project_deploy_optimize.dept_id', $this->map['dept_id']);
269 }); 279 });
270 } 280 }
271 } 281 }
@@ -279,24 +289,25 @@ class ProjectController extends BaseController @@ -279,24 +289,25 @@ class ProjectController extends BaseController
279 * @method :post 289 * @method :post
280 * @time :2024/3/4 14:58 290 * @time :2024/3/4 14:58
281 */ 291 */
282 - public function searchTechMid(&$query){  
283 - if(isset($this->map['tech_mid'])){  
284 - $query = $query->where('gl_project_deploy_optimize.tech_mid',$this->map['tech_mid']); 292 + public function searchTechMid(&$query)
  293 + {
  294 + if (isset($this->map['tech_mid'])) {
  295 + $query = $query->where('gl_project_deploy_optimize.tech_mid', $this->map['tech_mid']);
285 } 296 }
286 - if(isset($this->map['optimize_optimist_mid'])){  
287 - $query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimize_optimist_mid']); 297 + if (isset($this->map['optimize_optimist_mid'])) {
  298 + $query = $query->where('gl_project_deploy_optimize.optimist_mid', $this->map['optimize_optimist_mid']);
288 } 299 }
289 - if(isset($this->map['plan'])){  
290 - $query = $query->where('gl_project_deploy_build.plan',$this->map['plan']); 300 + if (isset($this->map['plan'])) {
  301 + $query = $query->where('gl_project_deploy_build.plan', $this->map['plan']);
291 } 302 }
292 - if(isset($this->map['site_status'])){  
293 - $query = $query->where('gl_project.site_status',$this->map['site_status']); 303 + if (isset($this->map['site_status'])) {
  304 + $query = $query->where('gl_project.site_status', $this->map['site_status']);
294 } 305 }
295 - if(isset($this->map['domain'])){  
296 - if($this->map['domain'] == 0){  
297 - $query = $query->where('gl_project_deploy_optimize.domain',null);  
298 - }else{  
299 - $query = $query->where('gl_project_deploy_optimize.domain','!=',null); 306 + if (isset($this->map['domain'])) {
  307 + if ($this->map['domain'] == 0) {
  308 + $query = $query->where('gl_project_deploy_optimize.domain', null);
  309 + } else {
  310 + $query = $query->where('gl_project_deploy_optimize.domain', '!=', null);
300 } 311 }
301 } 312 }
302 return $query; 313 return $query;
@@ -309,11 +320,12 @@ class ProjectController extends BaseController @@ -309,11 +320,12 @@ class ProjectController extends BaseController
309 * @method :post 320 * @method :post
310 * @time :2023/9/7 17:28 321 * @time :2023/9/7 17:28
311 */ 322 */
312 - public function getManagerRole(&$query){  
313 - if(($this->manage['role'] != 1)){//1代表查看所有 323 + public function getManagerRole(&$query)
  324 + {
  325 + if (($this->manage['role'] != 1)) {//1代表查看所有
314 //获取用户所在组 326 //获取用户所在组
315 $managerHr = new ManageHr(); 327 $managerHr = new ManageHr();
316 - $info = $managerHr->read(['manage_id'=>$this->manage['id']]); 328 + $info = $managerHr->read(['manage_id' => $this->manage['id']]);
317 //获取当前用户自己的项目 329 //获取当前用户自己的项目
318 $query->where(function ($subQuery) use ($info) { 330 $query->where(function ($subQuery) use ($info) {
319 $subQuery->whereIn('gl_project.id', [1]) // 项目1 + 项目3默认显示 331 $subQuery->whereIn('gl_project.id', [1]) // 项目1 + 项目3默认显示
@@ -378,24 +390,25 @@ class ProjectController extends BaseController @@ -378,24 +390,25 @@ class ProjectController extends BaseController
378 * @method :post 390 * @method :post
379 * @time :2023/8/18 14:44 391 * @time :2023/8/18 14:44
380 */ 392 */
381 - public function handleParam(&$item){  
382 - if($item['type'] != Project::TYPE_ZERO){ 393 + public function handleParam(&$item)
  394 + {
  395 + if ($item['type'] != Project::TYPE_ZERO) {
383 $data = APublicModel::getNumByProjectId($item['id']); 396 $data = APublicModel::getNumByProjectId($item['id']);
384 } 397 }
385 - if($item['type'] == Project::TYPE_ONE){//建站中 398 + if ($item['type'] == Project::TYPE_ONE) {//建站中
386 $processModel = new ProcessRecords(); 399 $processModel = new ProcessRecords();
387 $item['sign_project'] = 1; 400 $item['sign_project'] = 1;
388 - $count = $processModel->counts(['project_id'=>$item['id']]);  
389 - if($count < 1){ 401 + $count = $processModel->counts(['project_id' => $item['id']]);
  402 + if ($count < 1) {
390 $item['sign_project'] = 0; 403 $item['sign_project'] = 0;
391 - }else{  
392 - $proInfo = $processModel->read(['project_id'=>$item['id'],'date'=>['>=',date('Y-m-d', strtotime('-3 days'))]],['id']);  
393 - if($proInfo !== false){ 404 + } else {
  405 + $proInfo = $processModel->read(['project_id' => $item['id'], 'date' => ['>=', date('Y-m-d', strtotime('-3 days'))]], ['id']);
  406 + if ($proInfo !== false) {
394 $item['sign_project'] = 0; 407 $item['sign_project'] = 0;
395 } 408 }
396 } 409 }
397 } 410 }
398 - if(!empty($item['extend_type'])){ 411 + if (!empty($item['extend_type'])) {
399 $item['type'] = $item['extend_type']; 412 $item['type'] = $item['extend_type'];
400 } 413 }
401 $manageModel = new ManageHr(); 414 $manageModel = new ManageHr();
@@ -413,7 +426,7 @@ class ProjectController extends BaseController @@ -413,7 +426,7 @@ class ProjectController extends BaseController
413 $item['created_at'] = date('Y年m月d日', strtotime($item['cooperate_date'])); 426 $item['created_at'] = date('Y年m月d日', strtotime($item['cooperate_date']));
414 $item['autologin_code'] = getAutoLoginCode($item['id']); 427 $item['autologin_code'] = getAutoLoginCode($item['id']);
415 $domainModel = new DomainInfo(); 428 $domainModel = new DomainInfo();
416 - $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : ''; 429 + $item['domain'] = !empty($item['domain']) ? $domainModel->getDomain($item['domain']) : '';
417 $item['product_num'] = $data['product'] ?? 0; 430 $item['product_num'] = $data['product'] ?? 0;
418 $item['keyword_num'] = $data['key'] ?? 0; 431 $item['keyword_num'] = $data['key'] ?? 0;
419 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0); 432 $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
@@ -430,14 +443,15 @@ class ProjectController extends BaseController @@ -430,14 +443,15 @@ class ProjectController extends BaseController
430 * @method :post 443 * @method :post
431 * @time :2023/8/17 16:42 444 * @time :2023/8/17 16:42
432 */ 445 */
433 - public function info(ProjectLogic $logic){ 446 + public function info(ProjectLogic $logic)
  447 + {
434 $this->request->validate([ 448 $this->request->validate([
435 - 'id'=>'required'  
436 - ],[ 449 + 'id' => 'required'
  450 + ], [
437 'id.required' => 'ID不能为空' 451 'id.required' => 'ID不能为空'
438 ]); 452 ]);
439 $data = $logic->getProjectInfo($this->param['id']); 453 $data = $logic->getProjectInfo($this->param['id']);
440 - $this->response('success',Code::SUCCESS,$data); 454 + $this->response('success', Code::SUCCESS, $data);
441 } 455 }
442 456
443 /** 457 /**
@@ -447,14 +461,15 @@ class ProjectController extends BaseController @@ -447,14 +461,15 @@ class ProjectController extends BaseController
447 * @method :post 461 * @method :post
448 * @time :2024/6/18 11:53 462 * @time :2024/6/18 11:53
449 */ 463 */
450 - public function deleteMinorLanguages(ProjectLogic $logic){ 464 + public function deleteMinorLanguages(ProjectLogic $logic)
  465 + {
451 $this->request->validate([ 466 $this->request->validate([
452 - 'id'=>'required'  
453 - ],[ 467 + 'id' => 'required'
  468 + ], [
454 'id.required' => 'ID不能为空' 469 'id.required' => 'ID不能为空'
455 ]); 470 ]);
456 $data = $logic->deleteMinorLanguages(); 471 $data = $logic->deleteMinorLanguages();
457 - $this->response('success',Code::SUCCESS,$data); 472 + $this->response('success', Code::SUCCESS, $data);
458 } 473 }
459 474
460 /** 475 /**
@@ -467,9 +482,9 @@ class ProjectController extends BaseController @@ -467,9 +482,9 @@ class ProjectController extends BaseController
467 public function save(ProjectLogic $logic) 482 public function save(ProjectLogic $logic)
468 { 483 {
469 $this->request->validate([ 484 $this->request->validate([
470 - 'type'=>'required',  
471 - 'serve_id'=>'required',  
472 - ],[ 485 + 'type' => 'required',
  486 + 'serve_id' => 'required',
  487 + ], [
473 'type.required' => '类型不能为空', 488 'type.required' => '类型不能为空',
474 'serve_id.required' => '请选择服务器' 489 'serve_id.required' => '请选择服务器'
475 ]); 490 ]);
@@ -482,23 +497,24 @@ class ProjectController extends BaseController @@ -482,23 +497,24 @@ class ProjectController extends BaseController
482 * @author zbj 497 * @author zbj
483 * @date 2023/5/17 498 * @date 2023/5/17
484 */ 499 */
485 - public function inquiry_set(Request $request, ProjectLogic $logic){ 500 + public function inquiry_set(Request $request, ProjectLogic $logic)
  501 + {
486 $request->validate([ 502 $request->validate([
487 - 'project_id'=>'required'  
488 - ],[ 503 + 'project_id' => 'required'
  504 + ], [
489 'project_id.required' => '项目ID不能为空' 505 'project_id.required' => '项目ID不能为空'
490 ]); 506 ]);
491 - if($request->isMethod('get')){ 507 + if ($request->isMethod('get')) {
492 $data = InquirySet::where('project_id', $request->project_id)->first(); 508 $data = InquirySet::where('project_id', $request->project_id)->first();
493 - if(!$data){ 509 + if (!$data) {
494 $data = ['emails' => '', 'phones' => '']; 510 $data = ['emails' => '', 'phones' => ''];
495 - }else{ 511 + } else {
496 $data = $data->toArray(); 512 $data = $data->toArray();
497 } 513 }
498 - $this->response('success',Code::SUCCESS,$data); 514 + $this->response('success', Code::SUCCESS, $data);
499 } 515 }
500 $data = $logic->saveInquirySet($this->param); 516 $data = $logic->saveInquirySet($this->param);
501 - $this->response('success',Code::SUCCESS,$data); 517 + $this->response('success', Code::SUCCESS, $data);
502 } 518 }
503 519
504 520
@@ -509,9 +525,10 @@ class ProjectController extends BaseController @@ -509,9 +525,10 @@ class ProjectController extends BaseController
509 * @method :post 525 * @method :post
510 * @time :2023/12/7 10:41 526 * @time :2023/12/7 10:41
511 */ 527 */
512 - public function data_source(ProjectLogic $logic){ 528 + public function data_source(ProjectLogic $logic)
  529 + {
513 $data = $logic->dataSource(); 530 $data = $logic->dataSource();
514 - $this->response('success',Code::SUCCESS,$data); 531 + $this->response('success', Code::SUCCESS, $data);
515 } 532 }
516 533
517 /** 534 /**
@@ -519,9 +536,10 @@ class ProjectController extends BaseController @@ -519,9 +536,10 @@ class ProjectController extends BaseController
519 * @author zbj 536 * @author zbj
520 * @date 2023/6/27 537 * @date 2023/6/27
521 */ 538 */
522 - public function city_source(){ 539 + public function city_source()
  540 + {
523 $data = City::source($this->param['id'] ?? 0); 541 $data = City::source($this->param['id'] ?? 0);
524 - $this->response('success',Code::SUCCESS,$data); 542 + $this->response('success', Code::SUCCESS, $data);
525 } 543 }
526 544
527 /** 545 /**
@@ -529,9 +547,10 @@ class ProjectController extends BaseController @@ -529,9 +547,10 @@ class ProjectController extends BaseController
529 * @author zbj 547 * @author zbj
530 * @date 2023/6/27 548 * @date 2023/6/27
531 */ 549 */
532 - public function channel_source(ProjectLogic $logic){ 550 + public function channel_source(ProjectLogic $logic)
  551 + {
533 $data = $logic->channelSource($this->param); 552 $data = $logic->channelSource($this->param);
534 - $this->response('success',Code::SUCCESS,$data); 553 + $this->response('success', Code::SUCCESS, $data);
535 } 554 }
536 555
537 /** 556 /**
@@ -539,14 +558,15 @@ class ProjectController extends BaseController @@ -539,14 +558,15 @@ class ProjectController extends BaseController
539 * @author zbj 558 * @author zbj
540 * @date 2023/6/25 559 * @date 2023/6/25
541 */ 560 */
542 - public function get_process_records(Request $request, ProcessRecordsLogic $logic){ 561 + public function get_process_records(Request $request, ProcessRecordsLogic $logic)
  562 + {
543 $request->validate([ 563 $request->validate([
544 - 'project_id'=>'required'  
545 - ],[ 564 + 'project_id' => 'required'
  565 + ], [
546 'project_id.required' => '项目ID不能为空' 566 'project_id.required' => '项目ID不能为空'
547 ]); 567 ]);
548 $data = $logic->getInfo($this->param['project_id']); 568 $data = $logic->getInfo($this->param['project_id']);
549 - $this->response('success',Code::SUCCESS,$data); 569 + $this->response('success', Code::SUCCESS, $data);
550 } 570 }
551 571
552 /** 572 /**
@@ -554,7 +574,8 @@ class ProjectController extends BaseController @@ -554,7 +574,8 @@ class ProjectController extends BaseController
554 * @author zbj 574 * @author zbj
555 * @date 2023/6/25 575 * @date 2023/6/25
556 */ 576 */
557 - public function save_process_records(ProcessRecordsRequest $request, ProcessRecordsLogic $logic){ 577 + public function save_process_records(ProcessRecordsRequest $request, ProcessRecordsLogic $logic)
  578 + {
558 $request->validated(); 579 $request->validated();
559 $logic->recordSave(); 580 $logic->recordSave();
560 $this->response('success'); 581 $this->response('success');
@@ -565,15 +586,16 @@ class ProjectController extends BaseController @@ -565,15 +586,16 @@ class ProjectController extends BaseController
565 * @author zbj 586 * @author zbj
566 * @date 2023/6/27 587 * @date 2023/6/27
567 */ 588 */
568 - public function get_contract_bill(Request $request){ 589 + public function get_contract_bill(Request $request)
  590 + {
569 $request->validate([ 591 $request->validate([
570 - 'id'=>'required'  
571 - ],[ 592 + 'id' => 'required'
  593 + ], [
572 'id.required' => 'ID不能为空' 594 'id.required' => 'ID不能为空'
573 ]); 595 ]);
574 $payment = Payment::where('project_id', $this->param['id'])->select(['contract', 'bill'])->first(); 596 $payment = Payment::where('project_id', $this->param['id'])->select(['contract', 'bill'])->first();
575 $data = $payment->makeVisible(['contract', 'bill']); 597 $data = $payment->makeVisible(['contract', 'bill']);
576 - $this->response('success',Code::SUCCESS,$data ? $data->toArray() : []); 598 + $this->response('success', Code::SUCCESS, $data ? $data->toArray() : []);
577 } 599 }
578 600
579 /** 601 /**
@@ -583,10 +605,11 @@ class ProjectController extends BaseController @@ -583,10 +605,11 @@ class ProjectController extends BaseController
583 * @method :post 605 * @method :post
584 * @time :2023/12/2 9:59 606 * @time :2023/12/2 9:59
585 */ 607 */
586 - public function submit_check(OnlineCheckLogic $logic){ 608 + public function submit_check(OnlineCheckLogic $logic)
  609 + {
587 $this->request->validate([ 610 $this->request->validate([
588 - 'id'=>'required'  
589 - ],[ 611 + 'id' => 'required'
  612 + ], [
590 'id.required' => 'ID不能为空' 613 'id.required' => 'ID不能为空'
591 ]); 614 ]);
592 $logic->saveOnlineCheck(); 615 $logic->saveOnlineCheck();
@@ -600,12 +623,13 @@ class ProjectController extends BaseController @@ -600,12 +623,13 @@ class ProjectController extends BaseController
600 * @method :post 623 * @method :post
601 * @time :2023/8/30 19:01 624 * @time :2023/8/30 19:01
602 */ 625 */
603 - public function online_check(OnlineCheckLogic $logic){ 626 + public function online_check(OnlineCheckLogic $logic)
  627 + {
604 $this->request->validate([ 628 $this->request->validate([
605 - 'id'=>'required',  
606 - 'type'=>'required|in:optimist,qa',  
607 - 'status'=>'required|in:0,1'  
608 - ],[ 629 + 'id' => 'required',
  630 + 'type' => 'required|in:optimist,qa',
  631 + 'status' => 'required|in:0,1'
  632 + ], [
609 'id.required' => 'ID不能为空', 633 'id.required' => 'ID不能为空',
610 'type.required' => '请选择审核类型', 634 'type.required' => '请选择审核类型',
611 'type.in' => '审核类型值无效', 635 'type.in' => '审核类型值无效',
@@ -623,15 +647,16 @@ class ProjectController extends BaseController @@ -623,15 +647,16 @@ class ProjectController extends BaseController
623 * @method :post 647 * @method :post
624 * @time :2023/8/4 16:27 648 * @time :2023/8/4 16:27
625 */ 649 */
626 - public function getBelongingGroup(){ 650 + public function getBelongingGroup()
  651 + {
627 $this->request->validate([ 652 $this->request->validate([
628 - 'type'=>'required',  
629 - ],[ 653 + 'type' => 'required',
  654 + ], [
630 'type.required' => '请选择审核类型' 655 'type.required' => '请选择审核类型'
631 ]); 656 ]);
632 $belongGroupModel = new BelongingGroup(); 657 $belongGroupModel = new BelongingGroup();
633 - $lists = $belongGroupModel->list($this->map,'name',['id','name','type'],'asc');  
634 - $this->response('success',Code::SUCCESS,$lists); 658 + $lists = $belongGroupModel->list($this->map, 'name', ['id', 'name', 'type'], 'asc');
  659 + $this->response('success', Code::SUCCESS, $lists);
635 } 660 }
636 661
637 /** 662 /**
@@ -641,21 +666,22 @@ class ProjectController extends BaseController @@ -641,21 +666,22 @@ class ProjectController extends BaseController
641 * @method :post 666 * @method :post
642 * @time :2023/8/8 10:29 667 * @time :2023/8/8 10:29
643 */ 668 */
644 - public function getManagerList(){ 669 + public function getManagerList()
  670 + {
645 $hrManagerModel = new ManageHr(); 671 $hrManagerModel = new ManageHr();
646 - if(!isset($this->map['status'])){ 672 + if (!isset($this->map['status'])) {
647 $this->map['status'] = $hrManagerModel::STATUS_ONE; 673 $this->map['status'] = $hrManagerModel::STATUS_ONE;
648 - }else{  
649 - if(!is_array($this->map['status'])){ 674 + } else {
  675 + if (!is_array($this->map['status'])) {
650 $this->map['status'] = [$this->map['status']]; 676 $this->map['status'] = [$this->map['status']];
651 } 677 }
652 - $this->map['status'] = ['in',$this->map['status']]; 678 + $this->map['status'] = ['in', $this->map['status']];
653 } 679 }
654 - if(isset($this->map['entry_position']) && !empty($this->map['entry_position'])){  
655 - $this->map['entry_position'] = ['in',$this->map['entry_position']]; 680 + if (isset($this->map['entry_position']) && !empty($this->map['entry_position'])) {
  681 + $this->map['entry_position'] = ['in', $this->map['entry_position']];
656 } 682 }
657 - $lists = $hrManagerModel->list($this->map,['sort','id'],['id','manage_id','name','entry_position','is_leader']);  
658 - $this->response('success',Code::SUCCESS,$lists); 683 + $lists = $hrManagerModel->list($this->map, ['sort', 'id'], ['id', 'manage_id', 'name', 'entry_position', 'is_leader']);
  684 + $this->response('success', Code::SUCCESS, $lists);
659 } 685 }
660 686
661 /** 687 /**
@@ -665,10 +691,11 @@ class ProjectController extends BaseController @@ -665,10 +691,11 @@ class ProjectController extends BaseController
665 * @method :post 691 * @method :post
666 * @time :2023/8/14 10:23 todo::后面删除 692 * @time :2023/8/14 10:23 todo::后面删除
667 */ 693 */
668 - public function getServiceConfig(){ 694 + public function getServiceConfig()
  695 + {
669 $serviceConfigModel = new ServerConfig(); 696 $serviceConfigModel = new ServerConfig();
670 - $list = $serviceConfigModel->list($this->param,'id',['id','type','title','count','init_domain','service_type']);  
671 - $this->response('success',Code::SUCCESS,$list); 697 + $list = $serviceConfigModel->list($this->param, 'id', ['id', 'type', 'title', 'count', 'init_domain', 'service_type']);
  698 + $this->response('success', Code::SUCCESS, $list);
672 } 699 }
673 700
674 /** 701 /**
@@ -678,15 +705,16 @@ class ProjectController extends BaseController @@ -678,15 +705,16 @@ class ProjectController extends BaseController
678 * @method :post 705 * @method :post
679 * @time :2023/8/14 10:29 706 * @time :2023/8/14 10:29
680 */ 707 */
681 - public function getDomain(){ 708 + public function getDomain()
  709 + {
682 $this->request->validate([ 710 $this->request->validate([
683 - 'project_id'=>'required',  
684 - ],[ 711 + 'project_id' => 'required',
  712 + ], [
685 'project_id.required' => 'project_id不能为空', 713 'project_id.required' => 'project_id不能为空',
686 ]); 714 ]);
687 $domainModel = new DomainInfo(); 715 $domainModel = new DomainInfo();
688 - $list = $domainModel->list(['status'=>0,'project_id'=>['or',$this->param['project_id']]]);  
689 - $this->response('success',Code::SUCCESS,$list); 716 + $list = $domainModel->list(['status' => 0, 'project_id' => ['or', $this->param['project_id']]]);
  717 + $this->response('success', Code::SUCCESS, $list);
690 } 718 }
691 719
692 /** 720 /**
@@ -694,18 +722,19 @@ class ProjectController extends BaseController @@ -694,18 +722,19 @@ class ProjectController extends BaseController
694 * @author zbj 722 * @author zbj
695 * @date 2023/9/4 723 * @date 2023/9/4
696 */ 724 */
697 - public function getProjectInService(){ 725 + public function getProjectInService()
  726 + {
698 $company = $this->param['company']; 727 $company = $this->param['company'];
699 - if(!$company){  
700 - $this->response('企业名称必传',Code::SYSTEM_ERROR); 728 + if (!$company) {
  729 + $this->response('企业名称必传', Code::SYSTEM_ERROR);
701 } 730 }
702 $project = Project::where('company', $company)->first(); 731 $project = Project::where('company', $company)->first();
703 - if($project && ($project['remain_day'] > 0 || in_array($project['type'], [0, 1,6]))){ 732 + if ($project && ($project['remain_day'] > 0 || in_array($project['type'], [0, 1, 6]))) {
704 $in_service = 1; 733 $in_service = 1;
705 - }else{ 734 + } else {
706 $in_service = 0; 735 $in_service = 0;
707 } 736 }
708 - $this->response('success',Code::SUCCESS, ['in_service' => $in_service]); 737 + $this->response('success', Code::SUCCESS, ['in_service' => $in_service]);
709 } 738 }
710 739
711 /** 740 /**
@@ -715,10 +744,11 @@ class ProjectController extends BaseController @@ -715,10 +744,11 @@ class ProjectController extends BaseController
715 * @method :post 744 * @method :post
716 * @time :2023/9/8 15:21 745 * @time :2023/9/8 15:21
717 */ 746 */
718 - public function del(ProjectLogic $logic){ 747 + public function del(ProjectLogic $logic)
  748 + {
719 $this->request->validate([ 749 $this->request->validate([
720 - 'id'=>'required',  
721 - ],[ 750 + 'id' => 'required',
  751 + ], [
722 'id.required' => 'id不能为空', 752 'id.required' => 'id不能为空',
723 ]); 753 ]);
724 $logic->projectDel(); 754 $logic->projectDel();
@@ -730,7 +760,8 @@ class ProjectController extends BaseController @@ -730,7 +760,8 @@ class ProjectController extends BaseController
730 * @author zbj 760 * @author zbj
731 * @date 2023/9/11 761 * @date 2023/9/11
732 */ 762 */
733 - public function getProjectByChannel(){ 763 + public function getProjectByChannel()
  764 + {
734 $id = $this->param['id'] ?? ''; 765 $id = $this->param['id'] ?? '';
735 $notice_order_id = $this->param['notice_order_id'] ?? ''; 766 $notice_order_id = $this->param['notice_order_id'] ?? '';
736 $source_id = $this->param['channel_id'] ?? 0; //原系统渠道id 767 $source_id = $this->param['channel_id'] ?? 0; //原系统渠道id
@@ -738,50 +769,50 @@ class ProjectController extends BaseController @@ -738,50 +769,50 @@ class ProjectController extends BaseController
738 $type = $this->param['type'] ?? ''; 769 $type = $this->param['type'] ?? '';
739 $company = $this->param['company'] ?? ''; 770 $company = $this->param['company'] ?? '';
740 771
741 - if(!$source_id && !$id){  
742 - $this->response('参数异常',Code::SYSTEM_ERROR); 772 + if (!$source_id && !$id) {
  773 + $this->response('参数异常', Code::SYSTEM_ERROR);
743 } 774 }
744 $channel_id = 0; 775 $channel_id = 0;
745 - if($source_id){ 776 + if ($source_id) {
746 $channel = Channel::where('source_id', $source_id)->first(); 777 $channel = Channel::where('source_id', $source_id)->first();
747 - if(!$channel){  
748 - $this->response('渠道不存在',Code::SYSTEM_ERROR); 778 + if (!$channel) {
  779 + $this->response('渠道不存在', Code::SYSTEM_ERROR);
749 } 780 }
750 $channel_id = $channel->id; 781 $channel_id = $channel->id;
751 } 782 }
752 783
753 - if ($id){  
754 - if(!is_array($id)){ 784 + if ($id) {
  785 + if (!is_array($id)) {
755 $id = explode(',', $id); 786 $id = explode(',', $id);
756 } 787 }
757 } 788 }
758 - if ($notice_order_id){  
759 - if(!is_array($notice_order_id)){ 789 + if ($notice_order_id) {
  790 + if (!is_array($notice_order_id)) {
760 $notice_order_id = explode(',', $notice_order_id); 791 $notice_order_id = explode(',', $notice_order_id);
761 } 792 }
762 } 793 }
763 794
764 $data = Project::with(['deploy_build', 'deploy_optimize', 'online_check']) 795 $data = Project::with(['deploy_build', 'deploy_optimize', 'online_check'])
765 ->where('delete_status', 0) 796 ->where('delete_status', 0)
766 - ->where(function ($query) use ($channel_id, $type, $company, $id, $notice_order_id){  
767 - if ($channel_id) {  
768 - $query->where('channel->channel_id', $channel_id);  
769 - }  
770 - if ($type) {  
771 - $query->where('type', $type);  
772 - }  
773 - if ($company) {  
774 - $query->where('company', 'like', '%' . $company . '%');  
775 - }  
776 - if ($id) {  
777 - $query->whereIn('id', $id);  
778 - }  
779 - if ($notice_order_id) {  
780 - $query->whereIn('notice_order_id', $notice_order_id);  
781 - }  
782 - })->orderBy('id', 'desc')->paginate($size)->toArray(); 797 + ->where(function ($query) use ($channel_id, $type, $company, $id, $notice_order_id) {
  798 + if ($channel_id) {
  799 + $query->where('channel->channel_id', $channel_id);
  800 + }
  801 + if ($type) {
  802 + $query->where('type', $type);
  803 + }
  804 + if ($company) {
  805 + $query->where('company', 'like', '%' . $company . '%');
  806 + }
  807 + if ($id) {
  808 + $query->whereIn('id', $id);
  809 + }
  810 + if ($notice_order_id) {
  811 + $query->whereIn('notice_order_id', $notice_order_id);
  812 + }
  813 + })->orderBy('id', 'desc')->paginate($size)->toArray();
783 $list = []; 814 $list = [];
784 - foreach ($data['list'] as $item){ 815 + foreach ($data['list'] as $item) {
785 $domain = ''; 816 $domain = '';
786 if ($item['deploy_optimize']['domain']) { 817 if ($item['deploy_optimize']['domain']) {
787 $domain_pro = DomainInfo::where('id', $item['deploy_optimize']['domain'])->first(); 818 $domain_pro = DomainInfo::where('id', $item['deploy_optimize']['domain'])->first();
@@ -790,29 +821,29 @@ class ProjectController extends BaseController @@ -790,29 +821,29 @@ class ProjectController extends BaseController
790 } 821 }
791 $manageHr = new ManageHr(); 822 $manageHr = new ManageHr();
792 $param = [ 823 $param = [
793 - "id" => $item['id'],  
794 - "title" => $item['title'],  
795 - "company" => $item['company'],  
796 - "type" => $item['type'],  
797 - "type_text" => Project::typeMap()[$item['type']] ?? '',  
798 - "channel" => $item['channel'],  
799 - "created_at" => $item['created_at'],  
800 - "updated_at" => $item['updated_at'],  
801 - "post_id" => $item['post_id'],  
802 - "from_order_id" => $item['from_order_id'],  
803 - "remain_day" => $item['remain_day'],  
804 - "last_inquiry_time" => $item['last_inquiry_time'],  
805 - "plan" => $item['deploy_build']['plan'] ?: 0,  
806 - "plan_text" => Project::planMap()[$item['deploy_build']['plan']] ?? '',  
807 - "start_date" => $item['deploy_optimize']['start_date'] ?? '',  
808 - "domain" => $domain ? 'https://' . $domain : $domain,  
809 - "test_domain" => $item['deploy_build']['test_domain'] ?? '', 824 + "id" => $item['id'],
  825 + "title" => $item['title'],
  826 + "company" => $item['company'],
  827 + "type" => $item['type'],
  828 + "type_text" => Project::typeMap()[$item['type']] ?? '',
  829 + "channel" => $item['channel'],
  830 + "created_at" => $item['created_at'],
  831 + "updated_at" => $item['updated_at'],
  832 + "post_id" => $item['post_id'],
  833 + "from_order_id" => $item['from_order_id'],
  834 + "remain_day" => $item['remain_day'],
  835 + "last_inquiry_time" => $item['last_inquiry_time'],
  836 + "plan" => $item['deploy_build']['plan'] ?: 0,
  837 + "plan_text" => Project::planMap()[$item['deploy_build']['plan']] ?? '',
  838 + "start_date" => $item['deploy_optimize']['start_date'] ?? '',
  839 + "domain" => $domain ? 'https://' . $domain : $domain,
  840 + "test_domain" => $item['deploy_build']['test_domain'] ?? '',
810 // "online_time" => $item['online_check']['qa_check_time'] ?? '', 841 // "online_time" => $item['online_check']['qa_check_time'] ?? '',
811 - "online_time" => $item['uptime'] ?? '',  
812 - "cooperate_date" => $item['cooperate_date'],  
813 - "project_manager_name" => $manageHr->getName($item['deploy_build']['manager_mid']), //项目经理  
814 - "after_sales_manager_name" => $manageHr->getName($item['deploy_optimize']['manager_mid']), //售后服务经理  
815 - "leader_name" => $manageHr->getName($item['deploy_build']['leader_mid']), //组长 842 + "online_time" => $item['uptime'] ?? '',
  843 + "cooperate_date" => $item['cooperate_date'],
  844 + "project_manager_name" => $manageHr->getName($item['deploy_build']['manager_mid']), //项目经理
  845 + "after_sales_manager_name" => $manageHr->getName($item['deploy_optimize']['manager_mid']), //售后服务经理
  846 + "leader_name" => $manageHr->getName($item['deploy_build']['leader_mid']), //组长
816 ]; 847 ];
817 if ($item['type'] == Project::TYPE_TWO) { 848 if ($item['type'] == Project::TYPE_TWO) {
818 $param['is_compliance'] = RankData::where('project_id', $item['id'])->where('lang', '')->value('is_compliance') ?: 0; 849 $param['is_compliance'] = RankData::where('project_id', $item['id'])->where('lang', '')->value('is_compliance') ?: 0;
@@ -828,7 +859,7 @@ class ProjectController extends BaseController @@ -828,7 +859,7 @@ class ProjectController extends BaseController
828 $list[] = $param; 859 $list[] = $param;
829 } 860 }
830 $data['list'] = $list; 861 $data['list'] = $list;
831 - $this->response('success',Code::SUCCESS, $data); 862 + $this->response('success', Code::SUCCESS, $data);
832 } 863 }
833 864
834 /** 865 /**
@@ -838,9 +869,10 @@ class ProjectController extends BaseController @@ -838,9 +869,10 @@ class ProjectController extends BaseController
838 * @method :post 869 * @method :post
839 * @time :2023/9/28 9:09 870 * @time :2023/9/28 9:09
840 */ 871 */
841 - public function getRenewLog(RenewLog $renewLog){  
842 - $lists = $renewLog->lists($this->map,$this->page,$this->row,$this->order);  
843 - $this->response('success',Code::SUCCESS,$lists); 872 + public function getRenewLog(RenewLog $renewLog)
  873 + {
  874 + $lists = $renewLog->lists($this->map, $this->page, $this->row, $this->order);
  875 + $this->response('success', Code::SUCCESS, $lists);
844 } 876 }
845 877
846 /** 878 /**
@@ -850,20 +882,21 @@ class ProjectController extends BaseController @@ -850,20 +882,21 @@ class ProjectController extends BaseController
850 * @method :post 882 * @method :post
851 * @time :2023/11/8 11:17 883 * @time :2023/11/8 11:17
852 */ 884 */
853 - public function tdkList(){ 885 + public function tdkList()
  886 + {
854 $this->request->validate([ 887 $this->request->validate([
855 - 'project_id'=>'required',  
856 - ],[ 888 + 'project_id' => 'required',
  889 + ], [
857 'project_id.required' => '项目ID不能为空', 890 'project_id.required' => '项目ID不能为空',
858 ]); 891 ]);
859 $tdkModel = new ProjectUpdateTdk(); 892 $tdkModel = new ProjectUpdateTdk();
860 - $list = $tdkModel->list(['project_id'=>$this->map['project_id']],'id',['*'],'desc',5);  
861 - if(!empty($list)){  
862 - foreach ($list as $k => $v){ 893 + $list = $tdkModel->list(['project_id' => $this->map['project_id']], 'id', ['*'], 'desc', 5);
  894 + if (!empty($list)) {
  895 + foreach ($list as $k => $v) {
863 $list[$k] = $this->handleTdk($v); 896 $list[$k] = $this->handleTdk($v);
864 } 897 }
865 } 898 }
866 - $this->response('success',Code::SUCCESS,$list); 899 + $this->response('success', Code::SUCCESS, $list);
867 } 900 }
868 901
869 /** 902 /**
@@ -873,28 +906,29 @@ class ProjectController extends BaseController @@ -873,28 +906,29 @@ class ProjectController extends BaseController
873 * @method :post 906 * @method :post
874 * @time :2023/12/29 11:16 907 * @time :2023/12/29 11:16
875 */ 908 */
876 - public function handleTdk($item){ 909 + public function handleTdk($item)
  910 + {
877 $data = [ 911 $data = [
878 - 'gl_product'=>'产品',  
879 - 'gl_product_category'=>'产品分类',  
880 - 'gl_product_keyword'=>'产品关键字',  
881 - 'gl_news'=>'新闻',  
882 - 'gl_news_category'=>'新闻分类',  
883 - 'gl_blog'=>'博客',  
884 - 'gl_blog_category'=>'博客分类',  
885 - 'gl_web_custom_template'=>'自定义页面', 912 + 'gl_product' => '产品',
  913 + 'gl_product_category' => '产品分类',
  914 + 'gl_product_keyword' => '产品关键字',
  915 + 'gl_news' => '新闻',
  916 + 'gl_news_category' => '新闻分类',
  917 + 'gl_blog' => '博客',
  918 + 'gl_blog_category' => '博客分类',
  919 + 'gl_web_custom_template' => '自定义页面',
886 ]; 920 ];
887 - foreach ($data as $k => $v){  
888 - if(isset($item[$k])){ 921 + foreach ($data as $k => $v) {
  922 + if (isset($item[$k])) {
889 $data = Arr::s2a($item[$k]); 923 $data = Arr::s2a($item[$k]);
890 //{"des": 3500, "title": 0, "keyword": 3501, "total_page": 8458, "keyword_title": 3500, "keyword_content": 3500} 924 //{"des": 3500, "title": 0, "keyword": 3501, "total_page": 8458, "keyword_title": 3500, "keyword_content": 3500}
891 - $item[$k] = $v.'总条数:'.$data['total_page'].  
892 - ', title更新数:'.$data['title'].  
893 - ',keyword更新数:'.$data['keyword'].  
894 - ',des更新数:'.$data['des'];  
895 - if($k == 'gl_product_keyword'){  
896 - $item[$k] .= ',keyword_title更新数:'.($data['keyword_title']??0);  
897 - $item[$k] .= ',keyword_content更新数:'.($data['keyword_content']??0); 925 + $item[$k] = $v . '总条数:' . $data['total_page'] .
  926 + ', title更新数:' . $data['title'] .
  927 + ',keyword更新数:' . $data['keyword'] .
  928 + ',des更新数:' . $data['des'];
  929 + if ($k == 'gl_product_keyword') {
  930 + $item[$k] .= ',keyword_title更新数:' . ($data['keyword_title'] ?? 0);
  931 + $item[$k] .= ',keyword_content更新数:' . ($data['keyword_content'] ?? 0);
898 } 932 }
899 } 933 }
900 934
@@ -909,14 +943,15 @@ class ProjectController extends BaseController @@ -909,14 +943,15 @@ class ProjectController extends BaseController
909 * @method :post 943 * @method :post
910 * @time :2023/11/8 14:17 944 * @time :2023/11/8 14:17
911 */ 945 */
912 - public function copyProject(ProjectLogic $logic){ 946 + public function copyProject(ProjectLogic $logic)
  947 + {
913 $this->request->validate([ 948 $this->request->validate([
914 - 'project_id'=>'required',  
915 - ],[ 949 + 'project_id' => 'required',
  950 + ], [
916 'project_id.required' => 'project_id不能为空', 951 'project_id.required' => 'project_id不能为空',
917 ]); 952 ]);
918 $data = $logic->copyProject(); 953 $data = $logic->copyProject();
919 - $this->response('success',Code::SUCCESS,$data); 954 + $this->response('success', Code::SUCCESS, $data);
920 } 955 }
921 956
922 /** 957 /**
@@ -924,14 +959,15 @@ class ProjectController extends BaseController @@ -924,14 +959,15 @@ class ProjectController extends BaseController
924 * @author zbj 959 * @author zbj
925 * @date 2023/11/10 960 * @date 2023/11/10
926 */ 961 */
927 - public function site_token(ProjectLogic $logic){ 962 + public function site_token(ProjectLogic $logic)
  963 + {
928 $this->request->validate([ 964 $this->request->validate([
929 - 'project_id'=>'required',  
930 - ],[ 965 + 'project_id' => 'required',
  966 + ], [
931 'project_id.required' => 'project_id不能为空', 967 'project_id.required' => 'project_id不能为空',
932 ]); 968 ]);
933 $token = $logic->getSiteToken($this->map); 969 $token = $logic->getSiteToken($this->map);
934 - $this->response('success',Code::SUCCESS,['site_token' => $token]); 970 + $this->response('success', Code::SUCCESS, ['site_token' => $token]);
935 } 971 }
936 972
937 /** 973 /**
@@ -941,14 +977,15 @@ class ProjectController extends BaseController @@ -941,14 +977,15 @@ class ProjectController extends BaseController
941 * @method :post 977 * @method :post
942 * @time :2023/11/17 15:23 978 * @time :2023/11/17 15:23
943 */ 979 */
944 - public function saveOtherProject(ProjectLogic $logic){ 980 + public function saveOtherProject(ProjectLogic $logic)
  981 + {
945 $this->request->validate([ 982 $this->request->validate([
946 - 'id'=>'required',  
947 - 'aicc'=>'required',  
948 - 'hagro'=>'required', 983 + 'id' => 'required',
  984 + 'aicc' => 'required',
  985 + 'hagro' => 'required',
949 // 'exclusive_aicc_day'=>'required', 986 // 'exclusive_aicc_day'=>'required',
950 // 'exclusive_hagro_day'=>'required', 987 // 'exclusive_hagro_day'=>'required',
951 - ],[ 988 + ], [
952 'id.required' => 'id不能为空', 989 'id.required' => 'id不能为空',
953 'aicc.required' => 'aicc是否开启不能为空', 990 'aicc.required' => 'aicc是否开启不能为空',
954 'hagro.required' => 'hagro是否开启不能为空', 991 'hagro.required' => 'hagro是否开启不能为空',
@@ -966,14 +1003,15 @@ class ProjectController extends BaseController @@ -966,14 +1003,15 @@ class ProjectController extends BaseController
966 * @method :post 1003 * @method :post
967 * @time :2023/11/17 15:23 1004 * @time :2023/11/17 15:23
968 */ 1005 */
969 - public function getOtherProject(ProjectLogic $logic){ 1006 + public function getOtherProject(ProjectLogic $logic)
  1007 + {
970 $this->request->validate([ 1008 $this->request->validate([
971 - 'id'=>'required',  
972 - ],[ 1009 + 'id' => 'required',
  1010 + ], [
973 'id.required' => 'id不能为空', 1011 'id.required' => 'id不能为空',
974 ]); 1012 ]);
975 $info = $logic->getOtherProject(); 1013 $info = $logic->getOtherProject();
976 - $this->response('success',Code::SUCCESS,$info); 1014 + $this->response('success', Code::SUCCESS, $info);
977 } 1015 }
978 1016
979 /** 1017 /**
@@ -983,20 +1021,21 @@ class ProjectController extends BaseController @@ -983,20 +1021,21 @@ class ProjectController extends BaseController
983 * @method :post 1021 * @method :post
984 * @time :2023/11/17 16:08 1022 * @time :2023/11/17 16:08
985 */ 1023 */
986 - public function getChannel(){ 1024 + public function getChannel()
  1025 + {
987 $zoneModel = new Zone(); 1026 $zoneModel = new Zone();
988 $zone_list = $zoneModel->list(); 1027 $zone_list = $zoneModel->list();
989 $channelModel = new Channel(); 1028 $channelModel = new Channel();
990 $channelUserModel = new User(); 1029 $channelUserModel = new User();
991 - foreach ($zone_list as $k => $v){  
992 - $channel_list = $channelModel->list(['zone_id'=>$v['id']]);  
993 - foreach ($channel_list as $k1 => $v1){  
994 - $user_list = $channelUserModel->list(['channel_id'=>$v1['id']]); 1030 + foreach ($zone_list as $k => $v) {
  1031 + $channel_list = $channelModel->list(['zone_id' => $v['id']]);
  1032 + foreach ($channel_list as $k1 => $v1) {
  1033 + $user_list = $channelUserModel->list(['channel_id' => $v1['id']]);
995 $channel_list[$k1]['sub'] = $user_list; 1034 $channel_list[$k1]['sub'] = $user_list;
996 } 1035 }
997 $zone_list[$k]['sub'] = $channel_list; 1036 $zone_list[$k]['sub'] = $channel_list;
998 } 1037 }
999 - $this->response('success',Code::SUCCESS,$zone_list); 1038 + $this->response('success', Code::SUCCESS, $zone_list);
1000 } 1039 }
1001 1040
1002 /** 1041 /**
@@ -1006,10 +1045,11 @@ class ProjectController extends BaseController @@ -1006,10 +1045,11 @@ class ProjectController extends BaseController
1006 * @method :post 1045 * @method :post
1007 * @time :2023/11/30 10:59 1046 * @time :2023/11/30 10:59
1008 */ 1047 */
1009 - public function languageLists(){ 1048 + public function languageLists()
  1049 + {
1010 $webLanguageModel = new WebLanguage(); 1050 $webLanguageModel = new WebLanguage();
1011 $lists = $webLanguageModel->list(); 1051 $lists = $webLanguageModel->list();
1012 - $this->response('success',Code::SUCCESS,$lists); 1052 + $this->response('success', Code::SUCCESS, $lists);
1013 } 1053 }
1014 1054
1015 /** 1055 /**
@@ -1017,8 +1057,9 @@ class ProjectController extends BaseController @@ -1017,8 +1057,9 @@ class ProjectController extends BaseController
1017 * @author zbj 1057 * @author zbj
1018 * @date 2024/1/19 1058 * @date 2024/1/19
1019 */ 1059 */
1020 - public function countryLists(){  
1021 - $this->response('success',Code::SUCCESS, Country::getCountryList()); 1060 + public function countryLists()
  1061 + {
  1062 + $this->response('success', Code::SUCCESS, Country::getCountryList());
1022 } 1063 }
1023 1064
1024 /** 1065 /**
@@ -1026,10 +1067,11 @@ class ProjectController extends BaseController @@ -1026,10 +1067,11 @@ class ProjectController extends BaseController
1026 * @author zbj 1067 * @author zbj
1027 * @date 2024/1/19 1068 * @date 2024/1/19
1028 */ 1069 */
1029 - public function saveInquiryFilterConfig(ProjectLogic $logic){ 1070 + public function saveInquiryFilterConfig(ProjectLogic $logic)
  1071 + {
1030 $this->request->validate([ 1072 $this->request->validate([
1031 - 'project_id'=>'required',  
1032 - ],[ 1073 + 'project_id' => 'required',
  1074 + ], [
1033 'project_id.required' => '项目id不能为空', 1075 'project_id.required' => '项目id不能为空',
1034 ]); 1076 ]);
1035 $logic->saveInquiryFilterConfig($this->param); 1077 $logic->saveInquiryFilterConfig($this->param);
@@ -1041,10 +1083,11 @@ class ProjectController extends BaseController @@ -1041,10 +1083,11 @@ class ProjectController extends BaseController
1041 * @author zbj 1083 * @author zbj
1042 * @date 2024/3/29 1084 * @date 2024/3/29
1043 */ 1085 */
1044 - public function saveWebTrafficConfig(ProjectLogic $logic){ 1086 + public function saveWebTrafficConfig(ProjectLogic $logic)
  1087 + {
1045 $this->request->validate([ 1088 $this->request->validate([
1046 - 'project_id'=>'required',  
1047 - ],[ 1089 + 'project_id' => 'required',
  1090 + ], [
1048 'project_id.required' => '项目id不能为空', 1091 'project_id.required' => '项目id不能为空',
1049 ]); 1092 ]);
1050 $logic->saveWebTrafficConfig($this->param); 1093 $logic->saveWebTrafficConfig($this->param);
@@ -1058,28 +1101,29 @@ class ProjectController extends BaseController @@ -1058,28 +1101,29 @@ class ProjectController extends BaseController
1058 * @method :post 1101 * @method :post
1059 * @time :2024/4/7 10:41 1102 * @time :2024/4/7 10:41
1060 */ 1103 */
1061 - public function updateProjectManager(ProjectLogic $logic){ 1104 + public function updateProjectManager(ProjectLogic $logic)
  1105 + {
1062 $this->request->validate([ 1106 $this->request->validate([
1063 - 'old_id'=>'required',  
1064 - 'new_id'=>'required'  
1065 - ],[ 1107 + 'old_id' => 'required',
  1108 + 'new_id' => 'required'
  1109 + ], [
1066 'old_id.required' => '参数不能为空', 1110 'old_id.required' => '参数不能为空',
1067 'new_id.required' => '参数不能为空', 1111 'new_id.required' => '参数不能为空',
1068 ]); 1112 ]);
1069 //查看当前用户是否存在 1113 //查看当前用户是否存在
1070 $hrModel = new ManageHr(); 1114 $hrModel = new ManageHr();
1071 - $oldHrInfo = $hrModel->read(['id'=>$this->param['old_id']]);  
1072 - if($oldHrInfo === false){  
1073 - $this->response('当前用户不存在',Code::SYSTEM_ERROR); 1115 + $oldHrInfo = $hrModel->read(['id' => $this->param['old_id']]);
  1116 + if ($oldHrInfo === false) {
  1117 + $this->response('当前用户不存在', Code::SYSTEM_ERROR);
1074 } 1118 }
1075 - $newHrInfo = $hrModel->read(['id'=>$this->param['new_id'],'status'=>1]);  
1076 - if($newHrInfo === false){  
1077 - $this->response('变更的用户不存在',Code::SYSTEM_ERROR); 1119 + $newHrInfo = $hrModel->read(['id' => $this->param['new_id'], 'status' => 1]);
  1120 + if ($newHrInfo === false) {
  1121 + $this->response('变更的用户不存在', Code::SYSTEM_ERROR);
1078 } 1122 }
1079 - if($oldHrInfo['entry_position'] != $newHrInfo['entry_position']){  
1080 - $this->response('不同岗位不允许变更',Code::SYSTEM_ERROR); 1123 + if ($oldHrInfo['entry_position'] != $newHrInfo['entry_position']) {
  1124 + $this->response('不同岗位不允许变更', Code::SYSTEM_ERROR);
1081 } 1125 }
1082 - $logic->getManagerFiled($newHrInfo['entry_position'],$this->param['old_id'],$this->param['new_id'],$this->param['project_id'] ?? []); 1126 + $logic->getManagerFiled($newHrInfo['entry_position'], $this->param['old_id'], $this->param['new_id'], $this->param['project_id'] ?? []);
1083 $this->response('success'); 1127 $this->response('success');
1084 } 1128 }
1085 1129
@@ -1090,16 +1134,17 @@ class ProjectController extends BaseController @@ -1090,16 +1134,17 @@ class ProjectController extends BaseController
1090 * @method :post 1134 * @method :post
1091 * @time :2024/6/19 10:07 1135 * @time :2024/6/19 10:07
1092 */ 1136 */
1093 - public function setIsParticiple(){ 1137 + public function setIsParticiple()
  1138 + {
1094 $this->request->validate([ 1139 $this->request->validate([
1095 - 'project_id'=>'required',  
1096 - 'is_participle'=>'required'  
1097 - ],[ 1140 + 'project_id' => 'required',
  1141 + 'is_participle' => 'required'
  1142 + ], [
1098 'project_id.required' => '项目id不能为空', 1143 'project_id.required' => '项目id不能为空',
1099 'is_participle.required' => '项目id不能为空', 1144 'is_participle.required' => '项目id不能为空',
1100 ]); 1145 ]);
1101 $deployBuildModel = new DeployBuild(); 1146 $deployBuildModel = new DeployBuild();
1102 - $deployBuildModel->edit(['is_participle'=>$this->param['is_participle']],['project_id'=>$this->param['project_id']]); 1147 + $deployBuildModel->edit(['is_participle' => $this->param['is_participle']], ['project_id' => $this->param['project_id']]);
1103 $this->response('success'); 1148 $this->response('success');
1104 } 1149 }
1105 1150
@@ -1111,23 +1156,36 @@ class ProjectController extends BaseController @@ -1111,23 +1156,36 @@ class ProjectController extends BaseController
1111 * @method :post 1156 * @method :post
1112 * @time :2024/7/29 17:12 1157 * @time :2024/7/29 17:12
1113 */ 1158 */
1114 - public function saveSiteStatus(){ 1159 + public function saveSiteStatus()
  1160 + {
1115 $projectModel = new Project(); 1161 $projectModel = new Project();
1116 $this->request->validate([ 1162 $this->request->validate([
1117 - 'project_id'=>'required',  
1118 - 'site_status'=>'required'  
1119 - ],[ 1163 + 'project_id' => 'required',
  1164 + 'site_status' => 'required'
  1165 + ], [
1120 'project_id.required' => '项目id不能为空', 1166 'project_id.required' => '项目id不能为空',
1121 'site_status.required' => '状态不能为空', 1167 'site_status.required' => '状态不能为空',
1122 ]); 1168 ]);
1123 - $projectModel->edit(['site_status'=>$this->map['site_status']],['id'=>$this->param['project_id']]); 1169 + $projectModel->edit(['site_status' => $this->map['site_status']], ['id' => $this->param['project_id']]);
1124 //TODO::通知C端 1170 //TODO::通知C端
1125 $domainModel = new DomainInfoModel(); 1171 $domainModel = new DomainInfoModel();
1126 - $domainInfo = $domainModel->read(['project_id'=>$this->param['project_id']]);  
1127 - if($domainInfo !== false){  
1128 - $rs = curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website/');  
1129 - @file_put_contents(storage_path('logs/site_status.log'), var_export('通知C端on/off'.$domainInfo['domain'].'.返回结果:'.json_encode($rs), true) . PHP_EOL, FILE_APPEND); 1172 + $domainInfo = $domainModel->read(['project_id' => $this->param['project_id']]);
  1173 + if ($domainInfo !== false) {
  1174 + $rs = curl_get('https://' . $domainInfo['domain'] . '/api/stop_or_start_website/');
  1175 + @file_put_contents(storage_path('logs/site_status.log'), var_export('通知C端on/off' . $domainInfo['domain'] . '.返回结果:' . json_encode($rs), true) . PHP_EOL, FILE_APPEND);
1130 } 1176 }
1131 $this->response('success'); 1177 $this->response('success');
1132 } 1178 }
  1179 +
  1180 + /**
  1181 + * 获取项目所有行业列表
  1182 + * @author Akun
  1183 + * @date 2025/03/05 11:40
  1184 + */
  1185 + public function industryList()
  1186 + {
  1187 + $model = new ProjectIndustry();
  1188 + $lists = $model->list(['status' => 1], 'id', ['id', 'industry_name'], 'asc');
  1189 + $this->response('success', Code::SUCCESS, $lists);
  1190 + }
1133 } 1191 }
@@ -21,6 +21,7 @@ use App\Models\Com\UpdateLog; @@ -21,6 +21,7 @@ use App\Models\Com\UpdateLog;
21 use App\Models\Devops\Servers; 21 use App\Models\Devops\Servers;
22 use App\Models\Devops\ServersIp; 22 use App\Models\Devops\ServersIp;
23 use App\Models\Domain\DomainInfo; 23 use App\Models\Domain\DomainInfo;
  24 +use App\Models\Industry\ProjectIndustryRelated;
24 use App\Models\Inquiry\InquiryIP; 25 use App\Models\Inquiry\InquiryIP;
25 use App\Models\Inquiry\InquirySet; 26 use App\Models\Inquiry\InquirySet;
26 use App\Models\Manage\Manage; 27 use App\Models\Manage\Manage;
@@ -109,6 +110,8 @@ class ProjectLogic extends BaseLogic @@ -109,6 +110,8 @@ class ProjectLogic extends BaseLogic
109 $info['minor_languages'] = $this->getProjectMinorLanguages($id); 110 $info['minor_languages'] = $this->getProjectMinorLanguages($id);
110 //升级项目采集完成时间 111 //升级项目采集完成时间
111 $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : ''; 112 $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : '';
  113 + //获取项目所属行业
  114 + $info['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray();
112 115
113 return $this->success($info); 116 return $this->success($info);
114 } 117 }
@@ -528,6 +528,10 @@ Route::middleware(['aloginauth'])->group(function () { @@ -528,6 +528,10 @@ Route::middleware(['aloginauth'])->group(function () {
528 Route::any('/', [Aside\Project\AllProjectController::class, 'lists'])->name('admin.all_project_lists'); 528 Route::any('/', [Aside\Project\AllProjectController::class, 'lists'])->name('admin.all_project_lists');
529 }); 529 });
530 530
  531 + //项目行业相关
  532 + Route::prefix('industry')->group(function () {
  533 + Route::any('/', [Aside\Project\ProjectController::class, 'industryList'])->name('admin.industryList');
  534 + });
531 }); 535 });
532 536
533 //无需登录验证的路由组 537 //无需登录验证的路由组