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/plus/shareholder/Apply.php |   82 ++++++-----------------------------------
 1 files changed, 12 insertions(+), 70 deletions(-)

diff --git a/admin/app/common/model/plus/shareholder/Apply.php b/admin/app/common/model/plus/shareholder/Apply.php
index a266726..8df71c5 100644
--- a/admin/app/common/model/plus/shareholder/Apply.php
+++ b/admin/app/common/model/plus/shareholder/Apply.php
@@ -6,9 +6,7 @@
 use app\common\model\plus\agent\User as AgentUserModel;
 use app\common\model\plus\team\User as TeamUserModel;
 use app\common\model\plus\team\Order as TeamOrderModel;
-use app\common\model\plus\vip\User as VipUserModel;
-use app\common\model\plus\vip\Order as VipOrderModel;
-
+use app\common\model\plus\team\Referee as TeamRefereeModel;
 /**
  * 股东申请模型
  */
@@ -150,6 +148,16 @@
                 $becomeShareholder = true;
             }
         }
+        if ($config['become'] == '110'){
+            $subordinateUserId=(new TeamRefereeModel())->where(['heads_id'=>$userId])->column('user_id');
+            $subordinateUserId[]=$userId;
+            $vipNum=(new \app\common\model\user\User)->getRefereeGradeCount($subordinateUserId,$config['referee_grade_ids']);
+            $supplierNum=(new \app\common\model\supplier\Supplier())->getSubordinateNum($subordinateUserId);
+            $user=(new \app\common\model\user\User)->where(['user_id'=>$userId,'is_delete'=>0])->find();
+            if ($vipNum >= $config['totalvip_down'] && $supplierNum >= $config['totalsh_down']&&$user['purchase_count']>=$config['purchase_count']){
+                $becomeShareholder = true;
+            }
+        }
         // 新增股东用户
         if ($becomeShareholder) {
             User::add($userId, [
@@ -182,70 +190,4 @@
         return ['text' => $method[$value], 'value' => $value];
     }
 
-    /**
-     * 统计VIP会员直接推荐数量
-     * @param $userId
-     * @return int
-     */
-    public function countVipRecommendations($userId)
-    {
-        return VipUserModel::where('referee_id', '=', $userId)->count();
-    }
-
-    /**
-     * 统计企业商户入驻数量
-     * @param $userId
-     * @return int
-     */
-    public function countMerchantSettlements($userId)
-    {
-        // 假设商家入驻与推广团队的关联字段是referee_id
-        // 需要根据实际数据库结构调整
-        return \app\common\model\Shop::where('referee_id', '=', $userId)->count();
-    }
-
-    /**
-     * 统计VIP专区商品购买次数
-     * @param $userId
-     * @return int
-     */
-    public function countSelfVipPurchases($userId)
-    {
-        return VipOrderModel::where('user_id', '=', $userId)
-            ->where('is_vip', '=', 1)
-            ->count();
-    }
-
-    /**
-     * 检查股东候选人是否满足新的三个条件
-     * @param $userId
-     * @param $appId
-     * @return bool
-     */
-    public function checkNewShareholderConditions($userId, $appId)
-    {
-        $config = Setting::getItem('basic', $appId);
-        
-        // 1. 检查VIP会员直接推荐数量
-        $vipRecommendCount = $this->countVipRecommendations($userId);
-        if ($vipRecommendCount < $config['vip_recommend_count']) {
-            return false;
-        }
-        
-        // 2. 检查企业商户入驻数量
-        $merchantCount = $this->countMerchantSettlements($userId);
-        if ($merchantCount < $config['merchant_settle_count']) {
-            return false;
-        }
-        
-        // 3. 检查VIP专区商品购买次数
-        $selfVipPurchaseCount = $this->countSelfVipPurchases($userId);
-        if ($selfVipPurchaseCount < $config['self_vip_purchase_count']) {
-            return false;
-        }
-        
-        // 所有条件都满足
-        return true;
-    }
-
-},
\ No newline at end of file
+}
\ No newline at end of file

--
Gitblit v1.9.2