正在显示
1 个修改的文件
包含
3 行增加
和
1 行删除
| @@ -114,10 +114,12 @@ class ProductController extends BaseController | @@ -114,10 +114,12 @@ class ProductController extends BaseController | ||
| 114 | 'content'=>$this->param['content'] ?? '', | 114 | 'content'=>$this->param['content'] ?? '', |
| 115 | 'thumb'=>json_encode($thumb,true), | 115 | 'thumb'=>json_encode($thumb,true), |
| 116 | 'gallery'=>json_encode($gallery,true), | 116 | 'gallery'=>json_encode($gallery,true), |
| 117 | - 'category_id'=>$category_id, | ||
| 118 | 'created_at'=>date('Y-m-d H:i:s'), | 117 | 'created_at'=>date('Y-m-d H:i:s'), |
| 119 | 'updated_at'=>date('Y-m-d H:i:s') | 118 | 'updated_at'=>date('Y-m-d H:i:s') |
| 120 | ]; | 119 | ]; |
| 120 | + if(!empty($category_id)){ | ||
| 121 | + $productData['category_id'] = $category_id; | ||
| 122 | + } | ||
| 121 | $product_id = $productModel->addReturnId($productData); | 123 | $product_id = $productModel->addReturnId($productData); |
| 122 | $route = RouteMap::setRoute($productData['title'], RouteMap::SOURCE_PRODUCT, $product_id, $this->param['project_id']); | 124 | $route = RouteMap::setRoute($productData['title'], RouteMap::SOURCE_PRODUCT, $product_id, $this->param['project_id']); |
| 123 | $productModel->edit(['route'=>$route],['id'=>$cate_id]); | 125 | $productModel->edit(['route'=>$route],['id'=>$cate_id]); |
-
请 注册 或 登录 后发表评论