Kaynağa Gözat

Merge branch 'dev-sc-260204'

shichen 5 ay önce
ebeveyn
işleme
230c9bc3fa

+ 4 - 4
app/common/dao/shared/SharedProsperityUserDao.php

@@ -161,9 +161,9 @@ class SharedProsperityUserDao extends BaseDao
161 161
      * @param int $userId
162 162
      * @return float
163 163
      */
164
-    public function getTeamPvSum(int $userId): float
164
+    public function getTeamPvSum(int $userId, int $hierarchy = CommonEnum::ORDER_EARNING_ALLOCATION['SharedProsperity']['Hierarchy']['code']): float
165 165
     {
166
-        $userIds = $this->getAllSubordinateUserIds($userId, false);
166
+        $userIds = $this->getAllSubordinateUserIds($userId, false, $hierarchy);
167 167
         if (empty($userIds)) {
168 168
             return 0.0;
169 169
         }
@@ -184,9 +184,9 @@ class SharedProsperityUserDao extends BaseDao
184 184
      * @param int $userId
185 185
      * @return float
186 186
      */
187
-    public function getTeamPvSumWithSelf(int $userId): float
187
+    public function getTeamPvSumWithSelf(int $userId, $self = false): float
188 188
     {
189
-        $userIds = $this->getAllSubordinateUserIds($userId, true);
189
+        $userIds = $this->getAllSubordinateUserIds($userId, $self);
190 190
         if (empty($userIds)) {
191 191
             return 0.0;
192 192
         }

+ 5 - 5
app/common/repositories/shared/SharedProsperityUserRepository.php

@@ -189,7 +189,7 @@ class SharedProsperityUserRepository extends BaseRepository
189 189
         $list = $this->dao->getDirectByUserId($userId);
190 190
         if (empty($list)) {
191 191
             // 没有直推用户,仍然返回统计数据(我的部门总人数和总业绩)
192
-            $myTeamUserIds = $this->dao->getAllSubordinateUserIds($userId, true);
192
+            $myTeamUserIds = $this->dao->getAllSubordinateUserIds($userId);
193 193
             $myTeamTotalCount = count($myTeamUserIds);
194 194
             $myTeamPvSum = $this->dao->getTeamPvSumWithSelf($userId);
195 195
             return [
@@ -222,9 +222,9 @@ class SharedProsperityUserRepository extends BaseRepository
222 222
         $maxPv = 0;
223 223
         $maxPvIndex = -1;
224 224
         foreach ($list as $index => &$item) {
225
-            $teamUserIds = $this->dao->getAllSubordinateUserIds($item['user_id'], true);
225
+            $teamUserIds = $this->dao->getAllSubordinateUserIds($item['user_id'],false,4);
226 226
             $teamTotalCount = count($teamUserIds);
227
-            $teamPvSum = $this->dao->getTeamPvSumWithSelf($item['user_id']);
227
+            $teamPvSum = $this->dao->getTeamPvSum($item['user_id'],4);
228 228
             $item['team_total_count'] = $teamTotalCount;
229 229
             $item['team_pv_sum'] = $teamPvSum;
230 230
             // 补充用户信息
@@ -259,9 +259,9 @@ class SharedProsperityUserRepository extends BaseRepository
259 259
             $smallDepartment = $list;
260 260
         }
261 261
         // 计算统计数据
262
-        $myTeamUserIds = $this->dao->getAllSubordinateUserIds($userId, true);
262
+        $myTeamUserIds = $this->dao->getAllSubordinateUserIds($userId);
263 263
         $myTeamTotalCount = count($myTeamUserIds);
264
-        $myTeamPvSum = $this->dao->getTeamPvSumWithSelf($userId);
264
+        $myTeamPvSum = $this->dao->getTeamPvSum($userId);
265 265
         $smallDepartmentPvSum = 0;
266 266
         foreach ($smallDepartment as $item) {
267 267
             $smallDepartmentPvSum += $item['team_pv_sum'];