You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
140 lines
5.1 KiB
PHTML
140 lines
5.1 KiB
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
namespace Admin\Controller;
|
||
|
use User\Api\UserApi as UserApi;
|
||
|
|
||
|
/**
|
||
|
* 后台首页控制器
|
||
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||
|
*/
|
||
|
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']);
|
||
|
}
|
||
|
if(isset($_REQUEST['game_name'])){
|
||
|
if($_REQUEST['game_name']=='请选择'){
|
||
|
unset($_REQUEST['game_name']);
|
||
|
}else{
|
||
|
$map['game_name']=$_REQUEST['game_name'];
|
||
|
unset($_REQUEST['game_name']);
|
||
|
}
|
||
|
}
|
||
|
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 <count($pro) ; $i++) {
|
||
|
$puid = M('User','tab_')->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);
|
||
|
}
|
||
|
$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;
|
||
|
$delete=$list->where($map)->delete();
|
||
|
if($delete){
|
||
|
$this->success("批量删除成功!",U("lists",array('type'=>2)));
|
||
|
}else{
|
||
|
$this->error("批量删除失败!",U("lists",array('type'=>2)));
|
||
|
}
|
||
|
}
|
||
|
}
|