作者 Your Name

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -2,14 +2,20 @@ @@ -2,14 +2,20 @@
2 2
3 namespace App\Console\Commands; 3 namespace App\Console\Commands;
4 4
  5 +use App\Helper\Arr;
5 use App\Helper\OaGlobalsoApi; 6 use App\Helper\OaGlobalsoApi;
6 -use App\Http\Logic\Aside\Project\ProjectLogic;  
7 use App\Models\Channel\Channel; 7 use App\Models\Channel\Channel;
8 use App\Models\Com\NoticeLog; 8 use App\Models\Com\NoticeLog;
  9 +use App\Models\Project\After;
  10 +use App\Models\Project\DeployBuild;
  11 +use App\Models\Project\DeployOptimize;
  12 +use App\Models\Project\Payment;
9 use App\Models\Project\Project; 13 use App\Models\Project\Project;
10 use App\Models\Project\ProjectRenew; 14 use App\Models\Project\ProjectRenew;
11 use App\Utils\LogUtils; 15 use App\Utils\LogUtils;
  16 +use Hashids\Hashids;
12 use Illuminate\Console\Command; 17 use Illuminate\Console\Command;
  18 +use Illuminate\Support\Facades\DB;
13 19
14 /** 20 /**
15 * 同步项目信息 21 * 同步项目信息
@@ -59,7 +65,7 @@ class SyncProject extends Command @@ -59,7 +65,7 @@ class SyncProject extends Command
59 $this->retry($item); 65 $this->retry($item);
60 } 66 }
61 if($data['data']['order_type'] == '首次'){ 67 if($data['data']['order_type'] == '首次'){
62 - ProjectLogic::instance()->sync($data['data']); 68 + $this->sync($data['data']);
63 } 69 }
64 if($data['data']['order_type'] == '续费'){ 70 if($data['data']['order_type'] == '续费'){
65 $this->renewSync($data['data']); 71 $this->renewSync($data['data']);
@@ -110,7 +116,6 @@ class SyncProject extends Command @@ -110,7 +116,6 @@ class SyncProject extends Command
110 'contract' => json_encode($param['files']), 116 'contract' => json_encode($param['files']),
111 'bill' => json_encode($param['images']), 117 'bill' => json_encode($param['images']),
112 ]; 118 ];
113 -// @file_put_contents(storage_path('logs/lyh_error.log'), var_export($data, true) . PHP_EOL, FILE_APPEND);  
114 $renewModel = new ProjectRenew(); 119 $renewModel = new ProjectRenew();
115 $rs = $renewModel->add($data); 120 $rs = $renewModel->add($data);
116 if($rs === false){ 121 if($rs === false){
@@ -135,4 +140,172 @@ class SyncProject extends Command @@ -135,4 +140,172 @@ class SyncProject extends Command
135 return 1; 140 return 1;
136 } 141 }
137 } 142 }
  143 +
  144 + /**
  145 + * @remark :导入数据
  146 + * @name :sync
  147 + * @author :lyh
  148 + * @method :post
  149 + * @time :2023/8/9 15:04
  150 + */
  151 + public function sync($param){
  152 + $title = date('Ymd') . '-' . $param['company_name'];
  153 + $data = [
  154 + 'project'=>[
  155 + 'title' => $title,
  156 + 'company' => $param['company_name'],
  157 + 'lead_name' => $param['principal_name'],
  158 + 'mobile' => $param['principal_mobile'],
  159 + 'mysql_id'=>Project::MYSQL_ID,
  160 + 'qq' => $param['customer_qq'],
  161 + 'channel' => Channel::getProjectChannel($param['company_id'], $param['username_sales']),
  162 + 'requirement' => $param['remark'],
  163 + 'cooperate_date' => date('Y-m-d', $param['create_time']),
  164 + ],
  165 + 'deploy_build' => [
  166 + 'service_duration' => $param['years'],
  167 + 'plan' => $this->versionData($param['plan_marketing']),
  168 + 'login_mobile'=>$param['principal_mobile']
  169 + ],
  170 + 'deploy_optimize' => [
  171 + 'api_no' => $param['id']
  172 + ],
  173 + 'project_after' => [],
  174 + 'payment' => [
  175 + 'amount' => $param['plan_price'],
  176 + 'contract' => $param['files'],
  177 + 'bill' => $param['images'],
  178 + ],
  179 + ];
  180 + DB::beginTransaction();
  181 + try {
  182 + $id = $this->saveProject($data['project']);
  183 + $this->setPostId($data['deploy_build']['plan'],$id);
  184 + $this->savePayment($data['payment'],$id);
  185 + $this->saveDeployBuild($data['deploy_build'],$id);
  186 + $this->saveDeployOptimize($data['deploy_optimize'],$id);
  187 + $this->saveAfter($data['project_after'],$id);
  188 + DB::commit();
  189 + }catch (\Exception $e){
  190 + DB::rollBack();
  191 + errorLog('项目同步失败', $data, $e);
  192 + $this->fail('同步失败');
  193 + }
  194 + }
  195 +
  196 + /**
  197 + * @remark :设置post_id
  198 + * @name :setPostId
  199 + * @author :lyh
  200 + * @method :post
  201 + * @time :2023/8/9 14:47
  202 + */
  203 + public function setPostId($plan,$id){
  204 + $length = strlen((string)$id); // 获取变量的位数
  205 + $paddingLength = Project::TYPE_FIVE - $length; // 计算填充前面的 0 的位数
  206 + $zeros = str_repeat("0", $paddingLength);
  207 + $number = Project::TYPE_SIX.$plan.$zeros.$id;
  208 + $projectModel = new Project();
  209 + $projectModel->edit(['post_id'=>$number],['id'=>$id]);
  210 + return true;
  211 + }
  212 +
  213 + /**
  214 + * @remark :保存项目
  215 + * @name :saveProject
  216 + * @author :lyh
  217 + * @method :post
  218 + * @time :2023/8/30 15:53
  219 + */
  220 + public function saveProject($param){
  221 + if(isset($param['level']) && !empty($param['level'])){
  222 + $param['level'] = Arr::arrToSet($param['level']);
  223 + }
  224 + if(isset($param['channel']) && !empty($param['channel'])){
  225 + $param['channel'] = Arr::a2s($param['channel']);
  226 + }
  227 + if(isset($param['notice_file']) && !empty($param['notice_file'])){
  228 + foreach ($param['notice_file'] as &$v1) {
  229 + $v1['url'] = basename($v1['url']);
  230 + }
  231 + $param['notice_file'] = Arr::a2s($param['notice_file']);
  232 + }
  233 + if(isset($param['confirm_file']) && !empty($param['confirm_file'])){
  234 + foreach ($param['confirm_file'] as &$v2) {
  235 + $v2['url'] = basename($v2['url']);
  236 + }
  237 + $param['confirm_file'] = Arr::a2s($param['confirm_file']);
  238 + }
  239 + $projectModel = new Project();
  240 + return $projectModel->addReturnId($param);
  241 + }
  242 +
  243 + /**
  244 + * 保存优化部署
  245 + * @author zbj
  246 + * @date 2023/4/26
  247 + */
  248 + protected function saveAfter($param,$id){
  249 + $param['project_id'] = $id;
  250 + //查询数据是否存在
  251 + $afterModel = new After();
  252 + return $afterModel->add($param);
  253 + }
  254 +
  255 + /**
  256 + * @remark :保存付款续费
  257 + * @name :savePayment
  258 + * @author :lyh
  259 + * @method :post
  260 + * @time :2023/8/29 16:19
  261 + */
  262 + protected function savePayment($param,$id){
  263 + $param['project_id'] = $id;
  264 + $paymentModel= new Payment();
  265 + if(isset($param['renewal_record']) && !empty($param['renewal_record'])){
  266 + $param['renewal_record'] = Arr::a2s($param['renewal_record']);
  267 + }
  268 + if(isset($param['contract']) && !empty($param['contract'])){
  269 + $param['contract'] = Arr::a2s($param['contract']);
  270 + }
  271 + if(isset($param['bill']) && !empty($param['bill'])){
  272 + $param['bill'] = Arr::a2s($param['bill']);
  273 + }
  274 + return $paymentModel->add($param);
  275 + }
  276 +
  277 + /**
  278 + * @remark :保存建站部署
  279 + * @name :saveDeployBuild
  280 + * @author :lyh
  281 + * @method :post
  282 + * @time :2023/8/29 16:19
  283 + */
  284 + protected function saveDeployBuild($param,$id){
  285 + $param['project_id'] = $id;
  286 + $hashids = new Hashids('test_domain', 5, 'abcdefghjkmnpqrstuvwxyz1234567890');
  287 + $code = $hashids->encode($id);
  288 + $param['test_domain'] = 'https://v6-' . $code . '.globalso.site/';
  289 + $deployBuildModel = new DeployBuild();
  290 + return $deployBuildModel->add($param);
  291 + }
  292 +
  293 + /**
  294 + * @remark :保存优化信息
  295 + * @name :saveDeployOptimize
  296 + * @author :lyh
  297 + * @method :post
  298 + * @time :2023/8/30 16:11
  299 + */
  300 + protected function saveDeployOptimize($param,$id){
  301 + $param['project_id'] = $id;
  302 + if(isset($param['minor_languages']) && !empty($param['minor_languages'])){
  303 + $param['minor_languages'] = Arr::a2s($param['minor_languages']);
  304 + }
  305 + if(isset($param['minor_keywords']) && !empty($param['minor_keywords'])){
  306 + $param['minor_keywords'] = Arr::a2s($param['minor_keywords']);
  307 + }
  308 + $deployOptimizeModel = new DeployOptimize();
  309 + return $deployOptimizeModel->add($param);
  310 + }
