正在显示
1 个修改的文件
包含
15 行增加
和
12 行删除
| @@ -80,22 +80,25 @@ class UpdateBuildConfiguration extends Command | @@ -80,22 +80,25 @@ class UpdateBuildConfiguration extends Command | ||
| 80 | */ | 80 | */ |
| 81 | public function getProduct(){ | 81 | public function getProduct(){ |
| 82 | $productModel = new Product(); | 82 | $productModel = new Product(); |
| 83 | - $lists = $productModel->list(); | 83 | + $lists = $productModel->list([],'id',['id','content']); |
| 84 | $detailModel = new Detail(); | 84 | $detailModel = new Detail(); |
| 85 | if(!empty($lists)){ | 85 | if(!empty($lists)){ |
| 86 | foreach ($lists as $k => $v){ | 86 | foreach ($lists as $k => $v){ |
| 87 | echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; | 87 | echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; |
| 88 | - $data = [ | ||
| 89 | - 'product_id'=>$v['id'], | ||
| 90 | - 'column_id'=>1, | ||
| 91 | - 'text_type'=>1, | ||
| 92 | - 'title'=>'', | ||
| 93 | - 'sort'=>1, | ||
| 94 | - 'content'=>json_encode(['content'=>$v['describe']],true), | ||
| 95 | - 'created_at'=>date('Y-m-d H:i:s'), | ||
| 96 | - 'updated_at'=>date('Y-m-d H:i:s') | ||
| 97 | - ]; | ||
| 98 | - $detailModel->insert($data); | 88 | + $info = $detailModel->read(['product_id'=>$v['id']],['id']); |
| 89 | + if($info === false){ | ||
| 90 | + $data = [ | ||
| 91 | + 'product_id'=>$v['id'], | ||
| 92 | + 'column_id'=>1, | ||
| 93 | + 'text_type'=>1, | ||
| 94 | + 'title'=>'', | ||
| 95 | + 'sort'=>1, | ||
| 96 | + 'content'=>json_encode(['content'=>$v['describe']],true), | ||
| 97 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 98 | + 'updated_at'=>date('Y-m-d H:i:s') | ||
| 99 | + ]; | ||
| 100 | + $detailModel->insert($data); | ||
| 101 | + } | ||
| 99 | } | 102 | } |
| 100 | } | 103 | } |
| 101 | return true; | 104 | return true; |
-
请 注册 或 登录 后发表评论