作者 lyh

gx脚本更新路由

... ... @@ -87,28 +87,27 @@ class UpdateBuildConfiguration extends Command
$detailModel = new Detail();
if(!empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
if(empty($v['describe'])){
continue;
}
if(empty($v['describe'][0]['text'])){
continue;
}
if(isset($v['describe'][0]['title']) && ($v['describe'][0]['title'] == null)){
$v['describe'][0]['title'] = '';
}
if(isset($v['describe'][0]['text']) && ($v['describe'][0]['text'] == null)){
$v['describe'][0]['text'] = '';
}
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
$info = $detailModel->read(['product_id'=>$v['id']],['id']);
if($info === false){
foreach ($v['describe'] as $key => $value){
if(isset($value['title']) && ($value['title'] == null)){
$value['title'] = '';
}
if(isset($value['text']) && ($value['text'] == null)){
$value['text'] = '';
}
if(empty($value['text'])){
continue;
}
$data = [
'product_id'=>$v['id'],
'column_id'=>1,
'text_type'=>1,
'title'=>$v['describe'][0]['title'] ?? '',
'title'=>$value['title'] ?? '',
'sort'=>1,
'content'=>json_encode(['content'=>$v['describe'][0]['text'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'content'=>json_encode(['content'=>$value['text'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
... ...