From abc7edc3c8ad59ff213c85413d0d6a10d7a0b6f7 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Wed, 17 Dec 2025 18:03:09 +0800
Subject: [PATCH] 1. 发布供需消耗连盟币,连盟币数量在后台独立设置 2. 小程序供需个人中心可自由切换身份 3. 增加私信系统 4. 增加评论系统,用户可在发布者详情页进行评论操作,评论获得的连盟币可在后台设置 5. 增加发布者的等级,以好评个数为条件进行升级,小程序端会显示该等级的图标,如没有等级则不会显示图标 6. 增加设置消耗连盟币可以解锁、查看发布的信息,费用可在后台设置 7. 小程序供需大厅界面优化,以及增加了推荐栏目,该栏目按发布的分类相似进行匹配,比如A用户发布了 互联网 分类的需求,则会优先推荐匹配互联网分类的供应需求给他。
---
admin/app/supplier/controller/product/Product.php | 34 +++++++++++++++++++++++++++-------
1 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/admin/app/supplier/controller/product/Product.php b/admin/app/supplier/controller/product/Product.php
index 15b42c5..865c090 100644
--- a/admin/app/supplier/controller/product/Product.php
+++ b/admin/app/supplier/controller/product/Product.php
@@ -4,10 +4,11 @@
use app\common\model\settings\Setting;
use app\supplier\model\product\Product as ProductModel;
-use app\common\model\product\Category as CategoryModel;
+use app\supplier\model\product\Category as CategoryModel;
use app\supplier\service\ProductService;
use app\supplier\model\supplier\Supplier as SupplierModel;
use app\supplier\controller\Controller;
+use think\facade\Cache;
/**
* 商品管理控制器
@@ -24,7 +25,8 @@
$model = new ProductModel;
$list = $model->getList(array_merge(['status' => -1, 'shop_supplier_id' => $this->getSupplierId()], $this->postData()));
// 商品分类
- $category = CategoryModel::getCacheTree();
+ $category = CategoryModel::getSupplierCacheTree($this->getSupplierId());
+
// 数量
$product_count = [
'sell' => $model->getCount('sell', $this->getSupplierId()),
@@ -43,12 +45,17 @@
*/
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'];
+ $data['is_vip'] = $supplier['is_vip'];
+ // 添加商品
if($scene == 'copy'){
unset($data['create_time']);
unset($data['sku']['product_sku_id']);
@@ -85,9 +92,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'],'is_vip'=>$supplier['is_vip']]));
}
/**
@@ -104,17 +111,30 @@
*/
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'];
+ $is_vip = $supplier['is_vip'];
+ $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','is_vip','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'];
+ $data['is_vip'] = $supplier['is_vip'];
// 更新记录
- 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