138 } 311 }
@@ -95,7 +95,7 @@ class BaseController extends Controller @@ -95,7 +95,7 @@ class BaseController extends Controller
95 $this->map['updated_at'] = ['between', $this->_btw]; 95 $this->map['updated_at'] = ['between', $this->_btw];
96 break; 96 break;
97 default: 97 default:
98 - if (!empty($v) && ($v != null)) { 98 + if ($v != null) {
99 $this->map[$k] = $v; 99 $this->map[$k] = $v;
100 } 100 }
101 break; 101 break;
@@ -4,23 +4,29 @@ namespace App\Http\Controllers\Aside\Project; @@ -4,23 +4,29 @@ namespace App\Http\Controllers\Aside\Project;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Http\Controllers\Aside\BaseController; 6 use App\Http\Controllers\Aside\BaseController;
  7 +use App\Http\Logic\Aside\Manage\ManageLogic;
7 use App\Http\Logic\Aside\Project\OnlineCheckLogic; 8 use App\Http\Logic\Aside\Project\OnlineCheckLogic;
8 use App\Http\Logic\Aside\Project\ProcessRecordsLogic; 9 use App\Http\Logic\Aside\Project\ProcessRecordsLogic;
9 use App\Http\Logic\Aside\Project\ProjectLogic; 10 use App\Http\Logic\Aside\Project\ProjectLogic;
10 use App\Http\Requests\Aside\Project\ProcessRecordsRequest; 11 use App\Http\Requests\Aside\Project\ProcessRecordsRequest;
11 use App\Http\Requests\Aside\Project\ProjectRequest; 12 use App\Http\Requests\Aside\Project\ProjectRequest;
12 use App\Models\ASide\APublicModel; 13 use App\Models\ASide\APublicModel;
  14 +use App\Models\Channel\Channel;
13 use App\Models\Com\City; 15 use App\Models\Com\City;
14 use App\Models\Devops\ServerConfig; 16 use App\Models\Devops\ServerConfig;
15 use App\Models\Domain\DomainInfo; 17 use App\Models\Domain\DomainInfo;
16 use App\Models\Inquiry\InquirySet; 18 use App\Models\Inquiry\InquirySet;
17 use App\Models\Manage\BelongingGroup; 19 use App\Models\Manage\BelongingGroup;
  20 +use App\Models\Manage\Manage;
18 use App\Models\Manage\ManageHr; 21 use App\Models\Manage\ManageHr;
19 use App\Models\Project\DeployBuild; 22 use App\Models\Project\DeployBuild;
20 use App\Models\Project\DeployOptimize; 23 use App\Models\Project\DeployOptimize;
21 use App\Models\Project\Payment; 24 use App\Models\Project\Payment;
22 use App\Models\Project\Project; 25 use App\Models\Project\Project;
  26 +use App\Models\RankData\RankData;
  27 +use App\Models\Task\Task;
23 use Illuminate\Http\Request; 28 use Illuminate\Http\Request;
  29 +use Illuminate\Support\Facades\DB;
