作者 lyh

gx脚本更新路由

@@ -61,7 +61,7 @@ class UpdateBuildConfiguration extends Command @@ -61,7 +61,7 @@ class UpdateBuildConfiguration extends Command
61 */ 61 */
62 public function handle(){ 62 public function handle(){
63 $projectModel = new Project(); 63 $projectModel = new Project();
64 - $list = $projectModel->list(['delete_status'=>0,'id'=>['=',1671]],'id',['id'],'asc'); 64 + $list = $projectModel->list(['delete_status'=>0],'id',['id'],'asc');
65 foreach ($list as $k => $v){ 65 foreach ($list as $k => $v){
66 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 66 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
67 ProjectServer::useProject($v['id']); 67 ProjectServer::useProject($v['id']);
@@ -82,13 +82,19 @@ class UpdateBuildConfiguration extends Command @@ -82,13 +82,19 @@ class UpdateBuildConfiguration extends Command
82 $productModel = new Product(); 82 $productModel = new Product();
83 $page = 1; 83 $page = 1;
84 while (true){ 84 while (true){
85 - $lists = $productModel->lists([],$page,100,['id','describe']); 85 + $lists = $productModel->lists([],$page,50,['id','describe']);
86 $detailModel = new Detail(); 86 $detailModel = new Detail();
87 if(!empty($lists['list'])){ 87 if(!empty($lists['list'])){
88 foreach ($lists['list'] as $k => $v){ 88 foreach ($lists['list'] as $k => $v){
89 if(empty($v['describe'])){ 89 if(empty($v['describe'])){
90 continue; 90 continue;
91 } 91 }
  92 + if(isset($v['describe'][0]['title']) && ($v['describe'][0]['title'] == null)){
  93 + $v['describe'][0]['title'] = '';
  94 + }
  95 + if(isset($v['describe'][0]['text']) && ($v['describe'][0]['title'] == null)){
  96 + $v['describe'][0]['title'] = '';
  97 + }
92 echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; 98 echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
93 $info = $detailModel->read(['product_id'=>$v['id']],['id']); 99 $info = $detailModel->read(['product_id'=>$v['id']],['id']);
94 if($info === false){ 100 if($info === false){
@@ -98,11 +104,13 @@ class UpdateBuildConfiguration extends Command @@ -98,11 +104,13 @@ class UpdateBuildConfiguration extends Command
98 'text_type'=>1, 104 'text_type'=>1,
99 'title'=>'', 105 'title'=>'',
100 'sort'=>1, 106 'sort'=>1,
101 - 'content'=>json_encode(['content'=>$v['describe']],true), 107 + 'content'=>json_encode(['content'=>$v['describe'][0]['text'],'title'=>$v['describe'][0]['title'] ?? ''],true),
102 'created_at'=>date('Y-m-d H:i:s'), 108 'created_at'=>date('Y-m-d H:i:s'),
103 'updated_at'=>date('Y-m-d H:i:s') 109 'updated_at'=>date('Y-m-d H:i:s')
104 ]; 110 ];
105 $detailModel->insert($data); 111 $detailModel->insert($data);
  112 + }else{
  113 + $detailModel->edit(['content'=>json_encode(['content'=>$v['describe'][0]['text'],'title'=>$v['describe'][0]['title'] ?? ''],true)],['id'=>$v['id']]);
106 } 114 }
107 } 115 }
108 }else{ 116 }else{