作者 lyh

gx脚本统计天数

@@ -27,6 +27,13 @@ class RemainDay extends Command @@ -27,6 +27,13 @@ class RemainDay extends Command
27 protected $projectId = [ 27 protected $projectId = [
28 1434,1812 28 1434,1812
29 ];//需要单独处理的项目 29 ];//需要单独处理的项目
  30 +
  31 + /**
  32 + * @var 暂停的项目
  33 + */
  34 + protected $ceaseProjectId = [
  35 + 354
  36 + ];//需要单独处理的项目
30 /** 37 /**
31 * The console command description. 38 * The console command description.
32 * 39 *
@@ -62,6 +69,11 @@ class RemainDay extends Command @@ -62,6 +69,11 @@ class RemainDay extends Command
62 }else{ 69 }else{
63 if($item['type'] == Project::TYPE_TWO){ 70 if($item['type'] == Project::TYPE_TWO){
64 //获取当前项目的达标天数 71 //获取当前项目的达标天数
  72 + if(in_array($item->id,$this->ceaseProjectId) && ($item->is_compliance == 1)){
  73 + //查看今日是否达标(已达标减1)
  74 + $item->finish_remain_day = (($item->finish_remain_day - 1) < 0) ? 0 : $item->finish_remain_day - 1;
  75 + $item->pause_days = $item->pause_days + 1;
  76 + }
65 $compliance_day = $item->finish_remain_day ?? 0; 77 $compliance_day = $item->finish_remain_day ?? 0;
66 $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; 78 $remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
67 }else{ 79 }else{
@@ -44,24 +44,13 @@ class RankData extends BaseCommands @@ -44,24 +44,13 @@ class RankData extends BaseCommands
44 public function do() 44 public function do()
45 { 45 {
46 try { 46 try {
47 -  
48 -  
49 Log::channel('rank_data')->info('开始-排名数据'); 47 Log::channel('rank_data')->info('开始-排名数据');
50 - //同步api_no  
51 -// try {  
52 -// $this->SyncApiNo();  
53 -// } catch (\Exception $e) {  
54 -// Log::channel('rank_data')->error('同步api_no失败:' . $e->getMessage());  
55 -// }  
56 -  
57 -  
58 //所有项目 今日是否达标 重置 48 //所有项目 今日是否达标 重置
59 //有失败会重跑任务,导致达标又被重置 加缓存一天只重置一次 49 //有失败会重跑任务,导致达标又被重置 加缓存一天只重置一次
60 if (!Cache::get('clear_remain_today_' . date('Y-m-d'))) { 50 if (!Cache::get('clear_remain_today_' . date('Y-m-d'))) {
61 Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]); 51 Project::where('is_remain_today', 1)->update(['is_remain_today' => 0]);
62 Cache::set('clear_remain_today_' . date('Y-m-d'), 1, 24 * 3600); 52 Cache::set('clear_remain_today_' . date('Y-m-d'), 1, 24 * 3600);
63 } 53 }
64 -  
65 $error = 0; 54 $error = 0;
66 $api = new QuanqiusouApi(); 55 $api = new QuanqiusouApi();
67 //有排名api编号的项目 56 //有排名api编号的项目
@@ -102,7 +91,6 @@ class RankData extends BaseCommands @@ -102,7 +91,6 @@ class RankData extends BaseCommands
102 if(!$deploy_optimizes){ 91 if(!$deploy_optimizes){
103 return true; 92 return true;
104 } 93 }
105 -  
106 $api = new QuanqiusouApi(); 94 $api = new QuanqiusouApi();
107 $ai_nos = $api->getWebApiNo(); 95 $ai_nos = $api->getWebApiNo();
108 if($ai_nos){ 96 if($ai_nos){
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ExtensionModuleController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/7 11:47
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Aside\ExtentModule;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Aside\BaseController;
  14 +use App\Models\ExtentModule\ExtensionModule;
  15 +
  16 +class ExtensionModuleController extends BaseController
  17 +{
  18 + /**
  19 + * @remark :获取当前项目的拓展数据模块
  20 + * @name :getModuleLists
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2024/8/7 11:48
  24 + */
  25 + public function getModuleLists(){
  26 + $extensionModuleModel = new ExtensionModule();
  27 + $list = $extensionModuleModel->list();
  28 + $this->response('success',Code::SUCCESS,$list);
  29 + }
  30 +}
@@ -375,9 +375,7 @@ class RankDataLogic extends BaseLogic @@ -375,9 +375,7 @@ class RankDataLogic extends BaseLogic
375 if (!$project) { 375 if (!$project) {
376 throw new \Exception($api_no . '关联的项目不存在'); 376 throw new \Exception($api_no . '关联的项目不存在');
377 } 377 }
378 -  
379 $api = new QuanqiusouApi(); 378 $api = new QuanqiusouApi();
380 -  
381 $model = RankData::where('project_id', $project_id)->where('lang', '')->first(); 379 $model = RankData::where('project_id', $project_id)->where('lang', '')->first();
382 if (!$model || $model->updated_date != date('Y-m-d') || $force) { 380 if (!$model || $model->updated_date != date('Y-m-d') || $force) {
383 $res = $api->getGoogleRank($api_no, '', 7, $force); 381 $res = $api->getGoogleRank($api_no, '', 7, $force);
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ExtensionModule.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/7 14:13
  8 + */
  9 +
  10 +namespace App\Models\ExtentModule;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class ExtensionModule extends Base
  15 +{
  16 +
  17 + protected $table = 'gl_extension_module';
  18 + //连接数据库
  19 + protected $connection = 'custom_mysql';
  20 +}