24 30
25 31
26 /** 32 /**
@@ -33,49 +39,6 @@ use Illuminate\Http\Request; @@ -33,49 +39,6 @@ use Illuminate\Http\Request;
33 class ProjectController extends BaseController 39 class ProjectController extends BaseController
34 { 40 {
35 41
36 - public function list(ProjectLogic $logic)  
37 - {  
38 - $map = [];  
39 - //搜索类型  
40 - if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_THREE){  
41 - $map[] = ['type', 'in' ,[Project::TYPE_FOUR,Project::TYPE_SIX]];  
42 - }  
43 - if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_TWO){  
44 - $map[] = ['type', 'in', [Project::TYPE_TWO,Project::TYPE_THREE]];  
45 - }  
46 - if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_ONE){  
47 - $map[] = ['type','in',[Project::TYPE_ONE]];  
48 - }  
49 - if(isset($this->param['type']) && $this->param['type'] == Project::TYPE_ZERO){  
50 - $map[] = ['type','in',[Project::TYPE_ZERO]];  
51 - }  
52 - //搜索技术组  
53 - if(!empty($this->param['dep_id'])){  
54 - $map[] = ['id', 'in', DeployBuild::where('dept_id', $this->param['dep_id'])->pluck('project_id')->toArray()];  
55 - }  
56 - //搜索技术人员  
57 - if(!empty($this->param['manage_id'])){  
58 - $map[] = ['id', 'in', DeployBuild::where('leader_mid', $this->param['manage_id'])  
59 - ->orwhere('manager_mid', $this->param['manage_id'])  
60 - ->orwhere('designer_mid', $this->param['manage_id'])  
61 - ->orwhere('tech_mid', $this->param['manage_id'])  
62 - ->pluck('project_id')  
63 - ->toArray()];  
64 - }  
65 - //按类型搜索  
66 - if(!empty($this->param['search']) && !empty($this->param['search_type'])){  
67 - if($this->param['search_type'] == 'domain'){  
68 - //搜索域名  
69 - $map[] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$this->param['search']}%")->pluck('project_id')->toArray()];  
70 - }else{  
71 - $map[] = [$this->param['search_type'], 'like', "%{$this->param['search']}%"];  
72 - }  
73 - }  
74 - $sort = ['id' => 'desc'];  
75 - $data = $logic->getList($map, $sort,['*'],$this->row);  
76 - $this->response('success',Code::SUCCESS,$data);  
77 - }  
78 -  
79 /** 42 /**
80 * @remark :项目列表 43 * @remark :项目列表
81 * @name :lists 44 * @name :lists
@@ -85,13 +48,87 @@ class ProjectController extends BaseController @@ -85,13 +48,87 @@ class ProjectController extends BaseController
85 */ 48 */
86 public function lists(Project $project){ 49 public function lists(Project $project){
87 $map = []; 50 $map = [];
  51 + //搜索参数处理
  52 + $map = $this->searchParam($map,$this->map);
88 //类型 53 //类型
89 if(isset($this->map['type'])){ 54 if(isset($this->map['type'])){
90 $map['type'] = $this->searchType($this->map['type']); 55 $map['type'] = $this->searchType($this->map['type']);
  56 + $map['extend_type'] = 0;//排除未续费项目
91 } 57 }
92 - //搜索参数处理  
93 - $map = $this->searchParam($map,$this->map);  
94 - $project->formatQuery($map)->with()->paginate($this->row, ['*'], 'page', $this->page); 58 + $filed = ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'];
  59 + $lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build')
  60 + ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page);
  61 + if(!empty($lists)){
  62 + $lists = $lists->toArray();
  63 + foreach ($lists['list'] as $k=>$item){
  64 + $item = $this->handleParam($item);
  65 + $lists['list'][$k] = $item;
  66 + }
  67 + }
  68 + $this->response('success',Code::SUCCESS,$lists);
  69 + }
  70 +
  71 + /**
  72 + * @remark :返回参数过滤
  73 + * @name :returnParamItem
  74 + * @author :lyh
  75 + * @method :post
  76 + * @time :2023/8/30 11:07
  77 + */
  78 + public function handleParam(&$item){
  79 + $manageModel = new Manage();
  80 + if($item['mysql_id'] != 0 && $item['type'] != 0){
  81 + $data = APublicModel::getNumByProjectId($item['id']);
  82 + }
  83 + $item = [
  84 + 'id' => $item['id'],
  85 + 'title' => $item['title'],
  86 + 'channel' => Channel::getChannelText($item['channel']['user_id'] ?? 0),
  87 + 'key' => $item['deploy_build']['keyword_num'] ?? 0,
  88 + 'day' => $item['deploy_build']['service_duration'] ?? 0,
  89 + 'amount' => $item['payment']['amount'] ?? 0,
  90 + 'build_leader' => $manageModel->getName($item['deploy_build']['leader_mid']), //组长
  91 + 'build_manager' => $manageModel->getName($item['deploy_build']['manager_mid']), //项目经理
  92 + 'build_designer' => $manageModel->getName($item['deploy_build']['designer_mid']), //设计师
  93 + 'build_tech' => $manageModel->getName($item['deploy_build']['tech_mid']), //技术助理
  94 + 'optimize_manager' => $manageModel->getName($item['deploy_optimize']['manager_mid']), //优化服务经理
  95 + 'optimize_optimist' => $manageModel->getName($item['deploy_optimize']['optimist_mid']), //优化师
  96 + 'optimize_assist' => $manageModel->getName($item['deploy_optimize']['assist_mid']), //优化助理
  97 + 'optimize_tech' => $manageModel->getName($item['deploy_optimize']['tech_mid']), //售后技术
  98 + 'type' => $item['type'],
  99 + 'test_domain' => $item['deploy_build']['test_domain'] ?? 0,
  100 + 'plan' =>Project::planMap()[$item['deploy_build']['plan']],
  101 + 'domain' => $item['deploy_optimize']['domain'] ?? 0,
  102 + 'created_at' => date('Y年m月d日', strtotime($item['created_at'])),
  103 + 'product_num' => $data['product'] ?? 0,
  104 + 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0,
  105 + 'article_num' => ($data['blog'] ?? 0) + ($data['news'] ?? 0),
  106 + 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN),
  107 + 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]),
  108 + 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0,
  109 + 'qa_status'=>$item['online_check']['qa_status'] ?? 0,
  110 + 'service_day'=>$item['deploy_build']['service_duration'] - $this->compliance_day($item['id']),
  111 + ];
  112 + return $item;
  113 + }
  114 +
  115 + /**
  116 + * @param $yesterday
  117 + * @name :(服务达标天数)compliance_day
  118 + * @author :lyh
  119 + * @method :post
  120 + * @time :2023/6/14 15:48
  121 + */
  122 + public function compliance_day($project_id){
  123 + //服务达标天数
  124 + $rankDataModel = new RankData();
  125 + $rank_info = $rankDataModel->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first();
  126 + if(empty($rank_info)){
  127 + $compliance_day = 0;
  128 + }else{
  129 + $compliance_day = $rank_info->compliance_day;
  130 + }
  131 + return $compliance_day;
95 } 132 }
96 133
97 /** 134 /**
@@ -130,17 +167,13 @@ class ProjectController extends BaseController @@ -130,17 +167,13 @@ class ProjectController extends BaseController
130 public function searchParam(&$map,$param){ 167 public function searchParam(&$map,$param){
131 //搜索技术组 168 //搜索技术组
132 if(!empty($param['dep_id'])){ 169 if(!empty($param['dep_id'])){
133 - $map['id'] = ['in', DeployBuild::where('dept_id', $this->param['dep_id'])->pluck('project_id')->toArray()]; 170 + $map['id'] = ['in', DeployBuild::where('dept_id', $param['dep_id'])->pluck('project_id')->toArray()];
134 } 171 }
135 //搜索技术人员 172 //搜索技术人员
136 if(!empty($param['manage_id'])){ 173 if(!empty($param['manage_id'])){
137 - $map['id'] = ['in', DeployBuild::where('leader_mid', $this->param['manage_id'])  
138 - ->orwhere('manager_mid', $this->param['manage_id'])  
139 - ->orwhere('designer_mid', $this->param['manage_id'])  
140 - ->orwhere('tech_mid', $this->param['manage_id'])  
141 - ->pluck('project_id')  
142 - ->toArray()];  
143 - 174 + $map['id'] = ['in', DeployBuild::where('leader_mid', $param['manage_id'])
  175 + ->orwhere('manager_mid', $param['manage_id'])->orwhere('designer_mid', $param['manage_id'])
  176 + ->orwhere('tech_mid', $param['manage_id'])->pluck('project_id')->toArray()];
144 } 177 }
145 //按类型搜索 178 //按类型搜索
146 if(!empty($param['search']) && !empty($param['search_type'])){ 179 if(!empty($param['search']) && !empty($param['search_type'])){
@@ -181,7 +214,7 @@ class ProjectController extends BaseController @@ -181,7 +214,7 @@ class ProjectController extends BaseController
181 public function save(ProjectRequest $request, ProjectLogic $logic) 214 public function save(ProjectRequest $request, ProjectLogic $logic)
182 { 215 {
183 $request->validated(); 216 $request->validated();
184 - $logic->save($this->param); 217 + $logic->projectSave();
185 $this->response('success'); 218 $this->response('success');
186 } 219 }
187 220
@@ -18,6 +18,7 @@ use App\Models\ASide\APublicModel; @@ -18,6 +18,7 @@ use App\Models\ASide\APublicModel;
18 use App\Models\Channel\Channel; 18 use App\Models\Channel\Channel;
19 use App\Models\HomeCount\Count; 19 use App\Models\HomeCount\Count;
20 use App\Models\Manage\Manage; 20 use App\Models\Manage\Manage;
  21 +use App\Models\Project\DeployBuild;
21 use App\Models\Project\DeployOptimize; 22 use App\Models\Project\DeployOptimize;
22 use App\Models\Project\Project; 23 use App\Models\Project\Project;
23 use App\Models\Task\Task; 24 use App\Models\Task\Task;
@@ -32,27 +33,63 @@ class RenewProjectController extends BaseController @@ -32,27 +33,63 @@ class RenewProjectController extends BaseController
32 * @method :post 33 * @method :post
33 * @time :2023/8/11 10:22 34 * @time :2023/8/11 10:22
34 */ 35 */
35 - public function lists(ProjectLogic $logic){ 36 + public function lists(Project $project){
  37 + $arr = $this->getLessThanFifteenProjectId();
  38 + $map = [];
  39 + $this->searchParam($map,$this->map,$arr);
  40 + //按类型搜索
  41 + $map['id'] = ['in', $arr];
  42 + $filed = ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'];
  43 + $lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build')
  44 + ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page);
  45 + if(!empty($lists)){
  46 + $lists = $lists->toArray();
  47 + foreach ($lists['list'] as $k=>$item){
  48 + $item = $this->handleParam($item);
  49 + $lists['list'][$k] = $item;
  50 + }
  51 + }
  52 + $this->response('success',Code::SUCCESS,$lists);
  53 + }
  54 +
  55 + /**
  56 + * @remark :获取小于15天的项目id
  57 + * @name :getlessThanFifteenProjectId
  58 + * @author :lyh
  59 + * @method :post
  60 + * @time :2023/8/30 11:49
  61 + */
  62 + public function getLessThanFifteenProjectId(){
36 $count = new Count(); 63 $count = new Count();
37 $yesterday = Carbon::yesterday()->toDateString(); 64 $yesterday = Carbon::yesterday()->toDateString();
38 $count_list = $count->list(['date'=>$yesterday,'service_day'=>['<=',15]],'id',['project_id']); 65 $count_list = $count->list(['date'=>$yesterday,'service_day'=>['<=',15]],'id',['project_id']);
39 $arr = []; 66 $arr = [];
40 - foreach ($count_list as $v){  
41 - $arr[] = $v['project_id']; 67 + if(!empty($count_list)){
  68 + foreach ($count_list as $v){
  69 + $arr[] = $v['project_id'];
  70 + }
42 } 71 }
43 - $sort = ['id' => 'desc']; 72 + return $arr;
  73 + }
  74 +
  75 + /**
  76 + * @remark :搜索参数处理
  77 + * @name :searchParam
  78 + * @author :lyh
  79 + * @method :post
  80 + * @time :2023/8/30 10:30
  81 + */
  82 + public function searchParam(&$map,$param,&$arr){
44 //按类型搜索 83 //按类型搜索
45 - $map[] = ['id', 'in', $arr];  
46 - if(!empty($this->param['search']) && !empty($this->param['search_type'])){ 84 + if(!empty($param['search']) && !empty($param['search_type'])){
47 if($this->param['search_type'] == 'domain'){ 85 if($this->param['search_type'] == 'domain'){
48 //搜索域名 86 //搜索域名
49 - $map[] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$this->param['search']}%")->where('id','in',$arr)->pluck('project_id')->toArray()]; 87 + $map['id'] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$param['search']}%")->where('id','in',$arr)->pluck('project_id')->toArray()];
50 }else{ 88 }else{
51 - $map[] = [$this->param['search_type'], 'like', "%{$this->param['search']}%"]; 89 + $map[$this->param['search_type']] = ['like', "%{$this->param['search']}%"];
52 } 90 }
53 } 91 }
54 - $data = $logic->getList($map, $sort,['*'],$this->row);  
55 - $this->response('success',Code::SUCCESS,$data); 92 + return $map;
56 } 93 }
57 94
58 /** 95 /**
@@ -95,7 +132,7 @@ class RenewProjectController extends BaseController @@ -95,7 +132,7 @@ class RenewProjectController extends BaseController
95 * @time :2023/8/18 14:33 132 * @time :2023/8/18 14:33
96 */ 133 */
97 public function notHaveRenewItems(Project $project){ 134 public function notHaveRenewItems(Project $project){
98 - $this->map['type'] = $project::TYPE_FIVE;//未续费网站 135 + $this->map['extend_type'] = $project::TYPE_FIVE;//未续费网站
99 $lists = $project->where($this->map)->with('payment')->with('deploy_build') 136 $lists = $project->where($this->map)->with('payment')->with('deploy_build')
100 ->with('deploy_optimize')->with('online_check') 137 ->with('deploy_optimize')->with('online_check')
101 ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page); 138 ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page);
@@ -98,6 +98,13 @@ class ProjectUserController extends BaseController @@ -98,6 +98,13 @@ class ProjectUserController extends BaseController
98 */ 98 */
99 public function save(UserRequest $request,UserLogic $userLogic){ 99 public function save(UserRequest $request,UserLogic $userLogic){
100 $request->validated(); 100 $request->validated();
  101 + if(!isset($this->param['id'])){
  102 + $this->request->validate([
  103 + 'password'=>'required',
  104 + ],[
  105 + 'password.required' => '密码不能为空',
  106 + ]);
  107 + }
101 $userLogic->projectUserSave(); 108 $userLogic->projectUserSave();
102 $this->response('success'); 109 $this->response('success');
103 } 110 }
@@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside; @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Events\WebSocketMessage; 13 use App\Events\WebSocketMessage;
14 use App\Events\WebSocketMessageSent; 14 use App\Events\WebSocketMessageSent;
  15 +use App\Helper\Arr;
