From feda780069d64479c0c20493603717e100655da9 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Fri, 05 Dec 2025 18:26:25 +0800
Subject: [PATCH] 完成新人专区 完成复购专区 完成见点奖
---
admin/app/supplier/controller/product/Product.php | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/admin/app/supplier/controller/product/Product.php b/admin/app/supplier/controller/product/Product.php
index 15b42c5..1381fc0 100644
--- a/admin/app/supplier/controller/product/Product.php
+++ b/admin/app/supplier/controller/product/Product.php
@@ -43,12 +43,16 @@
*/
public function add($scene = 'add')
{
+ $supplier = SupplierModel::detail($this->getSupplierId());
// get请求
if($this->request->isGet()){
- return $this->getBaseData();
+ return $this->getBaseData($supplier);
}
//post请求
$data = json_decode($this->postData()['params'], true);
+ $data['is_newcomer'] = $supplier['is_newcomer'];
+ $data['is_repurchase'] = $supplier['is_repurchase'];
+ // 添加商品
if($scene == 'copy'){
unset($data['create_time']);
unset($data['sku']['product_sku_id']);
@@ -85,9 +89,9 @@
/**
* 获取基础数据
*/
- public function getBaseData()
+ public function getBaseData($supplier)
{
- return $this->renderSuccess('', array_merge(ProductService::getEditData(null, 'add', $this->getSupplierId()), []));
+ return $this->renderSuccess('', array_merge(ProductService::getEditData(null, 'add', $this->getSupplierId()),['is_newcomer'=>$supplier['is_newcomer'],'is_repurchase'=>$supplier['is_repurchase']]));
}
/**
@@ -104,17 +108,28 @@
*/
public function edit($product_id, $scene = 'edit')
{
+ $supplier = SupplierModel::detail($this->getSupplierId());
if($this->request->isGet()){
$model = ProductModel::detail($product_id);
- return $this->renderSuccess('', array_merge(ProductService::getEditData($model, $scene, $this->getSupplierId()), compact('model')));
+ $is_newcomer = $supplier['is_newcomer'];
+ $is_repurchase = $supplier['is_repurchase'];
+ $supplierName='';
+ if($model['belonging_shop_supplier_id']){
+ $belonging_shop_supplier= SupplierModel::detail($model['belonging_shop_supplier_id']);
+ $supplierName=$belonging_shop_supplier['name'];
+ }
+ return $this->renderSuccess('', array_merge(ProductService::getEditData($model, $scene, $this->getSupplierId()), compact('model','is_newcomer','is_repurchase','supplierName')));
}
if ($scene == 'copy') {
return $this->add($scene);
}
// 商品详情
$model = ProductModel::detail($product_id);
+ $data = json_decode($this->postData()['params'], true);
+ $data['is_newcomer'] = $supplier['is_newcomer'];
+ $data['is_repurchase'] = $supplier['is_repurchase'];
// 更新记录
- if ($model->edit(json_decode($this->postData()['params'], true),$this->getSupplierId())) {
+ if ($model->edit($data,$this->getSupplierId())) {
return $this->renderSuccess('更新成功');
}
return $this->renderError($model->getError() ?: '更新失败');
--
Gitblit v1.9.2