1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace app\admin\controller;
- use app\common\controller\Backend;
- use think\Controller;
- class Rewardcollect extends Backend{
- protected $admin_id;
- protected $type = 1; //type=1自身 ,type=2 渠道商下属,type=3 代理商下属
- protected $adminInfo;
- public function _initialize()
- {
- parent::_initialize();
- $this->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();
- }
- }
|