作者 刘锟

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

@@ -57,7 +57,9 @@ class RemainDay extends Command @@ -57,7 +57,9 @@ class RemainDay extends Command
57 foreach ($list as $item){ 57 foreach ($list as $item){
58 if($item['type'] == Project::TYPE_TWO){ 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 + //获取当前项目的达标天数
  62 + $compliance_day = Project::where(['id' => $item['id']])->value('finish_remain_day') ?: 0;
61 $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; 63 $remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
62 }else{ 64 }else{
63 //审核上线后开始 65 //审核上线后开始
@@ -29,7 +29,7 @@ class ProjectKeywordController extends BaseController @@ -29,7 +29,7 @@ class ProjectKeywordController extends BaseController
29 $this->response('success'); 29 $this->response('success');
30 } 30 }
31 $data['search_keywords'] = $info['search_keywords']; 31 $data['search_keywords'] = $info['search_keywords'];
32 - $data['main_keywords'] = $info['main_keywords']; 32 + $data['customer_keywords'] = $info['customer_keywords'];
33 $this->response('success',Code::SUCCESS,$data); 33 $this->response('success',Code::SUCCESS,$data);
34 } 34 }
35 35
@@ -9,6 +9,8 @@ use App\Http\Requests\Bside\News\NewsRequest; @@ -9,6 +9,8 @@ use App\Http\Requests\Bside\News\NewsRequest;
9 use App\Models\News\News as NewsModel; 9 use App\Models\News\News as NewsModel;
10 use App\Models\News\NewsCategory; 10 use App\Models\News\NewsCategory;
11 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
  12 +use App\Models\Template\BTemplate;
  13 +use App\Models\Template\Setting;
12 use App\Models\User\User; 14 use App\Models\User\User;
13 15
14 16
@@ -33,19 +35,45 @@ class NewsController extends BaseController @@ -33,19 +35,45 @@ class NewsController extends BaseController
33 $lists = $lists->toArray(); 35 $lists = $lists->toArray();
34 // //获取当前项目的所有分类 36 // //获取当前项目的所有分类
35 $data = $this->getCategoryList(); 37 $data = $this->getCategoryList();
  38 + //获取当前用户选择的模版
  39 + $templateSettingModel = new Setting();
  40 + $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
36 $user = new User(); 41 $user = new User();
37 foreach ($lists['list'] as $k => $v){ 42 foreach ($lists['list'] as $k => $v){
38 $v['category_name'] = $this->categoryName($v['category_id'],$data); 43 $v['category_name'] = $this->categoryName($v['category_id'],$data);
39 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']); 44 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']);
40 $v['image_link'] = getImageUrl($v['image']); 45 $v['image_link'] = getImageUrl($v['image']);
41 $v['operator_name'] = $user->getName($v['operator_id']); 46 $v['operator_name'] = $user->getName($v['operator_id']);
  47 + $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
42 $lists['list'][$k] = $v; 48 $lists['list'][$k] = $v;
43 } 49 }
44 } 50 }
45 $this->response('success',Code::SUCCESS,$lists); 51 $this->response('success',Code::SUCCESS,$lists);
46 } 52 }
47 53
48 - 54 + /**
  55 + * @remark :查看产品是否已装修
  56 + * @name :getProductIsRenovation
  57 + * @author :lyh
  58 + * @method :post
  59 + * @time :2023/9/13 14:02
  60 + */
  61 + public function getProductIsRenovation($info,$id){
  62 + if($info !== false){
  63 + $webTemplateModel = new BTemplate();
  64 + $param = [
  65 + 'source'=>4,
  66 + 'project_id'=>$this->user['project_id'],
  67 + 'source_id'=>$id,
  68 + 'template_id'=>$info['template_id']
  69 + ];
  70 + $templateInfo = $webTemplateModel->read($param);
  71 + if($templateInfo !== false){
  72 + return 1;
  73 + }
  74 + }
  75 + return 0;
  76 + }
49 77
50 /** 78 /**
51 * @remark :处理列表返回参数 79 * @remark :处理列表返回参数
@@ -30,14 +30,30 @@ class KeywordPrefixLogic extends BaseLogic @@ -30,14 +30,30 @@ class KeywordPrefixLogic extends BaseLogic
30 * @time :2023/9/6 14:42 30 * @time :2023/9/6 14:42
31 */ 31 */
32 public function prefixSave(){ 32 public function prefixSave(){
33 - try {  
34 - if(isset($this->param['id']) && !empty($this->param['id'])){  
35 - $this->model->edit($this->param,['id'=>$this->param['id']]);  
36 - }else{  
37 - $this->model->add($this->param); 33 + if(isset($this->param['id']) && !empty($this->param['id'])){
  34 + $condition = [
  35 + 'keyword'=>$this->param['keyword'],
  36 + 'id'=>['!=',$this->param['id']]
  37 + ];
  38 + $prefixInfo = $this->model->read($condition);
  39 + if($prefixInfo !== false){
  40 + $this->fail('当前关键字已存在');
38 } 41 }
39 - }catch (\Exception $e){  
40 - $this->fail('error'); 42 + $data = [
  43 + 'keyword'=>$this->param['keyword']
  44 + ];
  45 + $this->model->edit($data,['id'=>$this->param['id']]);
  46 + }else{
  47 + $data = [
  48 + 'project_id'=>$this->param['project_id'] ?? 0,
  49 + 'keyword'=>$this->param['keyword'],
  50 + 'type'=>$this->param['type']
  51 + ];
  52 + $prefixInfo = $this->model->read($data);
  53 + if($prefixInfo !== false){
  54 + $this->fail('当前关键字已存在');
  55 + }
  56 + $this->model->add($data);
41 } 57 }
42 return $this->success(); 58 return $this->success();
43 } 59 }
@@ -184,6 +184,8 @@ class ProjectLogic extends BaseLogic @@ -184,6 +184,8 @@ class ProjectLogic extends BaseLogic
184 } 184 }
185 $param['confirm_file'] = Arr::a2s($param['confirm_file']); 185 $param['confirm_file'] = Arr::a2s($param['confirm_file']);
186 } 186 }
  187 + $param['remain_day'] = $param['deploy_build']['service_duration'] - $param['finish_remain_day'];
  188 + $param['remain_day'] = ($param['remain_day'] > 0) ? $param['remain_day'] : 0;
187 unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'],$param['online_check'],$param['project_after']); 189 unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'],$param['online_check'],$param['project_after']);
188 //文件上传默认值 190 //文件上传默认值
189 if($param['is_upload_manage']){ 191 if($param['is_upload_manage']){
@@ -122,7 +122,7 @@ class NavLogic extends BaseLogic @@ -122,7 +122,7 @@ class NavLogic extends BaseLogic
122 'target'=>$param['target'] ?? 1, 122 'target'=>$param['target'] ?? 1,
123 'remark'=>$param['remark'] ?? '', 123 'remark'=>$param['remark'] ?? '',
124 'group_id'=>$param['group_id'], 124 'group_id'=>$param['group_id'],
125 - 'show'=>$param['show'], 125 + 'show'=>$param['show'] ?? 0,
126 ]; 126 ];
127 return $this->success($data); 127 return $this->success($data);
128 } 128 }
@@ -464,9 +464,9 @@ class RankDataLogic extends BaseLogic @@ -464,9 +464,9 @@ class RankDataLogic extends BaseLogic
464 if($keyword_num && $type == Project::TYPE_TWO && $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 -  
468 //项目表更新 467 //项目表更新
469 - Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $model->compliance_day]); 468 + $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
  469 + Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day+1]);
470 } 470 }
471 } 471 }
472 472