From c88485c33a08f8213ac6622d005f0112a90492f2 Mon Sep 17 00:00:00 2001
From: 刘朕 <liuzhen@bronet.cn>
Date: Wed, 18 Sep 2019 13:29:41 +0800
Subject: [PATCH] 教师订单列表筛选调整

---
 app/portal/controller/OrderSalesmanController.php | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/app/portal/controller/OrderSalesmanController.php b/app/portal/controller/OrderSalesmanController.php
index e1b142a..3cdf54e 100644
--- a/app/portal/controller/OrderSalesmanController.php
+++ b/app/portal/controller/OrderSalesmanController.php
@@ -141,10 +141,20 @@ class OrderSalesmanController extends WeChatBaseController
         $user_id = $this->user_id;
         // 身份为老师,获取上级业务员的id
         $school_uid = $user_id;
-        if($this->my_user['status'] == 3) {
-            $school_uid = Db::name('my_user')->where('id',$this->my_user['pid'])->value('uid');
+//        if($this->my_user['status'] == 3) {
+//            $school_uid = Db::name('my_user')->where('id',$this->my_user['pid'])->value('uid');
+//        }
+        if($this->status == 2){
+            $where['salesman_uid'] = ['eq',$school_uid];
+        }else{
+            //获取当前用户的所有下级
+            $user_child = Db::name('my_user')->where(['pid'=>$this->pid])->select();
+            $user_ids = [];
+            foreach($user_child as $key => $u_c){
+                $user_ids[] = $u_c['uid'];
+            }
+            $where['uid'] = ['in',$user_ids];
         }
-        $where['salesman_uid'] = ['eq',$school_uid];
         $where['indent_type'] = ['eq',2];
         $indentModel = new IndentModel();
         $data = $indentModel->selectData($where);
--
libgit2 0.24.0