作者 李宇航

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

gx脚本



查看合并请求 !2023
@@ -126,11 +126,12 @@ class RemainDay extends Command @@ -126,11 +126,12 @@ class RemainDay extends Command
126 }else{ 126 }else{
127 $seo_remain_day = $deploy_build['seo_service_duration']; 127 $seo_remain_day = $deploy_build['seo_service_duration'];
128 } 128 }
129 - if($seo_remain_day < 0){  
130 - $seo_remain_day = 0;  
131 - }  
132 - if($deploy_build['plan'] == 0 && $seo_remain_day == 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常未0,放入未续费中  
133 - $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]); 129 +// if($seo_remain_day < 0){
  130 +// $seo_remain_day = 0;
  131 +// }
  132 + if($deploy_build['plan'] == 0 && $seo_remain_day < 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常为0,放入未续费中
  133 +// $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]);
  134 + $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
134 }else{ 135 }else{
135 //同时包括白帽版本+默认版本的项目 136 //同时包括白帽版本+默认版本的项目
136 $this->project->edit(['seo_remain_day'=>$seo_remain_day],['id'=>$item['id']]); 137 $this->project->edit(['seo_remain_day'=>$seo_remain_day],['id'=>$item['id']]);
@@ -174,10 +175,10 @@ class RemainDay extends Command @@ -174,10 +175,10 @@ class RemainDay extends Command
174 } 175 }
175 } 176 }
176 $extend_type = 0; 177 $extend_type = 0;
177 - if($remain_day < 0 && $deploy_build['service_duration'] != 0){  
178 - $remain_day = 0;  
179 - $extend_type = Project::TYPE_FIVE;  
180 - } 178 +// if($remain_day < 0 && $deploy_build['service_duration'] != 0){
  179 +// $remain_day = 0;
  180 +// $extend_type = Project::TYPE_FIVE;
  181 +// }
181 $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); 182 $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
182 return true; 183 return true;
183 } 184 }
@@ -52,14 +52,55 @@ class LyhImportTest extends Command @@ -52,14 +52,55 @@ class LyhImportTest extends Command
52 * @time :2023/11/20 15:13 52 * @time :2023/11/20 15:13
53 */ 53 */
54 public function handle(){ 54 public function handle(){
55 - ProjectServer::useProject(2140); 55 + ProjectServer::useProject(3951);
56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
57 - $this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',2140); 57 + $this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',3951);
58 DB::disconnect('custom_mysql'); 58 DB::disconnect('custom_mysql');
59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
60 } 60 }
61 61
62 /** 62 /**
  63 + * @remark :3951项目导入产品
  64 + * @name :import3951Product
  65 + * @author :lyh
  66 + * @method :post
  67 + * @time :2025/5/24 11:32
  68 + */
  69 + public function import3951Product($url,$project_id){
  70 + $line_of_text = [];
  71 + $opts = [
  72 + 'http' => [
  73 + 'method' => 'GET',
  74 + 'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'
  75 + ],
  76 + 'ssl' => [
  77 + 'verify_peer' => false,
  78 + 'verify_peer_name' => false
  79 + ]
  80 + ];
  81 + $file_handle = fopen($url, 'r', null, stream_context_create($opts));
  82 + while (!feof($file_handle)) {
  83 + $line_of_text[] = fgetcsv($file_handle, 0, ',');
  84 + }
  85 + fclose($file_handle);
  86 + $saveData = [];
  87 + foreach ($line_of_text as $k => $val){
  88 + if($k < 1){
  89 + continue;
  90 + }
  91 + if(empty($val[0])){
  92 + echo '跳过的名称:'.$val[0];
  93 + continue;
  94 + }
  95 + $saveData[] = [
  96 + 'title'=>$val[0],
  97 + 'thumb' => json_encode(['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]],true),
  98 + 'gallery' => json_encode([['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]]],true)
  99 + ];
  100 + }
  101 + }
  102 +
  103 + /**
63 * @remark :导入产品分类 104 * @remark :导入产品分类
64 * @name :productCategory 105 * @name :productCategory
65 * @author :lyh 106 * @author :lyh