admin_id = $this->auth->id; if(!empty($this->request->get('aid'))){ //渠道商查看某个代理商 $this->admin_id = $this->request->get('aid'); $this->type = 2; } if(!empty($this->request->get('caid'))){ $this->admin_id = $this->request->get('caid'); $this->type = 3; } $this->adminInfo = model('admin')->where(['id'=>intval($this->admin_id)])->find(); $this->assign('nickname',$this->adminInfo->nickname); $this->assign('type',$this->type); } //赏金统计 public function recollect(){ $today = date('Ymd',time()); $rewardModel = model('RewardCollect'); $res = null; $resAll = null; $resToday = null; if($this->type==3){ //单个被邀请人统计 $condition=[ 'admin_id'=>$this->admin_id, 'type'=>'1', 'flag'=>'1' ]; $conditionAll = [ 'admin_id'=>$this->admin_id, 'type'=>'2', 'flag'=>'1' ]; $conditionToday=[ 'admin_id'=>$this->admin_id, 'createdate'=>$today, 'type'=>'1', 'flag'=>'1' ]; $resToday = $rewardModel->where($conditionToday)->find(); $resAll = $rewardModel->where($conditionAll)->find(); $res = $rewardModel->where($condition)->paginate(10); }else{ //单个邀请人 $condition=[ 'invite_id'=>0, 'admin_id'=>$this->admin_id, 'type'=>'1', 'flag'=>'2' ]; $conditionAll = [ 'invite_id'=>0, 'admin_id'=>$this->admin_id, 'type'=>'2', 'flag'=>'2' ]; $conditionToday=[ 'invite_id'=>0, 'admin_id'=>$this->admin_id, 'createdate'=>$today, 'type'=>'1', 'flag'=>'2' ]; $resToday = $rewardModel->where($conditionToday)->find(); $resAll = $rewardModel->where($conditionAll)->find(); $res = $rewardModel->where($condition)->paginate(10); } $this->assign('resToday',$resToday); $this->assign('resAll',$resAll); $this->assign('res',$res); return $this->fetch(); } }