|
...
|
...
|
@@ -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,29 +80,36 @@ class UpdateBuildConfiguration extends Command |
|
|
|
*/
|
|
|
|
public function getProduct(){
|
|
|
|
$productModel = new Product();
|
|
|
|
$lists = $productModel->list([],'id',['id','describe']);
|
|
|
|
$detailModel = new Detail();
|
|
|
|
if(!empty($lists)){
|
|
|
|
foreach ($lists as $k => $v){
|
|
|
|
if(empty($v['describe'])){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
|
|
|
|
$info = $detailModel->read(['product_id'=>$v['id']],['id']);
|
|
|
|
if($info === false){
|
|
|
|
$data = [
|
|
|
|
'product_id'=>$v['id'],
|
|
|
|
'column_id'=>1,
|
|
|
|
'text_type'=>1,
|
|
|
|
'title'=>'',
|
|
|
|
'sort'=>1,
|
|
|
|
'content'=>json_encode(['content'=>$v['describe']],true),
|
|
|
|
'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
'updated_at'=>date('Y-m-d H:i:s')
|
|
|
|
];
|
|
|
|
$detailModel->insert($data);
|
|
|
|
$page = 1;
|
|
|
|
while (true){
|
|
|
|
$lists = $productModel->lists([],$page,$page*5,['id','describe']);
|
|
|
|
$detailModel = new Detail();
|
|
|
|
if(!empty($lists['list'])){
|
|
|
|
foreach ($lists['list'] as $k => $v){
|
|
|
|
if(empty($v['describe'])){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
|
|
|
|
$info = $detailModel->read(['product_id'=>$v['id']],['id']);
|
|
|
|
if($info === false){
|
|
|
|
$data = [
|
|
|
|
'product_id'=>$v['id'],
|
|
|
|
'column_id'=>1,
|
|
|
|
'text_type'=>1,
|
|
|
|
'title'=>'',
|
|
|
|
'sort'=>1,
|
|
|
|
'content'=>json_encode(['content'=>$v['describe']],true),
|
|
|
|
'created_at'=>date('Y-m-d H:i:s'),
|
|
|
|
'updated_at'=>date('Y-m-d H:i:s')
|
|
|
|
];
|
|
|
|
$detailModel->insert($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
break;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$page++;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
...
|
...
|
|