*/ class ProvideController extends ThinkController { const model_name = 'Provide'; public function lists(){ if(isset($_REQUEST['user_account'])){ $map['user_account']=array('like','%'.trim($_REQUEST['user_account']).'%'); unset($_REQUEST['user_account']); } if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); unset($_REQUEST['time-start']);unset($_REQUEST['time-end']); }elseif(isset($_REQUEST['time-start'])){ $map['create_time'] = ['GT',strtotime(I('time-start'))]; unset($_REQUEST['time-start']); }elseif(isset($_REQUEST['time-end'])){ $map['create_time'] = ['LT',strtotime(I('time-end'))+86399]; unset($_REQUEST['time-end']); } if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); unset($_REQUEST['start']);unset($_REQUEST['end']); }elseif(isset($_REQUEST['start'])){ $map['create_time'] = ['GT',strtotime(I('start'))]; unset($_REQUEST['start']); }elseif(isset($_REQUEST['end'])){ $map['create_time'] = ['LT',strtotime(I('end'))+86399]; unset($_REQUEST['end']); } $game_ids = array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['sdk_version1']), 'id'); if ($game_ids) { $map['game_id'] = ['in', $game_ids]; unset($_REQUEST['game_name'], $_REQUEST['sdk_version1']); } $map['op_account']=session('user_auth')['username']; if(isset($_REQUEST['op_account'])){ if($_REQUEST['op_account']=='请选择'){ unset($_REQUEST['op_account']); }else{ $map['op_account']=$_REQUEST['op_account']; unset($_REQUEST['op_account']); } } if(is_numeric($_REQUEST['status']) && ($_REQUEST['status']==0 || $_REQUEST['status']==1)) { $map['status'] = $_REQUEST['status']; unset($_REQUEST['status']); } $map1=$map; $map1['status']=1; $total=null_to_0(D(self::model_name)->where($map1)->sum('amount')); $ttotal=null_to_0(D(self::model_name)->where('create_time'.total(1))->where(array('status'=>1))->sum('amount')); $ytotal=null_to_0(D(self::model_name)->where('create_time'.total(5))->where(array('status'=>1))->sum('amount')); // $this->assign('dtotal',$dtotal); $this->assign('total',$total); $this->assign('ttotal',$ttotal); $this->assign('ytotal',$ytotal); $this->m_title = '绑币发放(玩家)'; $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Provide/bdfirstpay','status'=>1])->find()); parent::order_lists(self::model_name,$_GET["p"],$map); } public function bdfirstpay(){ if(IS_POST){ $type = $_REQUEST['type']; $firstpay = A('Firstpay','Event'); switch ($type) { case 1: $firstpay->add1(); break; case 2: $firstpay->add2(); break; case 3: $firstpay->add3(); break; } } else{ $this->meta_title ="绑币发放"; $this->m_title = '绑币发放(玩家)'; $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Provide/bdfirstpay','status'=>1])->find()); $this->display(); } } public function batch($ids=''){ if (empty($ids)) { $this->error('请选择要操作的数据!'); } $list=M("provide","tab_"); $map['id']=array("in",$ids); $map['status']=0; $pro=$list->where($map)->select(); for ($i=0; $i field('puid')->where(['id'=>$pro[$i]['user_id']])->find(); if(!empty($puid) && $puid['puid']>0) { $maps['user_id']=$puid['puid']; } else { $maps['user_id']=$pro[$i]['user_id']; } $maps['game_id']=$pro[$i]['game_id']; $user=M("UserPlay","tab_")->where($maps)->setInc("bind_balance",$pro[$i]['amount']); $list->where($map)->setField("status",1); //操作日志 addOperationLog(array( "op_type"=>1, "key"=> $pro[$i]['pay_order_number'], "url"=>U("Provide/lists",array("user_account"=>$pro[$i]['user_account'])) )); } $this->success("充值成功",U("lists",array('type'=>2))); } public function delprovide($ids=''){ if (empty($ids)) { $this->error('请选择要操作的数据!'); } $list=M("provide","tab_"); $map['id']=array("in",$ids); $map['status']=0; //操作日志 $sre = $list->where($map)->select(); $delete=$list->where($map)->delete(); if($delete){ foreach ($sre as $k => $v) { addOperationLog(array( "op_type"=>2, "key"=> $v['pay_order_number'], "url"=>U("Provide/lists",array("user_account"=>$v['user_account'])) )); } $this->success("批量删除成功!",U("lists",array('type'=>2))); }else{ $this->error("批量删除失败!",U("lists",array('type'=>2))); } } }