From f3f0dc51e4cf239bc817b1ad239c0ff8b9adcd33 Mon Sep 17 00:00:00 2001
From: 郭静帆 <gjfan@bronet.cn>
Date: Thu, 27 May 2021 10:42:21 +0800
Subject: [PATCH] 本月额外收入

---
 application/api/controller/User.php | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index 3d31084..90bd8d6 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -1597,18 +1597,22 @@ class User extends Api
         $page_num = $this->request->param('page_num', 10, 'intval');
         $is_work = $this->request->param('is_work'); //是否在职:0=否,1=是
         $keyword = $this->request->param('keyword');
-//        $where['pid'] = $user['id'];  //下一级
-        // 下二级
-        $xia_ids = $this->model
-            ->where('pid',$user['id'])
-            ->column('id');
-        if(!empty($xia_ids)){
-            $xia_xia_ids = $this->model
-                ->where('pid','in',$xia_ids)
+        if ($user['lower_num'] == 1){
+            $where['pid'] = $user['id'];  //下一级
+        }
+        if ($user['lower_num'] == 2){
+            // 下二级
+            $xia_ids = $this->model
+                ->where('pid',$user['id'])
                 ->column('id');
-            $xia_ids = $xia_xia_ids ? array_merge($xia_ids,$xia_xia_ids) : $xia_ids;
+            if(!empty($xia_ids)){
+                $xia_xia_ids = $this->model
+                    ->where('pid','in',$xia_ids)
+                    ->column('id');
+                $xia_ids = $xia_xia_ids ? array_merge($xia_ids,$xia_xia_ids) : $xia_ids;
+            }
+            $where['id'] = $xia_ids ? ['in',$xia_ids] : 0;
         }
-        $where['id'] = $xia_ids ? ['in',$xia_ids] : 0;
         if($is_work != ''){
             $where['is_work'] = $is_work;
         }
--
libgit2 0.24.0