作者 zhl

Merge remote-tracking branch 'origin/master' into zhl

@@ -55,7 +55,7 @@ class RemainDay extends Command @@ -55,7 +55,7 @@ class RemainDay extends Command
55 { 55 {
56 $list = Project::whereIn('type', [2,3,4])->get(); 56 $list = Project::whereIn('type', [2,3,4])->get();
57 foreach ($list as $item){ 57 foreach ($list as $item){
58 - if($item['type'] == 3){ 58 + if($item['type'] == Project::TYPE_TWO){
59 //排名达标天数 59 //排名达标天数
60 $compliance_day = GoogleRankModel::where(['project_id' => $item['id'], 'lang' => ''])->value('compliance_day') ?: 0; 60 $compliance_day = GoogleRankModel::where(['project_id' => $item['id'], 'lang' => ''])->value('compliance_day') ?: 0;
61 $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; 61 $remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
@@ -619,6 +619,7 @@ class ProjectController extends BaseController @@ -619,6 +619,7 @@ class ProjectController extends BaseController
619 $domain_array = parse_url($domain_pro ? $domain_pro->domain : ''); 619 $domain_array = parse_url($domain_pro ? $domain_pro->domain : '');
620 $domain = $domain_array['host'] ?? $domain_array['path']; 620 $domain = $domain_array['host'] ?? $domain_array['path'];
621 } 621 }
  622 + $manage = new Manage();
622 $param = [ 623 $param = [
623 "id" => $item['id'], 624 "id" => $item['id'],
624 "title" => $item['title'], 625 "title" => $item['title'],
@@ -639,8 +640,11 @@ class ProjectController extends BaseController @@ -639,8 +640,11 @@ class ProjectController extends BaseController
639 "test_domain" => $item['deploy_build']['test_domain'] ?? '', 640 "test_domain" => $item['deploy_build']['test_domain'] ?? '',
640 "online_time" => $item['online_check']['qa_check_time'] ?? '', 641 "online_time" => $item['online_check']['qa_check_time'] ?? '',
641 "cooperate_date" => $item['cooperate_date'], 642 "cooperate_date" => $item['cooperate_date'],
  643 + "project_manager_name" => $manage->getName($item['deploy_build']['manager_mid']), //项目经理
  644 + "after_sales_manager_name" => $manage->getName($item['deploy_optimize']['manager_mid']), //售后服务经理
  645 + "leader_name" => $manage->getName($item['deploy_build']['leader_mid']), //组长
642 ]; 646 ];
643 - if ($item['type'] == 3) { 647 + if ($item['type'] == Project::TYPE_TWO) {
644 $param['is_compliance'] = RankData::where('project_id', $item['id'])->where('lang', '')->value('is_compliance') ?: 0; 648 $param['is_compliance'] = RankData::where('project_id', $item['id'])->where('lang', '')->value('is_compliance') ?: 0;
645 } else { 649 } else {
646 $param['is_compliance'] = 1; 650 $param['is_compliance'] = 1;
@@ -29,7 +29,7 @@ class NavController extends BaseController @@ -29,7 +29,7 @@ class NavController extends BaseController
29 */ 29 */
30 public function index(BNav $nav){ 30 public function index(BNav $nav){
31 $this->map['project_id'] = $this->user['project_id']; 31 $this->map['project_id'] = $this->user['project_id'];
32 - $lists = $nav->list($this->map,$this->order = 'sort'); 32 + $lists = $nav->list($this->map,$this->order = ['sort','id']);
33 $data = array(); 33 $data = array();
34 foreach ($lists as $v){ 34 foreach ($lists as $v){
35 $v = (array)$v; 35 $v = (array)$v;
@@ -120,7 +120,7 @@ class ProjectLogic extends BaseLogic @@ -120,7 +120,7 @@ class ProjectLogic extends BaseLogic
120 DB::rollBack(); 120 DB::rollBack();
121 $this->fail('请填写完整后再提交'); 121 $this->fail('请填写完整后再提交');
122 } 122 }
123 - app(SyncService::class)->projectAcceptAddress($this->param['id']); 123 + (new SyncService())->projectAcceptAddress($this->param['id']);
124 return $this->success(); 124 return $this->success();
125 } 125 }
126 126
@@ -68,7 +68,6 @@ class BTemplateLogic extends BaseLogic @@ -68,7 +68,6 @@ class BTemplateLogic extends BaseLogic
68 if($this->param['source'] == $this->model::SOURCE_PRODUCT){//产品页 68 if($this->param['source'] == $this->model::SOURCE_PRODUCT){//产品页
69 $TemplateInfo = $this->productHtml($info,$this->param['source'],$this->param['source_id']); 69 $TemplateInfo = $this->productHtml($info,$this->param['source'],$this->param['source_id']);
70 } 70 }
71 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($TemplateInfo['html'], true) . PHP_EOL, FILE_APPEND);  
72 return $this->success($TemplateInfo); 71 return $this->success($TemplateInfo);
73 } 72 }
74 73
@@ -89,7 +89,7 @@ class CustomTemplateLogic extends BaseLogic @@ -89,7 +89,7 @@ class CustomTemplateLogic extends BaseLogic
89 public function saveHtml(){ 89 public function saveHtml(){
90 $html = $this->param['html']; 90 $html = $this->param['html'];
91 $this->saveCommonTemplate($html); 91 $this->saveCommonTemplate($html);
92 - $this->param['html'] = characterTruncation($html,'/<main>(.*?)<\/main>/s'); 92 + $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s');
93 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); 93 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
94 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 94 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
95 if($rs === false){ 95 if($rs === false){
@@ -69,15 +69,6 @@ class BaseLogic extends Logic @@ -69,15 +69,6 @@ class BaseLogic extends Logic
69 */ 69 */
70 public function getParam(){ 70 public function getParam(){
71 $requestAll = $this->request->all(); 71 $requestAll = $this->request->all();
72 - foreach ($requestAll as $k => $v){  
73 - if(is_array($v)){  
74 - continue;  
75 - }else{  
76 - if(empty($v) && ($v == null)){  
77 - unset($requestAll[$k]);  
78 - }  
79 - }  
80 - }  
81 return $this->success($requestAll); 72 return $this->success($requestAll);
82 } 73 }
83 74
@@ -26,6 +26,7 @@ class NavLogic extends BaseLogic @@ -26,6 +26,7 @@ class NavLogic extends BaseLogic
26 $this->model = new BNav(); 26 $this->model = new BNav();
27 } 27 }
28 28
  29 +
29 /** 30 /**
30 * @remark :保存数据 31 * @remark :保存数据
31 * @name :navSave 32 * @name :navSave
@@ -35,29 +36,22 @@ class NavLogic extends BaseLogic @@ -35,29 +36,22 @@ class NavLogic extends BaseLogic
35 */ 36 */
36 public function navSave() 37 public function navSave()
37 { 38 {
38 - DB::beginTransaction();  
39 - try {  
40 - if(!empty($this->param['location'])){  
41 - if($this->param['location'] == 'header'){  
42 - $this->param['group_id'] = BNavGroup::DEFAULT_HEADER_ID;  
43 - }  
44 - if($this->param['location'] == 'footer'){  
45 - $this->param['group_id'] = BNavGroup::DEFAULT_FOOTER_ID;  
46 - } 39 + if(!empty($this->param['location'])){
  40 + if($this->param['location'] == 'header'){
  41 + $this->param['group_id'] = BNavGroup::DEFAULT_HEADER_ID;
47 } 42 }
48 - $this->param['image'] = str_replace_url(isset($this->param['image']) ? $this->param['image'] : '');  
49 - $this->param['remark_image'] = str_replace_url(isset($this->param['remark_image']) ? $this->param['remark_image'] : '');  
50 - if(isset($this->param['id']) && !empty($this->param['id'])){  
51 - $this->handleEditParam();//验证是否可编辑分类  
52 - $this->model->edit($this->param,['id'=>$this->param['id']]);  
53 - }else{  
54 - $this->param['project_id'] = $this->user['project_id'];  
55 - $this->model->add($this->param); 43 + if($this->param['location'] == 'footer'){
  44 + $this->param['group_id'] = BNavGroup::DEFAULT_FOOTER_ID;
56 } 45 }
57 - DB::commit();  
58 - }catch (\Exception $e){  
59 - DB::rollBack();  
60 - $this->fail('error'); 46 + }
  47 + $this->param['image'] = str_replace_url(isset($this->param['image']) ? $this->param['image'] : '');
  48 + $this->param['remark_image'] = str_replace_url(isset($this->param['remark_image']) ? $this->param['remark_image'] : '');
  49 + if(isset($this->param['id']) && !empty($this->param['id'])){
  50 + $this->handleEditParam();//验证是否可编辑分类
  51 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  52 + }else{
  53 + $this->param['project_id'] = $this->user['project_id'];
  54 + $this->model->add($this->param);
61 } 55 }
62 //编辑菜单后,通知更新 56 //编辑菜单后,通知更新
63 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']); 57 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']);
@@ -110,8 +110,8 @@ class CategoryLogic extends BaseLogic @@ -110,8 +110,8 @@ class CategoryLogic extends BaseLogic
110 * @time :2023/8/21 17:14 110 * @time :2023/8/21 17:14
111 */ 111 */
112 public function categorySave(){ 112 public function categorySave(){
113 - DB::beginTransaction();  
114 - try { 113 +// DB::beginTransaction();
  114 +// try {
115 if(isset($this->param['id']) && !empty($this->param['id'])){ 115 if(isset($this->param['id']) && !empty($this->param['id'])){
116 //是否编辑路由 116 //是否编辑路由
117 $id = $this->editCategoryRoute($this->param['id'],$this->param['route']); 117 $id = $this->editCategoryRoute($this->param['id'],$this->param['route']);
@@ -128,11 +128,11 @@ class CategoryLogic extends BaseLogic @@ -128,11 +128,11 @@ class CategoryLogic extends BaseLogic
128 $this->edit(['route'=>$route],['id'=>$id]); 128 $this->edit(['route'=>$route],['id'=>$id]);
129 //清除缓存 129 //清除缓存
130 Common::del_user_cache('product_category',$this->user['project_id']); 130 Common::del_user_cache('product_category',$this->user['project_id']);
131 - DB::commit();  
132 - } catch (\Exception $e){  
133 - DB::rollBack();  
134 - $this->fail('系统错误,请联系管理员');  
135 - } 131 +// DB::commit();
  132 +// } catch (\Exception $e){
  133 +// DB::rollBack();
  134 +// $this->fail('系统错误,请联系管理员');
  135 +// }
136 //通知更新 136 //通知更新
137 $notifyData = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route]; 137 $notifyData = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route];
138 $this->updateNotify($notifyData); 138 $this->updateNotify($notifyData);
@@ -461,7 +461,7 @@ class RankDataLogic extends BaseLogic @@ -461,7 +461,7 @@ class RankDataLogic extends BaseLogic
461 //保证关键词数 461 //保证关键词数
462 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num'); 462 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
463 $type = Project::where('id', $project_id)->value('type'); 463 $type = Project::where('id', $project_id)->value('type');
464 - if($keyword_num && $type == 2 && $first_page_num >= $keyword_num){ 464 + if($keyword_num && $type == Project::TYPE_TWO && $first_page_num >= $keyword_num){
465 $model->compliance_day = $model->compliance_day + 1; 465 $model->compliance_day = $model->compliance_day + 1;
466 $model->is_compliance = 1; 466 $model->is_compliance = 1;
467 467
@@ -14,7 +14,6 @@ class WebSettingLogic extends BaseLogic @@ -14,7 +14,6 @@ class WebSettingLogic extends BaseLogic
14 public function __construct() 14 public function __construct()
15 { 15 {
16 parent::__construct(); 16 parent::__construct();
17 -  
18 $this->model = new WebSetting(); 17 $this->model = new WebSetting();
19 $this->param = $this->requestAll; 18 $this->param = $this->requestAll;
20 } 19 }
@@ -26,13 +25,9 @@ class WebSettingLogic extends BaseLogic @@ -26,13 +25,9 @@ class WebSettingLogic extends BaseLogic
26 * @time :2023/4/28 15:14 25 * @time :2023/4/28 15:14
27 */ 26 */
28 public function setting_read(){ 27 public function setting_read(){
29 - $info = CommonHelper::get_user_cache($this->model->getTable(),$this->user['project_id']);  
30 - if(empty($info)){  
31 - $info = $this->model->read(['project_id'=>$this->user['project_id']]);  
32 - if($info === false){  
33 - $info = [];  
34 - }  
35 - CommonHelper::set_user_cache($info,$this->model->getTable(),$this->user['project_id']); 28 + $info = $this->model->read(['project_id'=>$this->user['project_id']]);
  29 + if($info === false){
  30 + $info = [];
36 } 31 }
37 return $this->success($info); 32 return $this->success($info);
38 } 33 }
@@ -35,6 +35,7 @@ class NavRequest extends FormRequest @@ -35,6 +35,7 @@ class NavRequest extends FormRequest
35 // 'group_id' => ['required','integer'], 35 // 'group_id' => ['required','integer'],
36 'pid' => ['required','integer'], 36 'pid' => ['required','integer'],
37 'name' => ['required','max:100'], 37 'name' => ['required','max:100'],
  38 + 'url' => ['required'],
38 ]; 39 ];
39 return $rule; 40 return $rule;
40 } 41 }
@@ -49,6 +50,7 @@ class NavRequest extends FormRequest @@ -49,6 +50,7 @@ class NavRequest extends FormRequest
49 'pid.integer' => '上级选择错误', 50 'pid.integer' => '上级选择错误',
50 'name.required' => '名称必须', 51 'name.required' => '名称必须',
51 'name.max' => '名称不能超过100个字符', 52 'name.max' => '名称不能超过100个字符',
  53 + 'url.required' => '链接不能为空',
52 ]; 54 ];
53 } 55 }
54 } 56 }