作者 李宇航

合并分支 'lyh-server' 到 'master'

gx暂停优化项目



查看合并请求 !1850
@@ -7,6 +7,7 @@ use App\Models\RankData\RankDataLog as RankDataLogModel; @@ -7,6 +7,7 @@ use App\Models\RankData\RankDataLog as RankDataLogModel;
7 use App\Models\Project\DeployOptimize; 7 use App\Models\Project\DeployOptimize;
8 use App\Models\Project\Project; 8 use App\Models\Project\Project;
9 use Illuminate\Support\Facades\Cache; 9 use Illuminate\Support\Facades\Cache;
  10 +use Illuminate\Support\Facades\DB;
10 use Illuminate\Support\Facades\Log; 11 use Illuminate\Support\Facades\Log;
11 12
12 /** 13 /**
@@ -47,8 +48,19 @@ class RankData extends BaseCommands @@ -47,8 +48,19 @@ class RankData extends BaseCommands
47 Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]); 48 Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]);
48 Cache::set('clear_remain_today_' . date('Y-m-d'), 1, 24 * 3600); 49 Cache::set('clear_remain_today_' . date('Y-m-d'), 1, 24 * 3600);
49 } 50 }
  51 +
  52 + $projectModel = new Project();
  53 + $list = $projectModel->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
  54 + ->where('gl_project.extend_type',0)
  55 + ->where('gl_project.delete_status',0)
  56 + ->where('gl_project_deploy_optimize.api_no', '>', 0)
  57 + ->whereIn('gl_project.type',[2,4])
  58 + ->whereRaw("FIND_IN_SET('2', gl_project.level) = 0 AND FIND_IN_SET('3', gl_project.level) = 0")
  59 + ->select(['gl_project_deploy_optimize.api_no as api_no', 'gl_project_deploy_optimize.project_id as project_id'])
  60 + ->orderBy('gl_project.id', 'asc')
  61 + ->get()->toArray();
50 //有排名api编号的项目 62 //有排名api编号的项目
51 - $list = DeployOptimize::where('api_no', '>', 0)->select('api_no', 'project_id')->orderBy('project_id', 'asc')->get()->toArray(); 63 +// $list = DeployOptimize::where('api_no', '>', 0)->select('api_no', 'project_id')->orderBy('project_id', 'asc')->get()->toArray();
52 //特殊项目 一个项目多个apino 64 //特殊项目 一个项目多个apino
53 $list[] = ['api_no' => 11201, 'project_id' => 2104]; 65 $list[] = ['api_no' => 11201, 'project_id' => 2104];
54 $list[] = ['api_no' => 10690, 'project_id' => 2104]; 66 $list[] = ['api_no' => 10690, 'project_id' => 2104];
@@ -53,9 +53,11 @@ use App\Services\DingService; @@ -53,9 +53,11 @@ use App\Services\DingService;
53 use App\Services\ProjectServer; 53 use App\Services\ProjectServer;
54 use App\Services\SyncService; 54 use App\Services\SyncService;
55 use App\Utils\LogUtils; 55 use App\Utils\LogUtils;
  56 +use AWS\CRT\Log;
56 use Illuminate\Support\Facades\Cache; 57 use Illuminate\Support\Facades\Cache;
57 use Illuminate\Support\Facades\DB; 58 use Illuminate\Support\Facades\DB;
58 use Illuminate\Support\Facades\Http; 59 use Illuminate\Support\Facades\Http;
  60 +use Illuminate\Support\Facades\Log as LogInfo;
59 61
60 /** 62 /**
61 * Class ProjectLogic 63 * Class ProjectLogic
@@ -162,7 +164,7 @@ class ProjectLogic extends BaseLogic @@ -162,7 +164,7 @@ class ProjectLogic extends BaseLogic
162 if($this->param['type'] == Project::TYPE_SEVEN){ 164 if($this->param['type'] == Project::TYPE_SEVEN){
163 $this->setTypeSevenEdit($this->param); 165 $this->setTypeSevenEdit($this->param);
164 }else{ 166 }else{
165 - $this->param = $this->handleLevelStr($this->param);//处理星级客户暂停优化 167 + $this->param = $this->handleLevelStr($this->param);//处理星级客户暂停优化默认参数
166 $this->saveSeoPlan($this->param);//保存seo白帽类型,上线保存一条审核记录 168 $this->saveSeoPlan($this->param);//保存seo白帽类型,上线保存一条审核记录
167 $this->checkAiBlog($this->param);//开启白帽验证参数 169 $this->checkAiBlog($this->param);//开启白帽验证参数
168 DB::beginTransaction(); 170 DB::beginTransaction();
@@ -194,6 +196,7 @@ class ProjectLogic extends BaseLogic @@ -194,6 +196,7 @@ class ProjectLogic extends BaseLogic
194 (new SyncService())->projectAcceptAddress($this->param['id']); 196 (new SyncService())->projectAcceptAddress($this->param['id']);
195 DB::commit(); 197 DB::commit();
196 }catch (\Exception $e){ 198 }catch (\Exception $e){
  199 + LogInfo::info('项目保存失败:project_id'.$this->param['id'].',错误详情:'.$e->getMessage(). PHP_EOL);
197 DB::rollBack(); 200 DB::rollBack();
198 $this->fail('保存失败,请联系管理员'); 201 $this->fail('保存失败,请联系管理员');
199 } 202 }
@@ -62,7 +62,13 @@ class RankDataLogic extends BaseLogic @@ -62,7 +62,13 @@ class RankDataLogic extends BaseLogic
62 $external_links = ExternalLinks::where('project_id', $project_id)->where('api_no', $api_no)->first(); 62 $external_links = ExternalLinks::where('project_id', $project_id)->where('api_no', $api_no)->first();
63 $indexed_pages = IndexedPages::where('project_id', $project_id)->where('api_no', $api_no)->first(); 63 $indexed_pages = IndexedPages::where('project_id', $project_id)->where('api_no', $api_no)->first();
64 $speed = Speed::where('project_id', $project_id)->first(); 64 $speed = Speed::where('project_id', $project_id)->first();
65 - 65 + //暂停优化的项目(排名数据显示横杠 - ,关键词排名第一页 、 关键词排名前十页 、 Google收录页面数 、 可查询外链数)
  66 + if(!empty($param['level'])){
  67 + $values = explode(',', $param['level']);
  68 + if (in_array('2', $values) || in_array('3', $values)) {
  69 + $rank['first_page_num'] = $rank['first_ten_pages_num'] = $rank['indexed_pages_num'] = $rank['external_links_num'] = '-';
  70 + }
  71 + }
66 //排名数据 72 //排名数据
67 $data = [ 73 $data = [
68 'first_num' => $rank['first_num'] ?? 0, 74 'first_num' => $rank['first_num'] ?? 0,