作者 刘锟

update

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