15 use App\Helper\Common; 16 use App\Helper\Common;
16 use App\Helper\Translate; 17 use App\Helper\Translate;
17 use App\Helper\Wechat; 18 use App\Helper\Wechat;
@@ -202,13 +203,5 @@ class LoginController extends BaseController @@ -202,13 +203,5 @@ class LoginController extends BaseController
202 $info = $logic->autologin($data); 203 $info = $logic->autologin($data);
203 $this->response('success',Code::SUCCESS,['info'=>$info]); 204 $this->response('success',Code::SUCCESS,['info'=>$info]);
204 } 205 }
205 -  
206 - public function ceshi(EncryptUtils $encrypt){  
207 - $serviceSettingModel = new Service();  
208 - $info = $serviceSettingModel->read(['type'=>4]);  
209 - $data = $encrypt->unlock_url($this->param['code'], $info['values']);  
210 - $data = json_decode($data, true);  
211 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($data, true) . PHP_EOL, FILE_APPEND);  
212 - $this->response($data);  
213 - } 206 +
214 } 207 }
@@ -2,14 +2,11 @@ @@ -2,14 +2,11 @@
2 2
3 namespace App\Http\Logic\Aside\Project; 3 namespace App\Http\Logic\Aside\Project;
4 4
5 - 5 +use Illuminate\Support\Arr as SupArr;
6 use App\Helper\Arr; 6 use App\Helper\Arr;
7 use App\Helper\Common; 7 use App\Helper\Common;
8 use App\Helper\FormGlobalsoApi; 8 use App\Helper\FormGlobalsoApi;
9 use App\Http\Logic\Aside\BaseLogic; 9 use App\Http\Logic\Aside\BaseLogic;
10 -use App\Http\Logic\Aside\Manage\ManageLogic;  
11 -use App\Models\ASide\APublicModel;  
12 -use App\Models\Blog\Blog;  
13 use App\Models\Channel\Channel; 10 use App\Models\Channel\Channel;
14 use App\Models\Channel\User; 11 use App\Models\Channel\User;
15 use App\Models\Channel\Zone; 12 use App\Models\Channel\Zone;
@@ -38,70 +35,10 @@ class ProjectLogic extends BaseLogic @@ -38,70 +35,10 @@ class ProjectLogic extends BaseLogic
38 public function __construct() 35 public function __construct()
39 { 36 {
40 parent::__construct(); 37 parent::__construct();
  38 + $this->param = $this->requestAll;
41 $this->model = new Project(); 39 $this->model = new Project();
42 } 40 }
43 41
44 - public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20)  
45 - {  
46 -  
47 - parent::setWith(['payment', 'deploy_build', 'deploy_optimize','online_check']);  
48 - $list = parent::getList($map, $sort, ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'], $limit);  
49 - $managerLogic = new ManageLogic();  
50 - foreach ($list['list'] as &$item){  
51 - if($item['mysql_id'] != 0){  
52 - $data = APublicModel::getNumByProjectId($item['id']);  
53 - }  
54 - $item = [  
55 - 'id' => $item['id'],  
56 - 'title' => $item['title'],  
57 - 'channel' => Channel::getChannelText($item['channel']['user_id'] ?? 0),  
58 - 'key' => $item['deploy_build']['keyword_num'] ?? 0,  
59 - 'day' => $item['deploy_build']['service_duration'] ?? 0,  
60 - 'amount' => $item['payment']['amount'] ?? 0,  
61 - 'build_leader' => $managerLogic->getCacheName($item['deploy_build']['leader_mid'] ?? 0), //组长  
62 - 'build_manager' => $managerLogic->getCacheName($item['deploy_build']['manager_mid'] ?? 0), //项目经理  
63 - 'build_designer' => $managerLogic->getCacheName($item['deploy_build']['designer_mid'] ?? 0), //设计师  
64 - 'build_tech' => $managerLogic->getCacheName($item['deploy_build']['tech_mid'] ?? 0), //技术助理  
65 - 'optimize_manager' => $managerLogic->getCacheName($item['deploy_optimize']['manager_mid'] ?? 0), //优化服务经理  
66 - 'optimize_optimist' => $managerLogic->getCacheName($item['deploy_optimize']['optimist_mid'] ?? 0), //优化师  
67 - 'optimize_assist' => $managerLogic->getCacheName($item['deploy_optimize']['assist_mid'] ?? 0), //优化助理  
68 - 'optimize_tech' => $managerLogic->getCacheName($item['deploy_optimize']['tech_mid'] ?? 0), //售后技术  
69 - 'type' => $item['type'],  
70 - 'test_domain' => $item['deploy_build']['test_domain'] ?? 0,  
71 - 'plan' =>Project::planMap()[$item['deploy_build']['plan']],  
72 - 'domain' => $item['deploy_optimize']['domain'] ?? 0,  
73 - 'created_at' => date('Y年m月d日', strtotime($item['created_at'])),  
74 - 'product_num' => $data['product'] ?? 0,  
75 - 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0,  
76 - 'article_num' => ($data['blog'] ?? 0) + ($data['news'] ?? 0),  
77 - 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN),  
78 - 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]),  
79 - 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0,  
80 - 'qa_status'=>$item['online_check']['qa_status'] ?? 0,  
81 - 'service_day'=>$item['deploy_build']['service_duration'] - $this->compliance_day($item['id']),  
82 - ];  
83 - }  
84 - return $list;  
85 - }  
86 -  
87 - /**  
88 - * @param $yesterday  
89 - * @name :(服务达标天数)compliance_day  
90 - * @author :lyh  
91 - * @method :post  
92 - * @time :2023/6/14 15:48  
93 - */  
94 - public function compliance_day($project_id){  
95 - //服务达标天数  
96 - $rank_info = DB::table('gl_rank_data')->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first();  
97 - if(empty($rank_info)){  
98 - $compliance_day = 0;  
99 - }else{  
100 - $compliance_day = $rank_info->compliance_day;  
101 - }  
102 - return $compliance_day;  
103 - }  
104 -  
105 /** 42 /**
106 * @remark :获取当前数据详情 43 * @remark :获取当前数据详情
107 * @name :getProjectInfo 44 * @name :getProjectInfo
@@ -129,50 +66,166 @@ class ProjectLogic extends BaseLogic @@ -129,50 +66,166 @@ class ProjectLogic extends BaseLogic
129 } 66 }
130 67
131 /** 68 /**
132 - * @remark :保存项目配置数据  
133 - * @name :save 69 + * @remark :保存项目数据
  70 + * @name :projectSave
134 * @author :lyh 71 * @author :lyh
135 * @method :post 72 * @method :post
136 - * @time :2023/8/17 14:19 73 + * @time :2023/8/30 11:57
137 */ 74 */
138 - public function save($param){ 75 + public function projectSave(){
139 DB::beginTransaction(); 76 DB::beginTransaction();
140 try { 77 try {
141 - if($param['type'] == Project::TYPE_FIVE){  
142 - $param['extend_type'] == Project::TYPE_FIVE;  
143 - unset($param['type']);  
144 - }  
145 - $res = parent::save($param);  
146 - $param['id'] = $res['id'];  
147 - Common::del_user_cache($this->model->getTable(),$param['id']);  
148 - $this->savePayment($param);  
149 - $this->saveDeployBuild($param);  
150 - $this->saveDeployOptimize($param);  
151 - $this->saveAfter($param);  
152 - //创建默认数据库  
153 - if($param['type'] == Project::TYPE_ONE){  
154 - //初始化数据库  
155 - if(isset($param['mysql_id']) && !empty($param['mysql_id'])){  
156 - $this->initializationMysql($res['id']);  
157 - }  
158 - //初始账号  
159 - if(isset($param['mobile']) && !empty($param['mobile'])){  
160 - $this->createUser($param['mobile'],$res['id'],$param['lead_name']);  
161 - }  
162 - //更改服务器状态  
163 - if(isset($param['serve_id']) && !empty($param['serve_id'])){  
164 - $this->updateServe($param['serve_id']);  
165 - }  
166 - } 78 + $this->createProjectData($this->param);
  79 + //保存项目信息
  80 + $this->saveProject($this->param);
  81 + //保存建站部署信息
  82 + $this->saveProjectDeployBuild($this->param['deploy_build']);
  83 + //保存付费信息
  84 + $this->saveProjectPayment($this->param['payment']);
  85 + //保存优化信息
  86 + $this->saveProjectDeployOptimize($this->param['deploy_optimize']);
  87 + //保存售后信息
  88 + $this->saveProjectAfter($this->param['project_after']);
167 DB::commit(); 89 DB::commit();
168 }catch (\Exception $e){ 90 }catch (\Exception $e){
169 DB::rollBack(); 91 DB::rollBack();
170 - $this->fail('保存失败'); 92 + $this->fail('error');
171 } 93 }
172 return $this->success(); 94 return $this->success();
173 } 95 }
174 96
175 /** 97 /**
  98 + * @remark :保存项目
  99 + * @name :setExtendType
  100 + * @author :lyh
  101 + * @method :post
  102 + * @time :2023/8/30 12:14
  103 + */
  104 + public function saveProject($param){
  105 + if($param['type'] == Project::TYPE_FIVE){
  106 + $param['extend_type'] = Project::TYPE_FIVE;
  107 + unset($param['type']);
  108 + }
  109 + if(isset($param['level']) && !empty($param['level'])){
  110 + $param['level'] = Arr::arrToSet($param['level']);
  111 + }
  112 + if(isset($param['channel']) && !empty($param['channel'])){
  113 + $param['channel'] = Arr::a2s($param['channel']);
  114 + }
  115 + if(isset($param['notice_file']) && !empty($param['notice_file'])){
  116 + foreach ($param['notice_file'] as &$v1) {
  117 + $v1['url'] = basename($v1['url']);
  118 + }
  119 + $param['notice_file'] = Arr::a2s($param['notice_file']);
  120 + }
  121 + if(isset($param['confirm_file']) && !empty($param['confirm_file'])){
  122 + foreach ($param['confirm_file'] as &$v2) {
  123 + $v2['url'] = basename($v2['url']);
  124 + }
  125 + $param['confirm_file'] = Arr::a2s($param['confirm_file']);
  126 + }
  127 + unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'],$param['online_check'],$param['project_after']);
  128 + $this->model->edit($param,['id'=>$param['id']]);
  129 + Common::del_user_cache($this->model->getTable(),$param['id']);
  130 + return $this->success();
  131 + }
  132 +
  133 + /**
  134 + * @remark :保存付款续费
  135 + * @name :savePayment
  136 + * @author :lyh
  137 + * @method :post
  138 + * @time :2023/8/29 16:19
  139 + */
  140 + protected function saveProjectPayment($payment){
  141 + $paymentModel = new Payment();
  142 +// $payment['contract'] = Arr::a2s($payment['contract']);
  143 + if(isset($payment['renewal_record']) && !empty($payment['renewal_record'])){
  144 + $payment['renewal_record'] = Arr::a2s($payment['renewal_record']);
  145 + }
  146 + $paymentModel->edit($payment,['id'=>$payment['id']]);
  147 + return $this->success();
  148 + }
  149 +
  150 + /**
  151 + * @remark :保存建站部署
  152 + * @name :saveDeployBuild
  153 + * @author :lyh
  154 + * @method :post
  155 + * @time :2023/8/29 16:19
  156 + */
  157 + protected function saveProjectDeployBuild($deploy_build){
  158 + $deployBuildModel = new DeployBuild();
  159 + $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]);
  160 + return $this->success();
  161 + }
  162 +
  163 + /**
  164 + * @remark :保存优化部署
  165 + * @name :saveDeployOptimize
  166 + * @author :lyh
  167 + * @method :post
  168 + * @time :2023/8/30 13:45
  169 + */
  170 + protected function saveProjectDeployOptimize($deploy_optimize){
  171 + $deployOptimizeModel = new DeployOptimize();
  172 + if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){
  173 + if (!preg_match('/http/', $deploy_optimize['domain'])) {
  174 + $deploy_optimize['domain'] = 'https://'.trim($deploy_optimize['domain'],'/').'/';
  175 + }
  176 + }
  177 + if(isset($deploy_optimize['minor_languages']) && !empty($deploy_optimize['minor_languages'])){
  178 + $deploy_optimize['minor_languages'] = Arr::a2s($deploy_optimize['minor_languages']);
  179 + }
  180 + if(isset($deploy_optimize['minor_keywords']) && !empty($deploy_optimize['minor_keywords'])){
  181 + $deploy_optimize['minor_keywords'] = Arr::a2s($deploy_optimize['minor_keywords']);
  182 + }
  183 + $deployOptimizeModel->edit($deploy_optimize,['id'=>$deploy_optimize['id']]);
  184 + return $this->success();
  185 + }
  186 +
  187 + /**
  188 + * @remark :保存为售后部署
  189 + * @name :saveProjectAfter
  190 + * @author :lyh
  191 + * @method :post
  192 + * @time :2023/8/30 13:57
  193 + */
  194 + protected function saveProjectAfter($project_after){
  195 + //查询数据是否存在
  196 + $afterModel = new After();
  197 + $afterModel->edit($project_after,['id'=>$project_after['id']]);
  198 + return $this->success();
  199 + }
  200 +
  201 + /**
  202 + * @remark :创建初始数据
  203 + * @name :createProjectData
  204 + * @author :lyh
  205 + * @method :post
  206 + * @time :2023/8/30 14:30
  207 + */
  208 + public function createProjectData($param){
  209 + //创建默认数据库
  210 + if($param['type'] == Project::TYPE_ONE){
  211 + //初始化数据库
  212 + if(isset($param['mysql_id']) && !empty($param['mysql_id'])){
  213 + $this->initializationMysql($param['id']);
  214 + }
  215 + //初始账号
  216 + if(isset($param['mobile']) && !empty($param['mobile'])){
  217 + $this->createUser($param['mobile'],$param['id'],$param['lead_name']);
  218 + }
  219 + //更改服务器状态
  220 + if(isset($param['serve_id']) && !empty($param['serve_id'])){
  221 + $this->updateServe($param['serve_id']);
  222 + }
  223 + }
  224 + return $this->success();
  225 + }
  226 +
  227 +
  228 + /**
176 * @remark :初始化数据库 229 * @remark :初始化数据库
177 * @name :initializationMysql 230 * @name :initializationMysql
178 * @author :lyh 231 * @author :lyh
@@ -202,6 +255,8 @@ class ProjectLogic extends BaseLogic @@ -202,6 +255,8 @@ class ProjectLogic extends BaseLogic
202 return $this->success(); 255 return $this->success();
203 } 256 }
204 257
  258 +
  259 +
205 /** 260 /**
206 * @remark :创建用户 261 * @remark :创建用户
207 * @name :createUser 262 * @name :createUser
@@ -228,82 +283,8 @@ class ProjectLogic extends BaseLogic @@ -228,82 +283,8 @@ class ProjectLogic extends BaseLogic
228 return $this->success(); 283 return $this->success();
229 } 284 }
230 285
231 - /**  
232 - * @remark :保存付款续费  
233 - * @name :savePayment  
234 - * @author :lyh  
235 - * @method :post  
236 - * @time :2023/8/29 16:19  
237 - */  
238 - protected function savePayment($param){  
239 - if(empty($param['payment'])){  
240 - return true;  
241 - }  
242 - $data = $param['payment'];  
243 - $data['project_id'] = $param['id'];  
244 - $data['id'] = Payment::where('project_id', $param['id'])->value('id');  
245 - return (new PaymentLogic)->save($data);  
246 - }  
247 286
248 - /**  
249 - * @remark :保存建站部署  
250 - * @name :saveDeployBuild  
251 - * @author :lyh  
252 - * @method :post  
253 - * @time :2023/8/29 16:19  
254 - */  
255 - protected function saveDeployBuild($param){  
256 - if(empty($param['deploy_build'])){  
257 - return true;  
258 - }  
259 - $data = $param['deploy_build'];  
260 - $data['project_id'] = $param['id'];  
261 - $data['id'] = DeployBuild::where('project_id', $param['id'])->value('id');  
262 - if(empty($data['id'])){  
263 - $hashids = new Hashids('test_domain', 5, 'abcdefghjkmnpqrstuvwxyz1234567890');  
264 - $code = $hashids->encode($data['project_id']);  
265 - $data['test_domain'] = 'https://v6-' . $code . '.globalso.site/';  
266 - }  
267 - return (new DeployBuildLogic)->save($data);  
268 - }  
269 287
270 - /**  
271 - * 保存优化部署  
272 - * @author zbj  
273 - * @date 2023/4/26  
274 - */  
275 - protected function saveDeployOptimize($param){  
276 - if(empty($param['deploy_optimize'])){  
277 - return true;  
278 - }  
279 - $data = $param['deploy_optimize'];  
280 - $data['project_id'] = $param['id'];  
281 - if(isset($data['domain']) && !empty($data['domain'])){  
282 - if (!preg_match('/http/', $data['domain'])) {  
283 - $data['domain'] = 'https://'.trim($data['domain'],'/').'/';  
284 - }  
285 - }  
286 - $data['id'] = DeployOptimize::where('project_id', $param['id'])->value('id');  
287 - return (new DeployOptimizeLogic)->save($data);  
288 - }  
289 - /**  
290 - * 保存优化部署  
291 - * @author zbj  
292 - * @date 2023/4/26  
293 - */  
294 - protected function saveAfter($param){  
295 - $data = $param['project_after'];  
296 - $data['project_id'] = $param['id'];  
297 - //查询数据是否存在  
298 - $afterModel = new After();  
299 - $info = $afterModel->read(['project_id'=>$data['project_id']]);  
300 - if($info === false){  
301 - $rs = $afterModel->add($data);  
302 - }else{  
303 - $rs = $afterModel->edit($data,['id'=>$info['id']]);  
304 - }  
305 - return $rs;  
306 - }  
307 public function clearCache($id) 288 public function clearCache($id)
308 { 289 {
309 parent::clearCache($id); 290 parent::clearCache($id);
@@ -366,89 +347,8 @@ class ProjectLogic extends BaseLogic @@ -366,89 +347,8 @@ class ProjectLogic extends BaseLogic
366 } 347 }
367 348
368 349
369 - /**  
370 - * @remark :导入数据  
371 - * @name :sync  
372 - * @author :lyh  
373 - * @method :post  
374 - * @time :2023/8/9 15:04  
375 - */  
376 - public function sync($param){  
377 - $title = date('Ymd') . '-' . $param['company_name'];  
378 - $data = [  
379 - 'title' => $title,  
380 - 'api_no'=> $param['id'],  
381 - 'company' => $param['company_name'],  
382 - 'lead_name' => $param['principal_name'],  
383 - 'mobile' => $param['principal_mobile'],  
384 - 'mysql_id'=>Project::MYSQL_ID,  
385 - 'qq' => $param['customer_qq'],  
386 - 'channel' => Channel::getProjectChannel($param['company_id'], $param['username_sales']),  
387 - 'requirement' => $param['remark'],  
388 - 'cooperate_date' => date('Y-m-d', $param['create_time']),  
389 - 'deploy_build' => [  
390 - 'service_duration' => $param['years'],  
391 - 'plan' => $this->versionData($param['plan_marketing']),  
392 - 'login_mobile'=>$param['principal_mobile']  
393 - ],  
394 - 'deploy_optimize' => [  
395 - 'api_no' => $param['id']  
396 - ],  
397 - 'project_after' => [],  
398 - 'payment' => [  
399 - 'amount' => $param['plan_price'],  
400 - 'contract' => $param['files'],  
401 - 'bill' => $param['images'],  
402 - ],  
403 - ];  
404 - DB::beginTransaction();  
405 - try {  
406 - $res = parent::save($data);  
407 - $data['id'] = $res['id'];  
408 - $this->setPostId($data['deploy_build']['plan'],$res['id']);  
409 - $this->savePayment($data);  
410 - $this->saveDeployBuild($data);  
411 - $this->saveDeployOptimize($data);  
412 - $this->saveAfter($data);  
413 - DB::commit();  
414 - }catch (\Exception $e){  
415 - DB::rollBack();  
416 - errorLog('项目同步失败', $data, $e);  
417 - $this->fail('同步失败');  
418 - }  
419 - }  
420 350
421 - /**  
422 - * @remark :获取版本  
423 - * @name :versionData  
424 - * @author :lyh  
425 - * @method :post  
426 - * @time :2023/8/9 14:46  
427 - */  
428 - public function versionData($param){  
429 - $data = Project::planMap();  
430 - $data = array_flip($data);  
431 - if(isset($data[$param])){  
432 - return $data[$param];  
433 - }else{  
434 - return 1;  
435 - }  
436 - }  
437 351
438 - /**  
439 - * @remark :设置post_id  
440 - * @name :setPostId  
441 - * @author :lyh  
442 - * @method :post  
443 - * @time :2023/8/9 14:47  
444 - */  
445 - public function setPostId($plan,$id){  
446 - $length = strlen((string)$id); // 获取变量的位数  
447 - $paddingLength = Project::TYPE_FIVE - $length; // 计算填充前面的 0 的位数  
448 - $zeros = str_repeat("0", $paddingLength);  
449 - $number = Project::TYPE_SIX.$plan.$zeros.$id;  
450 - $projectModel = new Project();  
451 - $projectModel->edit(['post_id'=>$number],['id'=>$id]);  
452 - return true;  
453 - } 352 +
  353 +
