From e1e2fe5710a5b5cd9c19bd3aa99c998a1a613ca8 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Sat, 17 Jan 2026 17:58:01 +0800
Subject: [PATCH] 团购组件增加筛选

---
 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