| | |
| | | }else{ |
| | | $list = $model->getList(array_merge(['status' => -1,'shop_supplier_ids' => $shop_supplier_ids], $this->postData())); |
| | | } |
| | | |
| | | // 商品分类 |
| | | $category = CategoryModel::getCacheTree(); |
| | | // 数量 |
| | |
| | | if (isset($data['product_id'])) { |
| | | $data['product_id'] = 0; |
| | | } |
| | | |
| | | if (!empty($data['shop_supplier_id'])){ |
| | | $shop_supplier=SupplierModel::detail($data['shop_supplier_id']); |
| | | $data['is_newcomer'] = $shop_supplier['is_newcomer']; |
| | | $data['is_repurchase'] = $shop_supplier['is_repurchase']; |
| | | $data['is_vip'] = $shop_supplier['is_vip']; |
| | | } |
| | | if ($model->add($data)) { |
| | | return $this->renderSuccess('添加成功'); |
| | | } |
| | |
| | | } |
| | | // 商品详情 |
| | | $model = ProductModel::detail($product_id); |
| | | $data = json_decode($this->postData()['params'], true); |
| | | if(!empty($data['shop_supplier_id'])){ |
| | | $shop_supplier=SupplierModel::detail($data['shop_supplier_id']); |
| | | $data['is_newcomer'] = $shop_supplier['is_newcomer']; |
| | | $data['is_repurchase'] = $shop_supplier['is_repurchase']; |
| | | $data['is_vip'] = $shop_supplier['is_vip']; |
| | | } |
| | | // 更新记录 |
| | | if ($model->edit(json_decode($this->postData()['params'], true))) { |
| | | if ($model->edit($data, true)) { |
| | | return $this->renderSuccess('更新成功'); |
| | | } |
| | | return $this->renderError($model->getError() ?: '更新失败'); |