作者 lyh

gx脚本更新路由

@@ -115,15 +115,12 @@ class ProductLogic extends BaseLogic @@ -115,15 +115,12 @@ class ProductLogic extends BaseLogic
115 // try { 115 // try {
116 $this->delProductDetail($product_id); 116 $this->delProductDetail($product_id);
117 foreach ($detail as $val){ 117 foreach ($detail as $val){
118 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($val, true) . PHP_EOL, FILE_APPEND);  
119 //查看当前栏目是否存在 118 //查看当前栏目是否存在
120 if(empty($val['column_name'])){ 119 if(empty($val['column_name'])){
121 continue; 120 continue;
122 } 121 }
123 $columnId = $this->getColumnId($product_id,$val['column_name']); 122 $columnId = $this->getColumnId($product_id,$val['column_name']);
124 foreach ($val['data'] as $item){ 123 foreach ($val['data'] as $item){
125 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export(11111, true) . PHP_EOL, FILE_APPEND);  
126 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($item, true) . PHP_EOL, FILE_APPEND);  
127 $save_data = $this->handleDetailParam($columnId['column_id'],$product_id,$item); 124 $save_data = $this->handleDetailParam($columnId['column_id'],$product_id,$item);
128 $this->model->add($save_data); 125 $this->model->add($save_data);
129 } 126 }
@@ -160,7 +157,7 @@ class ProductLogic extends BaseLogic @@ -160,7 +157,7 @@ class ProductLogic extends BaseLogic
160 public function getColumnId($product_id,$column_name){ 157 public function getColumnId($product_id,$column_name){
161 $columnModel = new Column(); 158 $columnModel = new Column();
162 $columnInfo = $columnModel->read(['column_name'=>strtolower($column_name),'product_id'=>$product_id]); 159 $columnInfo = $columnModel->read(['column_name'=>strtolower($column_name),'product_id'=>$product_id]);
163 - if($columnInfo['id'] != 1){ 160 + if($columnInfo === false || $columnInfo['id'] != 1){
164 $column_id = $columnModel->addReturnId(['column_name'=>$column_name,'product_id'=>$product_id]); 161 $column_id = $columnModel->addReturnId(['column_name'=>$column_name,'product_id'=>$product_id]);
165 }else{ 162 }else{
166 $column_id = 1; 163 $column_id = 1;