454 } 354 }
@@ -51,7 +51,7 @@ class CountLogic extends BaseLogic @@ -51,7 +51,7 @@ class CountLogic extends BaseLogic
51 */ 51 */
52 public function scheme_info(){ 52 public function scheme_info(){
53 $data = [ 53 $data = [
54 - 'company'=>$this->project['company'], 54 + 'company'=>$this->project['title'],
55 'scheme'=>Project::planMap()[$this->project['deploy_build']['plan']], 55 'scheme'=>Project::planMap()[$this->project['deploy_build']['plan']],
56 'service_duration'=>$this->project['deploy_build']['service_duration'], 56 'service_duration'=>$this->project['deploy_build']['service_duration'],
57 ]; 57 ];
@@ -25,7 +25,6 @@ class UserRequest extends FormRequest @@ -25,7 +25,6 @@ class UserRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'mobile'=>'required|string|max:11', 27 'mobile'=>'required|string|max:11',
28 - 'password'=>'required|string|min:5',  
29 'project_id'=>'required', 28 'project_id'=>'required',
30 'name'=>'required|max:20', 29 'name'=>'required|max:20',
31 ]; 30 ];
@@ -38,9 +37,6 @@ class UserRequest extends FormRequest @@ -38,9 +37,6 @@ class UserRequest extends FormRequest
38 'project_id.required'=>'所属项目必须填写', 37 'project_id.required'=>'所属项目必须填写',
39 'mobile.string'=>'号码中含有非法文字', 38 'mobile.string'=>'号码中含有非法文字',
40 'mobile.max' => '号码不大于11字符.', 39 'mobile.max' => '号码不大于11字符.',
41 - 'password.required'=>'密码必须填写',  
42 - 'password.string'=>'密码中含有非法文字',  
43 - 'password.min' => '密码不小于5字符.',  
44 'name.required'=>'名称必须填写', 40 'name.required'=>'名称必须填写',
45 'name.min' => '名称不小于5字符.', 41 'name.min' => '名称不小于5字符.',
46 ]; 42 ];
@@ -2,8 +2,6 @@ @@ -2,8 +2,6 @@
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 -use App\Models\File\Image;  
6 -use App\Services\CosService;  
7 use Illuminate\Database\Eloquent\Model; 5 use Illuminate\Database\Eloquent\Model;
8 class Base extends Model 6 class Base extends Model
9 { 7 {
@@ -13,22 +13,6 @@ class DeployBuild extends Base @@ -13,22 +13,6 @@ class DeployBuild extends Base
13 protected $table = 'gl_project_deploy_build'; 13 protected $table = 'gl_project_deploy_build';
14 14
15 15
16 -  
17 - public function setPlanAttribute($value){  
18 - $this->attributes['plan'] = Arr::arrToSet($value, 'trim');  
19 - }  
20 -  
21 - public function getPlanAttribute($value){  
22 - return Arr::setToArr($value, 'trim');  
23 - }  
24 -  
25 -// public function getTestDomainAttribute(): string  
26 -// {  
27 -// $hashids = new Hashids('test_domain', 5, 'abcdefghjkmnpqrstuvwxyz1234567890');  
28 -// $code = $hashids->encode($this->project_id);  
29 -// return 'https://v6-' . $code . '.globalso.site';  
30 -// }  
31 -  
32 public static function clearCache($row){ 16 public static function clearCache($row){
33 $cache_key = 'project_' . $row->original['test_domain']; 17 $cache_key = 'project_' . $row->original['test_domain'];
34 Cache::forget($cache_key); 18 Cache::forget($cache_key);
@@ -136,7 +136,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -136,7 +136,7 @@ Route::middleware(['aloginauth'])->group(function () {
136 136
137 //项目管理 137 //项目管理
138 Route::prefix('project')->group(function () { 138 Route::prefix('project')->group(function () {
139 - Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project'); 139 + Route::get('/', [Aside\Project\ProjectController::class, 'lists'])->name('admin.project');
140 Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info'); 140 Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info');
141 Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); 141 Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save');
142 Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set'); 142 Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set');