作者 刘锟

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

... ... @@ -57,7 +57,9 @@ class RemainDay extends Command
foreach ($list as $item){
if($item['type'] == Project::TYPE_TWO){
//排名达标天数
$compliance_day = GoogleRankModel::where(['project_id' => $item['id'], 'lang' => ''])->value('compliance_day') ?: 0;
// $compliance_day = GoogleRankModel::where(['project_id' => $item['id'], 'lang' => ''])->value('compliance_day') ?: 0;
//获取当前项目的达标天数
$compliance_day = Project::where(['id' => $item['id']])->value('finish_remain_day') ?: 0;
$remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
}else{
//审核上线后开始
... ...
... ... @@ -29,7 +29,7 @@ class ProjectKeywordController extends BaseController
$this->response('success');
}
$data['search_keywords'] = $info['search_keywords'];
$data['main_keywords'] = $info['main_keywords'];
$data['customer_keywords'] = $info['customer_keywords'];
$this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -9,6 +9,8 @@ use App\Http\Requests\Bside\News\NewsRequest;
use App\Models\News\News as NewsModel;
use App\Models\News\NewsCategory;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Models\Template\Setting;
use App\Models\User\User;
... ... @@ -33,19 +35,45 @@ class NewsController extends BaseController
$lists = $lists->toArray();
// //获取当前项目的所有分类
$data = $this->getCategoryList();
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$user = new User();
foreach ($lists['list'] as $k => $v){
$v['category_name'] = $this->categoryName($v['category_id'],$data);
$v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']);
$v['image_link'] = getImageUrl($v['image']);
$v['operator_name'] = $user->getName($v['operator_id']);
$v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :查看产品是否已装修
* @name :getProductIsRenovation
* @author :lyh
* @method :post
* @time :2023/9/13 14:02
*/
public function getProductIsRenovation($info,$id){
if($info !== false){
$webTemplateModel = new BTemplate();
$param = [
'source'=>4,
'project_id'=>$this->user['project_id'],
'source_id'=>$id,
'template_id'=>$info['template_id']
];
$templateInfo = $webTemplateModel->read($param);
if($templateInfo !== false){
return 1;
}
}
return 0;
}
/**
* @remark :处理列表返回参数
... ...
... ... @@ -30,14 +30,30 @@ class KeywordPrefixLogic extends BaseLogic
* @time :2023/9/6 14:42
*/
public function prefixSave(){
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->model->add($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
$condition = [
'keyword'=>$this->param['keyword'],
'id'=>['!=',$this->param['id']]
];
$prefixInfo = $this->model->read($condition);
if($prefixInfo !== false){
$this->fail('当前关键字已存在');
}
}catch (\Exception $e){
$this->fail('error');
$data = [
'keyword'=>$this->param['keyword']
];
$this->model->edit($data,['id'=>$this->param['id']]);
}else{
$data = [
'project_id'=>$this->param['project_id'] ?? 0,
'keyword'=>$this->param['keyword'],
'type'=>$this->param['type']
];
$prefixInfo = $this->model->read($data);
if($prefixInfo !== false){
$this->fail('当前关键字已存在');
}
$this->model->add($data);
}
return $this->success();
}
... ...
... ... @@ -184,6 +184,8 @@ class ProjectLogic extends BaseLogic
}
$param['confirm_file'] = Arr::a2s($param['confirm_file']);
}
$param['remain_day'] = $param['deploy_build']['service_duration'] - $param['finish_remain_day'];
$param['remain_day'] = ($param['remain_day'] > 0) ? $param['remain_day'] : 0;
unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'],$param['online_check'],$param['project_after']);
//文件上传默认值
if($param['is_upload_manage']){
... ...
... ... @@ -122,7 +122,7 @@ class NavLogic extends BaseLogic
'target'=>$param['target'] ?? 1,
'remark'=>$param['remark'] ?? '',
'group_id'=>$param['group_id'],
'show'=>$param['show'],
'show'=>$param['show'] ?? 0,
];
return $this->success($data);
}
... ...
... ... @@ -464,9 +464,9 @@ class RankDataLogic extends BaseLogic
if($keyword_num && $type == Project::TYPE_TWO && $first_page_num >= $keyword_num){
$model->compliance_day = $model->compliance_day + 1;
$model->is_compliance = 1;
//项目表更新
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $model->compliance_day]);
$compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day+1]);
}
}
... ...