|
@@ -20,6 +20,7 @@ use think\Session; |
|
@@ -20,6 +20,7 @@ use think\Session; |
20
|
class OrderSalesmanController extends WeChatBaseController
|
20
|
class OrderSalesmanController extends WeChatBaseController
|
21
|
{
|
21
|
{
|
22
|
protected $user_id;
|
22
|
protected $user_id;
|
|
|
23
|
+ protected $my_user;
|
23
|
protected $status;
|
24
|
protected $status;
|
24
|
protected $pid;
|
25
|
protected $pid;
|
25
|
protected $beforeActionList = [
|
26
|
protected $beforeActionList = [
|
|
@@ -29,16 +30,16 @@ class OrderSalesmanController extends WeChatBaseController |
|
@@ -29,16 +30,16 @@ class OrderSalesmanController extends WeChatBaseController |
29
|
protected function check() {
|
30
|
protected function check() {
|
30
|
$user_id = cmf_get_current_user_id();
|
31
|
$user_id = cmf_get_current_user_id();
|
31
|
$this->user_id = $user_id;
|
32
|
$this->user_id = $user_id;
|
32
|
- $my_user = Db::name('my_user')->where(['uid'=>$user_id])->find();
|
|
|
33
|
- if(empty($my_user)){
|
33
|
+ $this->my_user = Db::name('my_user')->where(['uid'=>$user_id])->find();
|
|
|
34
|
+ if(empty($this->my_user)){
|
34
|
$this->error('查无此人','','','');
|
35
|
$this->error('查无此人','','','');
|
35
|
}
|
36
|
}
|
36
|
- $this->status = $my_user['status'];
|
|
|
37
|
- $this->pid = $my_user['id'];
|
|
|
38
|
- if($my_user['status'] != 2 && $my_user['status'] != 3){
|
37
|
+ $this->status = $this->my_user['status'];
|
|
|
38
|
+ $this->pid = $this->my_user['id'];
|
|
|
39
|
+ if($this->my_user['status'] != 2 && $this->my_user['status'] != 3){
|
39
|
$this->error('您还没有权限查看','','','');
|
40
|
$this->error('您还没有权限查看','','','');
|
40
|
}
|
41
|
}
|
41
|
- $this->assign('my_user',$my_user);
|
42
|
+ $this->assign('my_user',$this->my_user);
|
42
|
}
|
43
|
}
|
43
|
public function get_all(){
|
44
|
public function get_all(){
|
44
|
$param = $this->request->param();
|
45
|
$param = $this->request->param();
|
|
@@ -78,7 +79,12 @@ class OrderSalesmanController extends WeChatBaseController |
|
@@ -78,7 +79,12 @@ class OrderSalesmanController extends WeChatBaseController |
78
|
$goods_count[$key]['number_sum'] = $number_sum;
|
79
|
$goods_count[$key]['number_sum'] = $number_sum;
|
79
|
}
|
80
|
}
|
80
|
$this->assign('goods_count',$goods_count);
|
81
|
$this->assign('goods_count',$goods_count);
|
81
|
- $school = Db::name('school')->where('uid',$user_id)->order('create_time desc')->select()->toArray();
|
82
|
+ // 身份为老师,获取上级业务员的id
|
|
|
83
|
+ $school_uid = $user_id;
|
|
|
84
|
+ if($this->my_user['status'] == 3) {
|
|
|
85
|
+ $school_uid = Db::name('my_user')->where('id',$this->my_user['pid'])->value('uid');
|
|
|
86
|
+ }
|
|
|
87
|
+ $school = Db::name('school')->where('uid',$school_uid)->order('create_time desc')->select()->toArray();
|
82
|
if(count($school)!=0){
|
88
|
if(count($school)!=0){
|
83
|
$schools = [];
|
89
|
$schools = [];
|
84
|
foreach ($school as $key => $val){
|
90
|
foreach ($school as $key => $val){
|
|
@@ -133,7 +139,12 @@ class OrderSalesmanController extends WeChatBaseController |
|
@@ -133,7 +139,12 @@ class OrderSalesmanController extends WeChatBaseController |
133
|
// $where['is_courier'] = ['eq',1];
|
139
|
// $where['is_courier'] = ['eq',1];
|
134
|
// }//
|
140
|
// }//
|
135
|
$user_id = $this->user_id;
|
141
|
$user_id = $this->user_id;
|
136
|
- $where['salesman_uid'] = ['eq',$user_id];
|
142
|
+ // 身份为老师,获取上级业务员的id
|
|
|
143
|
+ $school_uid = $user_id;
|
|
|
144
|
+ if($this->my_user['status'] == 3) {
|
|
|
145
|
+ $school_uid = Db::name('my_user')->where('id',$this->my_user['pid'])->value('uid');
|
|
|
146
|
+ }
|
|
|
147
|
+ $where['salesman_uid'] = ['eq',$school_uid];
|
137
|
$where['indent_type'] = ['eq',2];
|
148
|
$where['indent_type'] = ['eq',2];
|
138
|
$indentModel = new IndentModel();
|
149
|
$indentModel = new IndentModel();
|
139
|
$data = $indentModel->selectData($where);
|
150
|
$data = $indentModel->selectData($where);
|