作者 李宇航

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

gx脚本



查看合并请求 !2023
... ... @@ -126,11 +126,12 @@ class RemainDay extends Command
}else{
$seo_remain_day = $deploy_build['seo_service_duration'];
}
if($seo_remain_day < 0){
$seo_remain_day = 0;
}
if($deploy_build['plan'] == 0 && $seo_remain_day == 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常未0,放入未续费中
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]);
// if($seo_remain_day < 0){
// $seo_remain_day = 0;
// }
if($deploy_build['plan'] == 0 && $seo_remain_day < 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常为0,放入未续费中
// $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]);
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
}else{
//同时包括白帽版本+默认版本的项目
$this->project->edit(['seo_remain_day'=>$seo_remain_day],['id'=>$item['id']]);
... ... @@ -174,10 +175,10 @@ class RemainDay extends Command
}
}
$extend_type = 0;
if($remain_day < 0 && $deploy_build['service_duration'] != 0){
$remain_day = 0;
$extend_type = Project::TYPE_FIVE;
}
// if($remain_day < 0 && $deploy_build['service_duration'] != 0){
// $remain_day = 0;
// $extend_type = Project::TYPE_FIVE;
// }
$this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
return true;
}
... ...
... ... @@ -52,14 +52,55 @@ class LyhImportTest extends Command
* @time :2023/11/20 15:13
*/
public function handle(){
ProjectServer::useProject(2140);
ProjectServer::useProject(3951);
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
$this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',2140);
$this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',3951);
DB::disconnect('custom_mysql');
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
/**
* @remark :3951项目导入产品
* @name :import3951Product
* @author :lyh
* @method :post
* @time :2025/5/24 11:32
*/
public function import3951Product($url,$project_id){
$line_of_text = [];
$opts = [
'http' => [
'method' => 'GET',
'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'
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
];
$file_handle = fopen($url, 'r', null, stream_context_create($opts));
while (!feof($file_handle)) {
$line_of_text[] = fgetcsv($file_handle, 0, ',');
}
fclose($file_handle);
$saveData = [];
foreach ($line_of_text as $k => $val){
if($k < 1){
continue;
}
if(empty($val[0])){
echo '跳过的名称:'.$val[0];
continue;
}
$saveData[] = [
'title'=>$val[0],
'thumb' => json_encode(['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]],true),
'gallery' => json_encode([['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]]],true)
];
}
}
/**
* @remark :导入产品分类
* @name :productCategory
* @author :lyh
... ...