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/common/model/supplier/Supplier.php |   63 ++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/admin/app/common/model/supplier/Supplier.php b/admin/app/common/model/supplier/Supplier.php
index 6383036..dba4dc2 100644
--- a/admin/app/common/model/supplier/Supplier.php
+++ b/admin/app/common/model/supplier/Supplier.php
@@ -3,9 +3,10 @@
 namespace app\common\model\supplier;
 
 use app\common\model\BaseModel;
-use app\shop\model\auth\User as AuthUserModel;
-use app\shop\model\auth\UserRole as UserRoleModel;
 use app\common\model\shop\Role as RoleModel;
+use app\common\model\supplier\member\Member as MemberModel;
+use app\common\model\supplier\PointsLog as PointsLogModel;
+use app\shop\model\auth\UserRole as UserRoleModel;
 
 /**
  * 商家供应商模型
@@ -14,6 +15,7 @@
 {
     protected $name = 'supplier';
     protected $pk = 'shop_supplier_id';
+
 
 
     /**
@@ -81,6 +83,27 @@
         }
         return true;
     }
+
+    /**
+     * 累积商户的可用积分
+     */
+    public function setIncPoints($points, $describe, $decPoints = 0)
+    {
+        // 新增积分变动明细
+        PointsLogModel::add([
+            'shop_supplier_id' => $this['shop_supplier_id'],
+            'value' => $points,
+            'describe' => $describe,
+            'app_id' => $this['app_id'],
+        ]);
+
+        // 更新用户可用积分
+        $data['points'] = ($this['points'] + $points + $decPoints <= 0) ? 0 : $this['points'] + $points + $decPoints;
+        $this->where('branch_id', '=', $this['branch_id'])->update($data);
+        
+        return true;
+    }
+
     //判断营业时间
     public function supplierStatus($shop_supplier_id)
     {
@@ -154,6 +177,14 @@
     }
 
     /**
+     * 获取供应商当前有效的年卡
+     */
+    public function getCurrentMember()
+    {
+        return MemberModel::getCurrentMember($this['shop_supplier_id'], $this['app_id']);
+    }
+    
+    /**
      * 获取角色管理的区域
      */
     public static function getAreaIdsByUser($user)
@@ -215,6 +246,34 @@
             ->find();
         return empty($data['is_independent']) ? 0 : $data['is_independent'];
     }
+    /**
+     * 冻结用户资金
+     */
+    public function freezeMoney($money)
+    {
+        $this->save(['money' => $this['money'] - $money,'freeze_money'=>$this['freeze_money']+$money]);
+    }
+    /**
+     * 直推供应商多少人
+     */
+    public function refereeSupplierCount ($referee_id)
+    {
+        $count = $this->where('referee_id', '=', $referee_id)
+            ->where('is_delete', '=', 0)
+            ->count();
+        return $count;
+    }
 
+    /**
+     * 下级商户数量
+     * @param $user_id
+     * @return int
+     */
+    public function getSubordinateNum($user_id)
+    {
+        return (new static())->where('is_delete', '=', 0)
+            ->where('referee_id', 'in', $user_id)
+            ->count();
+    }
 
 }
\ No newline at end of file

--
Gitblit v1.9.2