作者 lyh

gx

1 -<?php  
2 -  
3 -namespace App\Http\Controllers\Aside\Optimize;  
4 -  
5 -use App\Enums\Common\Code;  
6 -use App\Http\Controllers\Aside\BaseController;  
7 -use App\Http\Logic\Aside\Optimize\ProcessLogic;  
8 -  
9 -/**  
10 - * @remark :上线审核  
11 - * @class :ProcessController.php  
12 - * @author :lyh  
13 - * @time :2023/7/20 11:05  
14 - */  
15 -class ProcessController extends BaseController  
16 -{  
17 - /**  
18 - * @remark :上线审核列表  
19 - * @name :lists  
20 - * @author :lyh  
21 - * @method :post  
22 - * @time :2023/7/20 11:05  
23 - */  
24 - public function lists(ProcessLogic $processLogic){  
25 - $lists = $processLogic->processList($this->map,$this->page,$this->row,$this->order);  
26 - $this->response('success',Code::SUCCESS,$lists);  
27 - }  
28 -  
29 - /**  
30 - * @remark :审核  
31 - * @name :save  
32 - * @author :lyh  
33 - * @method :post  
34 - * @time :2023/7/20 13:45  
35 - */  
36 - public function save(ProcessLogic $processLogic){  
37 - $this->request->validate([  
38 - 'project_id'=>'required',  
39 - ],[  
40 - 'project_id.required' => '项目ID不能为空',  
41 - ]);  
42 - $processLogic->processSave();  
43 - $this->response('success');  
44 - }  
45 -}  
1 -<?php  
2 -  
3 -namespace App\Http\Logic\Aside\Optimize;  
4 -  
5 -use App\Http\Logic\Aside\BaseLogic;  
6 -use App\Http\Logic\Aside\Manage\ManageLogic;  
7 -use App\Models\Channel\Channel;  
8 -use App\Models\Optimize\Process;  
9 -use App\Models\Project\OnlineCheck;  
10 -use App\Models\Project\Project;  
11 -  
12 -/**  
13 - * @remark :  
14 - * @class :ProcessLogic.php  
15 - * @author :lyh  
16 - * @time :2023/7/20 11:07  
17 - */  
18 -class ProcessLogic extends BaseLogic  
19 -{  
20 - public function __construct()  
21 - {  
22 - parent::__construct();  
23 - $this->param = $this->requestAll;  
24 - $this->model = new OnlineCheck();  
25 - }  
26 -  
27 - /**  
28 - * @remark :获取审核列表  
29 - * @name :processList  
30 - * @author :lyh  
31 - * @method :post  
32 - * @time :2023/7/20 13:51  
33 - */  
34 - public function processList($map,$page,$row,$order = 'id',$filed = ['*']){  
35 - $projectModel = new Project();  
36 - $lists = $projectModel->with('deploy_build')  
37 - ->with('deploy_optimize')->with('payment')->with('online_check')  
38 - ->select($filed)->orderBy($order,'desc')->where($map)  
39 - ->paginate($row, ['*'], 'page', $page);  
40 - //数据处理  
41 - if(!empty($lists)){  
42 - $lists = $lists->toArray();  
43 - foreach ($lists['list'] as $k => $v){  
44 - $item = $this->paramHandle($v);  
45 - $lists['list'][$k] = $item;  
46 - }  
47 - }  
48 - return $this->success($lists);  
49 - }  
50 -  
51 - /**  
52 - * @remark :参数处理  
53 - * @name :paramHandle  
54 - * @author :lyh  
55 - * @method :post  
56 - * @time :2023/7/20 14:29  
57 - */  
58 - public function paramHandle($item){  
59 - $items = [  
60 - 'id' => $item['id'],  
61 - 'title' => $item['title'],  
62 - 'channel' => Channel::getChannelText($item['channel']['user_id'] ?? 0),  
63 - 'key' => $item['deploy_build']['keyword_num'] ?? 0,  
64 - 'day' => $item['deploy_build']['service_duration'] ?? 0,  
65 - 'amount' => $item['payment']['amount'] ?? 0,  
66 - 'build_leader' => ManageLogic::getCacheName($item['deploy_build']['leader_mid'] ?? 0), //组长  
67 - 'build_manager' => ManageLogic::getCacheName($item['deploy_build']['manager_mid'] ?? 0), //项目经理  
68 - 'build_designer' => ManageLogic::getCacheName($item['deploy_build']['designer_mid'] ?? 0), //设计师  
69 - 'build_tech' => ManageLogic::getCacheName($item['deploy_build']['tech_mid'] ?? 0), //技术助理  
70 - 'optimize_manager' => ManageLogic::getCacheName($item['deploy_optimize']['manager_mid'] ?? 0), //优化服务经理  
71 - 'optimize_optimist' => ManageLogic::getCacheName($item['deploy_optimize']['optimist_mid'] ?? 0), //优化师  
72 - 'optimize_assist' => ManageLogic::getCacheName($item['deploy_optimize']['assist_mid'] ?? 0), //优化助理  
73 - 'optimize_tech' => ManageLogic::getCacheName($item['deploy_optimize']['tech_mid'] ?? 0), //售后技术  
74 - 'type' => Project::typeMap()[$item['type']] ?? '',  
75 - 'test_domain' => $item['deploy_build']['test_domain'] ?? 0,  
76 - 'domain' => $item['deploy_optimize']['domain'] ?? 0,  
77 - 'created_at' => date('Y年m月d日', strtotime($item['created_at'])),  
78 - 'optimist_status'=>$item['process']['optimist_status'] ?? 0,  
79 - 'qa_status'=>$item['process']['qa_status'] ?? 0,  
80 - 'status'=>$item['process']['status'] ?? 0,  
81 - ];  
82 - return $items;  
83 - }  
84 -  
85 - /**  
86 - * @remark :优化审核  
87 - * @name :processSave  
88 - * @author :lyh  
89 - * @method :post  
90 - * @time :2023/7/20 15:22  
91 - */  
92 - public function processSave(){  
93 - //优化师审核状态  
94 - if(isset($this->param['optimist_status']) && $this->param['optimist_mid'] == $this->manage['id']){  
95 - $this->param['optimist_check_time'] = date('Y-m-d H:i:s');  
96 - $this->fail('当前登录用户无权限');  
97 - }  
98 - //品控审核状态  
99 - if(isset($this->param['qa_status']) && $this->param['qa_mid'] == $this->manage['id']){  
100 - $this->param['qa_check_time'] = date('Y-m-d H:i:s');  
101 - $this->fail('当前登录用户无权限');  
102 - }  
103 - $rs = $this->model->edit($this->param,['project_id'=>$this->param['project_id']]);  
104 - if($rs === false){  
105 - $this->fail('error');  
106 - }  
107 - return $this->success();  
108 - }  
109 -}