quanwei
2025-12-09 ca425b889f3c1b5847ffc26a0229307f7f8ef43e
admin/app/shop/controller/product/Product.php
@@ -84,7 +84,12 @@
        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('添加成功');
        }
@@ -122,8 +127,15 @@
        }
        // 商品详情
        $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() ?: '更新失败');