作者 lyh

gx脚本更新路由

... ... @@ -66,7 +66,6 @@ class UpdateBuildConfiguration extends Command
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->getProduct();
gc_collect_cycles(); // 确保内存释放
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
... ... @@ -81,10 +80,12 @@ class UpdateBuildConfiguration extends Command
*/
public function getProduct(){
$productModel = new Product();
$lists = $productModel->list([],'id',['id','describe']);
$page = 1;
while (true){
$lists = $productModel->lists([],$page,$page*5,['id','describe']);
$detailModel = new Detail();
if(!empty($lists)){
foreach ($lists as $k => $v){
if(!empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
if(empty($v['describe'])){
continue;
}
... ... @@ -104,6 +105,11 @@ class UpdateBuildConfiguration extends Command
$detailModel->insert($data);
}
}
}else{
break;
return false;
}
$page++;
}
return true;
}
... ...