管理后台--更新

master
chenxiaojun 5 years ago
parent 06486d458c
commit 2e7ecfa53c

@ -822,7 +822,7 @@ function get_admin_id($name){
//获取所有用户列表
function get_user_list(){
$user = M('User','tab_');
$list = $user->field('id,account,balance')->select();
$list = $user->field('id,account,balance')->order('id')->select();
return $list;
}

File diff suppressed because it is too large Load Diff

@ -2,6 +2,7 @@
namespace Admin\Controller;
use Admin\Model\UserModel;
use Think\Model;
use Base\Service\PromoteService;
@ -9,233 +10,243 @@ use Base\Service\PromoteService;
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class PromoteCoinController extends ThinkController {
class PromoteCoinController extends ThinkController
{
const model_name = 'PromoteCoin';
const model_name = 'PromoteCoin';
public function send_lists($p=0){
if(empty($_GET['promote_id']&&$_GET['promote_type'])){
$extend['type'] = 1;
$extend['source_id'] = 0;
$map = $extend;
}else{
$extend['promote_id'] = $_GET['promote_id'];
$extend['promote_type'] = $_GET['promote_type'];
public function send_lists($p = 0)
{
if (empty($_GET['promote_id'] && $_GET['promote_type'])) {
$extend['type'] = 1;
$extend['source_id'] = 0;
$map = $extend;
} else {
$extend['promote_id'] = $_GET['promote_id'];
$extend['promote_type'] = $_GET['promote_type'];
}
}
$map['create_time'] = total(1,false);
$map['create_time'] = total(1, false);
$sum['to_day'] = D(self::model_name)->where($map)->sum('num');
$map['create_time'] = total(5,false);
$map['create_time'] = total(5, false);
$sum['yst_day'] = D(self::model_name)->where($map)->sum('num');
$sum['all_num'] = D(self::model_name)->where($extend)->sum('num');
// echo D(self::model_name)->getLastSql();exit;
$this->assign('sum',$sum);
// echo D(self::model_name)->getLastSql();exit;
$this->assign('sum', $sum);
$this->m_title = '平台币发放(推广员)';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'PromoteCoin/send_lists','status'=>1])->find());
$this->m_title = '平台币发放(推广员)';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCoin/send_lists', 'status' => 1])->find());
parent::order_lists(self::model_name,$_GET["p"],$extend);
parent::order_lists(self::model_name, $_GET["p"], $extend);
}
public function deduct_lists($p=0){
if(isset($_GET['type'])&&$_GET['type']==2){
public function deduct_lists($p = 0)
{
if (isset($_GET['type']) && $_GET['type'] == 2) {
$extend['type'] = 2;
$extend['source_id'] = 0;
$map = $extend;
$model_name=self::model_name;
}else{
$model_name="user_coin";
if(isset($_GET['account'])){
$extend['user_account']= array('like','%'.I('account').'%') ;
$model_name = self::model_name;
} else {
$model_name = "user_coin";
if (isset($_GET['account'])) {
$extend['user_account'] = array('like', '%' . I('account') . '%');
}
}
$map['create_time'] = total(1,false);
$map['create_time'] = total(1, false);
$sum['to_day'] = D(self::model_name)->where($map)->sum('num');
$map['create_time'] = total(5,false);
$map['create_time'] = total(5, false);
$sum['yst_day'] = D(self::model_name)->where($map)->sum('num');
$model_name = empty($model_name)?self::model_name:$model_name;
$model_name = empty($model_name) ? self::model_name : $model_name;
$sum['all_num'] = D($model_name)->where($extend)->sum('num');
$this->assign('sum',$sum);
$this->m_title = '平台币收回';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'PromoteCoin/deduct_lists','status'=>1])->find());
parent::order_lists($model_name,$_GET["p"],$extend);
$this->assign('sum', $sum);
$this->m_title = '平台币收回';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCoin/deduct_lists', 'status' => 1])->find());
parent::order_lists($model_name, $_GET["p"], $extend);
}
/**
*扣除绑定币记录列表
*/
public function deductBindBanlanList(){
if(isset($_GET['type'])&&$_GET['type']==2){
*扣除绑定币记录列表
*/
public function deductBindBanlanList()
{
if (isset($_GET['type']) && $_GET['type'] == 2) {
$extend['type'] = 2;
$extend['source_id'] = 0;
$map = $extend;
$model_name=self::model_name;
}else{
$model_name="user_coin";
if(isset($_GET['user_id'])){
$extend['user_id']=I('user_id');
$model_name = self::model_name;
} else {
$model_name = "user_coin";
if (isset($_GET['user_id'])) {
$extend['user_id'] = I('user_id');
}
}
$map['create_time'] = total(1,false);
$map['create_time'] = total(1, false);
$sum['to_day'] = D(self::model_name)->where($map)->sum('num');
$map['create_time'] = total(5,false);
$map['create_time'] = total(5, false);
$sum['yst_day'] = D(self::model_name)->where($map)->sum('num');
$sum['all_num'] = D(self::model_name)->where($extend)->sum('num');
$this->assign('sum',$sum);
parent::order_lists($model_name,$_GET["p"],$extend);
$this->assign('sum', $sum);
parent::order_lists($model_name, $_GET["p"], $extend);
}
/**
* 发放平台币
*/
public function send(){
public function send()
{
$this->m_title = '平台币发放(推广员)';
$this->assign('commonset', M('Kuaijieicon')->where(['url'=>'PromoteCoin/send_lists','status'=>1])->find());
$this->add(1,'send_lists',2);
}
public function deduct(){
$this->m_title = '平台币收回';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'PromoteCoin/deduct_lists','status'=>1])->find());
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCoin/send_lists', 'status' => 1])->find());
$this->add(1, 'send_lists', 2);
}
$this->add(2,'deduct_lists',$_REQUEST['typee']?$_REQUEST['typee']:1);
public function deduct()
{
$this->m_title = '平台币收回';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCoin/deduct_lists', 'status' => 1])->find());
$this->add(2, 'deduct_lists', $_REQUEST['typee'] ? $_REQUEST['typee'] : 1);
}
public function add($type,$url,$tt=1)
public function add($type, $url, $tt = 1)
{
$model = M('Model')->getByName(self::model_name);
$model || $this->error('模型不存在!');
if(IS_POST){
if (IS_POST) {
//验证二级密码
$pwd = I('second_pwd');
$res = D('Member')->check_sc_pwd($pwd);
if(!$res){
if (!$res) {
$this->error('二级密码错误');
}
$model_name=$tt==1?"UserCoin":"PromoteCoin";
$model_name = $tt == 1 ? "UserCoin" : "PromoteCoin";
$res = D($model_name)->create();
if (!$res){
if (!$res) {
$this->error(D($model_name)->getError());
}
//平台币修改
if($tt==1){
$res = D('User')->edit_user_balance_coin(I('user_id'),abs(I('num')));
}else{
if ($tt == 1) {
$res = D('User')->edit_user_balance_coin(I('user_id'), abs(I('num')));
} else {
$promoteService = new PromoteService();
if ($type == 1) {
$res = $promoteService->adminIncCoin(I('promote_id'), abs(I('num')), session('user_auth.uid'));
} elseif ($type == 2) {
$res = $promoteService->adminDecCoin(I('promote_id'), abs(I('num')), session('user_auth.uid'));
$res = $promoteService->adminDecCoin(I('promote_id'), abs(I('num')), session('user_auth.uid'));
}
}
if($res){
$this->success('操作成功!', U($url,array('model'=>$model['name'],'type'=>$tt)));
if ($res) {
$this->success('操作成功!', U($url, array('model' => $model['name'], 'type' => $tt)));
} else {
$this->error('操作失败!',U($url,array('model'=>$model['name'],'type'=>$tt)));
$this->error('操作失败!', U($url, array('model' => $model['name'], 'type' => $tt)));
}
} else {
$fields = get_model_attribute($model['id']);
$this->assign('model', $model);
$this->assign('fields', $fields);
$this->meta_title = '平台币操作';
$this->display($model['template_add']?$model['template_add']:'');
$this->display($model['template_add'] ? $model['template_add'] : '');
}
}
/**
* 平台币转移记录
*/
public function record($p=0){
public function record($p = 0)
{
$extend['type'] = 2;
$extend['source_id'] = ['neq',0];
$extend['source_id'] = ['neq', 0];
if(isset($_REQUEST['promote_id'])) {$extend['promote_id'] = $_REQUEST['promote_id'];}
$source_ids = [];
if (!empty($_REQUEST['source_id'])) $source_ids[] = $_REQUEST['source_id'];
if (!empty($_REQUEST['grand_id'])) $source_ids[] = $_REQUEST['grand_id'];
if (!empty($_REQUEST['child_id'])) $source_ids[] = $_REQUEST['child_id'];
if (!empty($source_ids)) $extend['source_id'] = ['in', $source_ids];
if (isset($_REQUEST['promote_id'])) {
$extend['promote_id'] = $_REQUEST['promote_id'];
}
$source_ids = [];
if (!empty($_REQUEST['source_id'])) $source_ids[] = $_REQUEST['source_id'];
if (!empty($_REQUEST['grand_id'])) $source_ids[] = $_REQUEST['grand_id'];
if (!empty($_REQUEST['child_id'])) $source_ids[] = $_REQUEST['child_id'];
if (!empty($source_ids)) $extend['source_id'] = ['in', $source_ids];
$map = $extend;
$map['create_time'] = total(1,false);
$map['create_time'] = total(1, false);
$sum['to_day'] = D(self::model_name)->where($map)->sum('num');
$map['create_time'] = total(5,false);
$map['create_time'] = total(5, false);
$sum['yst_day'] = D(self::model_name)->where($map)->sum('num');
$sum['all_num'] = D(self::model_name)->where($extend)->sum('num');
$this->assign('sum',$sum);
$this->assign('sum', $sum);
$this->meta_title = '平台币转移记录';
$this->m_title = '平台币转移记录';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'PromoteCoin/record','status'=>1])->find());
$this->m_title = '平台币转移记录';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'PromoteCoin/record', 'status' => 1])->find());
/* //parent::order_lists(self::model_name,$_GET["p"],$extend); */
$page = intval($p);
$page = intval($p);
$page = $page ? $page : 1;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
$pc = D(self::model_name);
$pc = D(self::model_name);
$data=$pc->alias('c')
->field('c.*,p.account as source_name, p.parent_id, p.level')
->join('tab_promote p on c.source_id = p.id', 'left')
->where($extend)
->order('id desc')
->page($page,$row)
->select();
$data = $pc->alias('c')
->field('c.*,p.account as source_name, p.parent_id, p.level')
->join('tab_promote p on c.source_id = p.id', 'left')
->where($extend)
->order('id desc')
->page($page, $row)
->select();
$count = $pc->where($extend)->count();
$count = $pc->where($extend)->count();
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('list_data', $data);
$this->assign('list_data', $data);
$this->display();
$this->display();
}
//获取线下充值列表
public function offlineList($p=0)
public function offlineList($p = 0)
{
//获取记录
$map = array();
$map['pay_type'] = 2;
$map['is_del'] = 0;
//其他条件查询
if(isset($_REQUEST['promote_account'])){
$map['promote_account']=array('like','%'.trim($_REQUEST['promote_account']).'%');
unset($_REQUEST['promote_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'))];
if (isset($_REQUEST['promote_account'])) {
$map['promote_account'] = array('like', '%' . trim($_REQUEST['promote_account']) . '%');
unset($_REQUEST['promote_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];
} elseif (isset($_REQUEST['time-end'])) {
$map['create_time'] = ['LT', strtotime(I('time-end')) + 86399];
unset($_REQUEST['time-end']);
}
if(isset($_REQUEST['order_status'])){
$map['order_status']=$_REQUEST['order_status'];
if (isset($_REQUEST['order_status'])) {
$map['order_status'] = $_REQUEST['order_status'];
unset($_REQUEST['order_status']);
}
$data = D("CoinPayOrder")->lists($_GET["p"], $map, $order);
@ -243,14 +254,15 @@ class PromoteCoinController extends ThinkController {
//执行查询
// parent::order_lists("CoinPayOrder",$_GET["p"],$extend);
$this->meta_title = '线下充值审核列表';
$this->assign('list_data',$data['data']);
$this->assign('_page',$data['page']);
$this->assign('list_data', $data['data']);
$this->assign('_page', $data['page']);
$this->display();
# code...
}
public function offlineOrderInfo()
{
if(!isset($_REQUEST['id'])){
if (!isset($_REQUEST['id'])) {
exit("参数错误");
}
$id = $_REQUEST['id'];
@ -260,31 +272,33 @@ class PromoteCoinController extends ThinkController {
$this->display();
# code...
}
//审核通过
public function offlineAgree()
{
if(!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1){
if (!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1) {
exit("参数错误");
}
$ids = I("ids");
$count = count($ids);
//执行操作
for ($i=0; $i <$count; $i++) {
for ($i = 0; $i < $count; $i++) {
$this->doOfflineAgree($ids[$i]);
}
$this->success("批量通过成功");
# code...
}
//批量审核拒绝
public function offlineReject()
{
if(!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1){
if (!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1) {
exit("参数错误");
}
$ids = I("ids");
$count = count($ids);
//执行操作
for ($i=0; $i <$count; $i++) {
for ($i = 0; $i < $count; $i++) {
$this->orderReject($ids[$i]);
}
$this->success("批量拒绝成功");
@ -295,77 +309,110 @@ class PromoteCoinController extends ThinkController {
{
//获取记录
$order = D("CoinPayOrder")->info($id);
if($order['order_status'] != 2){
if ($order['order_status'] != 2) {
return;
}
//
$balance_map['promote_id'] = $order['promote_id'];
$balance_map['game_id'] = 0;
$balance = M('promote_balance_coin', 'tab_')->where($balance_map)->find();
$this->balance_coin_update($order,$balance);//更新汇总
$this->coin_record_add($order,$balance); //添加流水
$this->balance_coin_update($order, $balance);//更新汇总
$this->coin_record_add($order, $balance); //添加流水
$this->promote_balance_coin_update($order); //更新推广员平台币余额
$this->orderAgree($id);//更新表
}
public function orderReject($id)
{
$order = D("CoinPayOrder")->info($id);
if($order['order_status'] != 2){
if ($order['order_status'] != 2) {
return;
}
$savedata = array();
$auth = $_SESSION['onethink_admin']['user_auth'];
$savedata['auditor_id']=$auth['uid'];
$savedata['auditor_account']=$auth['username'];
$savedata['auditor_time']=time();
$savedata['order_status']=-1;
D("CoinPayOrder")->updateData($savedata,$id);
$savedata['auditor_id'] = $auth['uid'];
$savedata['auditor_account'] = $auth['username'];
$savedata['auditor_time'] = time();
$savedata['order_status'] = -1;
D("CoinPayOrder")->updateData($savedata, $id);
# code...
}
public function orderAgree($id)
{
$savedata = array();
$auth = $_SESSION['onethink_admin']['user_auth'];
$savedata['auditor_id']=$auth['uid'];
$savedata['auditor_account']=$auth['username'];
$savedata['auditor_time']=time();
$savedata['order_status']=4;
D("CoinPayOrder")->updateData($savedata,$id);
$savedata['auditor_id'] = $auth['uid'];
$savedata['auditor_account'] = $auth['username'];
$savedata['auditor_time'] = time();
$savedata['order_status'] = 4;
D("CoinPayOrder")->updateData($savedata, $id);
# code...
}
// 添加流水
public function coin_record_add($order,$balance){
$data['sn']=date('Ymd') . date('His') . sp_random_num(6);
$data['type']=1;
$data['sub_type'] =1;
// 添加流水
public function coin_record_add($order, $balance)
{
$data['sn'] = date('Ymd') . date('His') . sp_random_num(6);
$data['type'] = 1;
$data['sub_type'] = 1;
$data['target_id'] = $order['promote_id'];
$data['target_type'] = 1;
$data['ref_id'] = $order['id'];
$data['coin'] = $order['real_amount'];
$data['balance_coin'] = $balance['num']+$order['coin_num'];
$data['balance_coin'] = $balance['num'] + $order['coin_num'];
$data['remark'] = $order['remark'];
$data['create_time']=time();
$data['description']='线下充值';
$data['create_time'] = time();
$data['description'] = '线下充值';
M('promote_coin_record', 'tab_')->data($data)->add();
}
//更新汇总
public function balance_coin_update($order,$balance){
if(!empty($balance)){
public function balance_coin_update($order, $balance)
{
if (!empty($balance)) {
$map['promote_id'] = $order['promote_id'];
$map['game_id'] = 0;
M('promote_balance_coin', 'tab_')->where($map)->setInc('num',$order['coin_num']);
}else{
$balance['promote_id']= $order['promote_id'];
M('promote_balance_coin', 'tab_')->where($map)->setInc('num', $order['coin_num']);
} else {
$balance['promote_id'] = $order['promote_id'];
$balance['game_id'] = 0;
$balance['num']=$order['coin_num'];
$balance['num'] = $order['coin_num'];
M('promote_balance_coin', 'tab_')->data($balance)->add();
}
}
//更新推广员平台币余额
public function promote_balance_coin_update($order){
public function promote_balance_coin_update($order)
{
$map['id'] = $order['promote_id'];
M('promote', 'tab_')->where($map)->setInc('balance_coin',$order['coin_num']);
M('promote', 'tab_')->where($map)->setInc('balance_coin', $order['coin_num']);
}
//玩家账号查询
public function getUserAccount()
{
$account = trim(I('post.account', ''));
if (empty($account)) {
$data['status'] = -1;
$data['msg'] = '请输入玩家账号';
$this->ajaxReturn($data);
}
$map['account'] = $account;
$user = M('user', 'tab_')->field('id,account,balance')->where($map)->find();
if (empty($user)) {
$data['status'] = 0;
$data['msg'] = '该玩家账号不存在';
} else {
$data['status'] = 1;
$data['user'] = $user;
}
$this->ajaxReturn($data);
}
public function checkUsername($account)
{
$model = new UserModel();
return $model->checkUsername($account);
}
}

@ -483,15 +483,15 @@ unset($_REQUEST['parent_id']);
unset($_REQUEST['spend_ip']);
}
if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){
$map['pay_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['pay_time'] = ['GT',strtotime(I('time-start'))];
unset($_REQUEST['time-start']);
}elseif(isset($_REQUEST['time-end'])){
$map['pay_time'] = ['LT',strtotime(I('time-end'))+86399];
unset($_REQUEST['time-end']);
if(isset($_REQUEST['timeStart'])&&isset($_REQUEST['timeEnd'])){
$map['pay_time']=array('BETWEEN',array(strtotime($_REQUEST['timeStart']),strtotime($_REQUEST['timeEnd'])+24*60*60-1));
unset($_REQUEST['timeStart']);unset($_REQUEST['timeEnd']);
}elseif(isset($_REQUEST['timeStart'])){
$map['pay_time'] = ['GT',strtotime(I('timeStart'))];
unset($_REQUEST['timeStart']);
}elseif(isset($_REQUEST['timeEnd'])){
$map['pay_time'] = ['LT',strtotime(I('timeEnd'))+86399];
unset($_REQUEST['timeEnd']);
}
if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
$map['pay_time']=array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));

@ -1,160 +1,156 @@
<?php
namespace Admin\Controller;
class RechargeSumController extends ThinkController{
public function summation($p=1)
{
if(!empty($_REQUEST['timeStart']) && !empty($_REQUEST['timeEnd'])){
$starttime = strtotime($_REQUEST['timeStart']);
$endtime = strtotime($_REQUEST['timeEnd']);
} elseif(!empty($_REQUEST['timeStart']) && empty($_REQUEST['timeEnd'])) {
$starttime = strtotime($_REQUEST['timeStart']);
$endtime = strtotime(date('Y-m-d'));
} elseif(empty($_REQUEST['timeStart']) && !empty($_REQUEST['timeEnd'])) {
$user = D('User')->field('register_time')->order('id asc')->find();
$starttime = strtotime(date('Y-m-d',$user['register_time']));
$endtime = strtotime($_REQUEST['timeEnd']);
} else {
$user = D('User')->field('register_time')->order('id asc')->find();
$starttime = strtotime(date('Y-m-d',$user['register_time']));
$endtime = strtotime(date('Y-m-d'));
}
$key = 0;
$total = ['current'=>0,'sum'=>0];
if(isset($_REQUEST['promote_id'])){
if ($_REQUEST['promote_id'] > 0) {
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
$promoter_ids ? $rmap['tab_user.promote_id'] = $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null;
} else {
$rmap['tab_user.promote_id'] = $map['promote_id'] = 0;
}
}
for($start = $endtime; $start >= $starttime;$start -= 86400)
{
$startDate = $start;
$endDate = $startDate + 24*60*60-1;
$rmap['register_time'] = $map['register_time'] = array('BETWEEN',array($startDate,$endDate));
$map['play_time'] = array('BETWEEN',array($startDate,$endDate));
$map['pay_time'] = array('BETWEEN',array($startDate,$endDate));
if(!empty($_REQUEST['game_type'])){
$map['sdk_version'] = $_REQUEST['game_type'];
$rmap['sdk_version'] = $_REQUEST['game_type'];
}
if(!empty($_REQUEST['game_name'])){
$rmap['game_id'] = $map['game_id'] = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')];
}
if (!empty($_REQUEST['server_name'])) {
$rmap['server_name'] = $map['server_name'] = $_REQUEST['server_name'];
}
if($_REQUEST['bindcoin']==1) {
$map['pay_way'] = array('egt',0);
}
//当天注册人数
$registerNum = D('User')->where(array_merge($rmap,array('puid'=>0)))->join("tab_user_play on tab_user.id = tab_user_play.user_id and tab_user.fgame_id = tab_user_play.game_id")->field("tab_user.id")->select();
$registerNum = $registerNum ? array_column($registerNum, 'id') : [];
//当天活跃人数
$livenNum = D('UserPlay')->where($map)->count("id");
//当天新增付费
if(empty($registerNum)){
$map['user_id'] = array('IN','0');
}else{
$map['user_id'] = array('IN',$registerNum);
}
$map['pay_status'] = 1;
$newAddPay = D('Spend')->where(array_merge($map,array('_string'=>'( small_id = 0 or small_id = user_id)')))->sum('pay_amount');
//当天累计付费
unset($map['user_id']);
$accumulated = D('Spend')->where($map)->sum('pay_amount');
$data[$key]['date'] = date('Y-m-d',$start);
$data[$key]['game_id'] = empty($_REQUEST['game_id'])?"全部":get_game_name($_REQUEST['game_id']);
switch ($_REQUEST['promote_id']) {
case 'GUANFANG':
$data[$key]['promote_id'] = "官方渠道";
break;
case 0:
$data[$key]['promote_id'] = "官方渠道";
break;
case 'PROMOTE':
$data[$key]['promote_id'] = "推广渠道";
break;
case 'ALL':
$data[$key]['promote_id'] = "全部";
break;
default:
$data[$key]['promote_id'] = empty($_REQUEST['promote_id'])?"全部":get_promote_account($_REQUEST['promote_id']);
break;
}
$data[$key]['registerNum'] = count($registerNum);
$data[$key]['livenNum'] = $livenNum;
$data[$key]['newAddPay'] = empty($newAddPay)?0:$newAddPay;
$data[$key]['accumulated'] = empty($accumulated)?0:$accumulated;
$total['sum'] += $data[$key]['accumulated'];
$key++;
}
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$count = count($data);
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$pnum = ceil(count($data) / $row); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($p-1)*$row, $row);
foreach($data as $k=>$v) {
$total['current'] += $v['accumulated'];
}
//判断是否执行导出
if(I('export')==1){
$this->exportSum($data);
}
$this->assign('meta_title',"充值汇总");
$this->assign('list_data',$data);
$this->assign('total',$total);
$this->m_title = '充值汇总';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'RechargeSum/summation','status'=>1])->find());
$this->display();
}
public function exportSum($data){
$export = A('Export');
$exptitle = $_REQUEST['xlsname'];
$expCellName = array(
array('date','日期'),
array('promote_id','渠道来源'),
array('game_id','游戏名称'),
array('registerNum','新增人数'),
array('livenNum','活跃人数'),
array('newAddPay',"新增玩家付费"),
array('accumulated','本日累计'),
);
$expTableData = $data;
$export->exportExcel($exptitle,$expCellName,$expTableData);
}
class RechargeSumController extends ThinkController
{
public function summation($p = 1)
{
$startDateTime = empty($_REQUEST['timeStart']) ? date('Y-m-d', strtotime('-6 day', time())) : $_REQUEST['timeStart'];
$endDateTime = empty($_REQUEST['timeEnd']) ? date('Y-m-d') : $_REQUEST['timeEnd'];
$startTime = strtotime($startDateTime);
$endTime = strtotime($endDateTime);
$key = 0;
$total = ['current' => 0, 'sum' => 0];
if (isset($_REQUEST['promote_id'])) {
if ($_REQUEST['promote_id'] > 0) {
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
$promoter_ids ? $rmap['tab_user.promote_id'] = $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null;
} else {
$rmap['tab_user.promote_id'] = $map['promote_id'] = 0;
}
}
$data = [];
if (intval(($endTime + (24 * 3600)) - $startTime) / (24 * 3600) <= 31) {
for ($start = $endTime; $start >= $startTime; $start -= 86400) {
$startDate = $start;
$endDate = $startDate + 24 * 60 * 60 - 1;
$rmap['register_time'] = $map['register_time'] = array('BETWEEN', array($startDate, $endDate));
$map['play_time'] = array('BETWEEN', array($startDate, $endDate));
$map['pay_time'] = array('BETWEEN', array($startDate, $endDate));
if (!empty($_REQUEST['game_type'])) {
$map['sdk_version'] = $_REQUEST['game_type'];
$rmap['sdk_version'] = $_REQUEST['game_type'];
}
if (!empty($_REQUEST['game_name'])) {
$rmap['game_id'] = $map['game_id'] = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')];
}
if (!empty($_REQUEST['server_id'])) {
$rmap['tab_user_play.server_id'] = $map['server_id'] = $_REQUEST['server_id'];
}
if ($_REQUEST['bindcoin'] == 1) {
$map['pay_way'] = array('egt', 0);
}
//当天注册人数
$registerNum = D('User')->where(array_merge($rmap, array('puid' => 0)))->join("tab_user_play on tab_user.id = tab_user_play.user_id and tab_user.fgame_id = tab_user_play.game_id")->field("tab_user.id")->select();
$registerNum = $registerNum ? array_column($registerNum, 'id') : [];
//当天活跃人数
$livenNum = D('UserPlay')->where($map)->count("id");
//当天新增付费
if (empty($registerNum)) {
$map['user_id'] = array('IN', '0');
} else {
$map['user_id'] = array('IN', $registerNum);
}
$map['pay_status'] = 1;
$newAddPay = D('Spend')->where(array_merge($map, array('_string' => '( small_id = 0 or small_id = user_id)')))->sum('pay_amount');
//当天累计付费
unset($map['user_id']);
$accumulated = D('Spend')->where($map)->sum('pay_amount');
$data[$key]['date'] = date('Y-m-d', $start);
$data[$key]['game_id'] = empty($_REQUEST['game_id']) ? "全部" : get_game_name($_REQUEST['game_id']);
switch ($_REQUEST['promote_id']) {
case 'GUANFANG':
$data[$key]['promote_id'] = "官方渠道";
break;
case 0:
$data[$key]['promote_id'] = "官方渠道";
break;
case 'PROMOTE':
$data[$key]['promote_id'] = "推广渠道";
break;
case 'ALL':
$data[$key]['promote_id'] = "全部";
break;
default:
$data[$key]['promote_id'] = empty($_REQUEST['promote_id']) ? "全部" : get_promote_account($_REQUEST['promote_id']);
break;
}
$data[$key]['registerNum'] = count($registerNum);
$data[$key]['livenNum'] = $livenNum;
$data[$key]['newAddPay'] = empty($newAddPay) ? 0 : $newAddPay;
$data[$key]['accumulated'] = empty($accumulated) ? 0 : $accumulated;
$total['sum'] += $data[$key]['accumulated'];
$key++;
}
}
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
$count = count($data);
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$pnum = ceil(count($data) / $row); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($p - 1) * $row, $row);
foreach ($data as $k => $v) {
$total['current'] += $v['accumulated'];
}
//判断是否执行导出
if (I('export') == 1) {
$this->exportSum($data);
}
$this->assign('meta_title', "充值汇总");
$this->assign('list_data', $data);
$this->assign('total', $total);
$this->assign('startDate', $startDateTime);
$this->assign('endDate', $endDateTime);
$this->m_title = '充值汇总';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'RechargeSum/summation', 'status' => 1])->find());
$this->display();
}
public function exportSum($data)
{
$export = A('Export');
$exptitle = $_REQUEST['xlsname'];
$expCellName = array(
array('date', '日期'),
array('promote_id', '渠道来源'),
array('game_id', '游戏名称'),
array('registerNum', '新增人数'),
array('livenNum', '活跃人数'),
array('newAddPay', "新增玩家付费"),
array('accumulated', '本日累计'),
);
$expTableData = $data;
$export->exportExcel($exptitle, $expCellName, $expTableData);
}
}

@ -48,9 +48,13 @@ class SpendController extends ThinkController
unset($_REQUEST['server_name']);
}
if (isset($_REQUEST['pay_order_number'])) {
$map['pay_order_number'] = array('like', trim($_REQUEST['pay_order_number']) . '%');
$map['pay_order_number'] = array('like', trim($_REQUEST['pay_order_number']));
unset($_REQUEST['pay_order_number']);
}
if (isset($_REQUEST['extend'])) {
$map['extend'] = array('like', trim($_REQUEST['extend']));
unset($_REQUEST['extend']);
}
if (isset($_REQUEST['pay_status'])) {
$map['pay_status'] = $_REQUEST['pay_status'];
unset($_REQUEST['pay_status']);

@ -1 +1 @@
{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":3},{"time":"11:00","count":1},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":2},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":1},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":7,"active":17,"player":3,"money":0.080000000000000002},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":4},{"time":"10:00","count":6},{"time":"11:00","count":1},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":4},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":2},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":1},{"time":"16:00","count":2},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":"0.04"},{"time":"16:00","count":"0.04"},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]}
{"news":[{"time":"0:00","count":16},{"time":"1:00","count":11},{"time":"2:00","count":12},{"time":"3:00","count":8},{"time":"4:00","count":9},{"time":"5:00","count":5},{"time":"6:00","count":6},{"time":"7:00","count":15},{"time":"8:00","count":18},{"time":"9:00","count":28},{"time":"10:00","count":82},{"time":"11:00","count":77},{"time":"12:00","count":33},{"time":"13:00","count":36},{"time":"14:00","count":156},{"time":"15:00","count":136},{"time":"16:00","count":108},{"time":"17:00","count":71},{"time":"18:00","count":75},{"time":"19:00","count":99},{"time":"20:00","count":104},{"time":"21:00","count":82},{"time":"22:00","count":84},{"time":"23:00","count":45}],"sum":{"news":1316,"active":6633,"player":1359,"money":132537.03},"active":[{"time":"0:00","count":833},{"time":"1:00","count":294},{"time":"2:00","count":144},{"time":"3:00","count":101},{"time":"4:00","count":84},{"time":"5:00","count":150},{"time":"6:00","count":410},{"time":"7:00","count":590},{"time":"8:00","count":452},{"time":"9:00","count":438},{"time":"10:00","count":399},{"time":"11:00","count":299},{"time":"12:00","count":250},{"time":"13:00","count":174},{"time":"14:00","count":309},{"time":"15:00","count":269},{"time":"16:00","count":204},{"time":"17:00","count":174},{"time":"18:00","count":175},{"time":"19:00","count":222},{"time":"20:00","count":206},{"time":"21:00","count":161},{"time":"22:00","count":181},{"time":"23:00","count":114}],"player":[{"time":"0:00","count":174},{"time":"1:00","count":54},{"time":"2:00","count":34},{"time":"3:00","count":19},{"time":"4:00","count":17},{"time":"5:00","count":18},{"time":"6:00","count":31},{"time":"7:00","count":54},{"time":"8:00","count":54},{"time":"9:00","count":48},{"time":"10:00","count":53},{"time":"11:00","count":63},{"time":"12:00","count":45},{"time":"13:00","count":52},{"time":"14:00","count":40},{"time":"15:00","count":107},{"time":"16:00","count":90},{"time":"17:00","count":56},{"time":"18:00","count":47},{"time":"19:00","count":66},{"time":"20:00","count":62},{"time":"21:00","count":66},{"time":"22:00","count":66},{"time":"23:00","count":43}],"money":[{"time":"0:00","count":"21663.00"},{"time":"1:00","count":"3664.00"},{"time":"2:00","count":"2245.00"},{"time":"3:00","count":"734.00"},{"time":"4:00","count":"1526.00"},{"time":"5:00","count":"1506.00"},{"time":"6:00","count":"3141.00"},{"time":"7:00","count":"3900.00"},{"time":"8:00","count":"5225.00"},{"time":"9:00","count":"5350.02"},{"time":"10:00","count":"3657.00"},{"time":"11:00","count":"5008.00"},{"time":"12:00","count":"2899.00"},{"time":"13:00","count":"7167.00"},{"time":"14:00","count":"13457.00"},{"time":"15:00","count":"6680.00"},{"time":"16:00","count":"4772.00"},{"time":"17:00","count":"4365.01"},{"time":"18:00","count":"3683.00"},{"time":"19:00","count":"3187.00"},{"time":"20:00","count":"5599.00"},{"time":"21:00","count":"10597.00"},{"time":"22:00","count":"7201.00"},{"time":"23:00","count":"5311.00"}]}

@ -46,7 +46,7 @@
</div>
<div class="input-list">
<div class="tools">
<select id="type_id" name="type_id" class="select_gallery" style="width:120px;">
<select id="game_id" name="game_id" class="select_gallery" style="width:120px;">
<option value="">游戏名称</option>
<volist name=":get_game_list()" id="vo">
<option value="{$vo.id}">{$vo.game_name}</option>

@ -69,10 +69,10 @@
<input type="text" name="account" class="" placeholder="玩家账号" value="{:I('account')}"/>&nbsp;
</div>
<div class="input-list">
<input type="text" id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="注册开始时间" />
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="注册开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" id="time_end" name="time_end" class="" value="{:I('time_end')}" placeholder="注册结束时间" />
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}" placeholder="注册结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>

@ -73,10 +73,10 @@ background-color: #FF9797;
<input type="text" name="pay_order_number" placeholder="订单号" class="" value="{:I('pay_order_number')}"/>&nbsp;
</div>
<div class="input-list">
<input type="text" id="time-start" name="time-start" autocomplete="off" class="" value="{:I('time-start')}" placeholder="充值开始时间" />
<input type="text" id="time-start" name="timeStart" autocomplete="off" class="" value="{:I('timeStart')}" placeholder="充值开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" id="time-end" name="time-end" autocomplete="off" class="" value="{:I('time-end')}" placeholder="充值结束时间" />
<input type="text" id="time-end" name="timeEnd" autocomplete="off" class="" value="{:I('timeEnd')}" placeholder="充值结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>

@ -62,20 +62,18 @@
</select>
</td>
<else/>
<td class="l">玩家账号:</td>
<td class="r" >
<select id="user_id" name="user_id">
<volist name=":get_user_list()" id="vo">
<option coin-yue='{$vo.balance}' value="{$vo.id}">{$vo.account}</option>
</volist>
</select>
<td class="l">玩家账号:</td>
<td class="r">
<input type="text" class="txt" name="user_account" id="user_account" value="" >
<input type="hidden" name="user_id" id="user_id" value="" >
<p class="user-account-msg" style="position: absolute;bottom: -8px;color: red;display: none;"></p>
</td>
</if>
</tr>
<tr>
<td class="l">账户余额:</td>
<td class="r">
<input type="text" class="<if condition='I("type") eq 2'> coin_yue<else/>coin_yue2</if>" name="" value="" disabled="disabled" style="background: #e7e7e7">
<input type="text" class="<if condition='I("type") eq 2'> coin_yue<else/>coin_yue2</if>" name="" value="0.00" disabled="disabled" style="background: #e7e7e7">
<span ></span>
</td>
</tr>
@ -130,7 +128,6 @@ $('#submit').click(function(){
$(function(){
$("#promote_id").select2();
$("#user_id").select2();
$("#game_id").change();
$('.date').datetimepicker({
format: 'yyyy-mm-dd',
@ -147,6 +144,31 @@ $(function(){
});
$('#user_account').change(function () {
var account = $(this).val();
$.ajax({
url:"{:U('getUserAccount')}",
type:'post',
dataType:'json',
data:{account:account},
success:function(data){
if (data.status == 1) {
var user = $('#user_id');
user.val(data.user.id);
$(".coin_yue2").val(data.user.balance);
$('.user-account-msg').hide();
} else {
var msgElement = $('.user-account-msg');
msgElement.text(data.msg);
msgElement.show();
}
},
error:function (result) {
console.log(result);
}
})
});
/*获取游戏名称*/
$("#game_id").change(function() {
$("#game_name").val($("#game_id option:selected").text());
@ -157,11 +179,6 @@ $('#promote_id').change(function(){
$(".coin_yue").val($('#promote_id option:selected').attr('coin-yue'));
});
$(".coin_yue2").val($('#user_id option:selected').attr('coin-yue'));
$('#user_id').change(function(){
$(".coin_yue2").val($('#user_id option:selected').attr('coin-yue'));
});
function getDiscount() {
$.ajax({
url:"{:U('Ajax/getGameDiscount')}",
@ -174,7 +191,5 @@ function getDiscount() {
}
})
}
</script>
</block>

@ -46,11 +46,11 @@
</select>
</div>
<div class="input-list">
<input type="text" id="time-start" name="timeStart" class="" value="{:I('timeStart')}"
<input type="text" id="time-start" name="timeStart" class="" value="{$startDate}"
placeholder="查询开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" id="time-end" name="timeEnd" class="" value="{:I('timeEnd')}"
<input type="text" id="time-end" name="timeEnd" class="" value="{$endDate}"
placeholder="查询结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
@ -81,8 +81,8 @@
</select>
</div>
<div class="input-list input-list-server search_label_rehab">
<select id="server_name" name="server_name" class="select_gallery" style="width:120px;">
<option value="">区服名称</option>
<select id="server_id" name="server_id" class="select_gallery" style="width:120px;">
<option value="">请选择区服</option>
</select>
</div>
<div class="input-list search_item input-list-gamenoticestatus">
@ -189,33 +189,28 @@ highlight_subnav('{:U('RechargeSum/summation')}');
$(function(){
//搜索功能
$("#search").click(function(){
var starttime = $.trim($('#time-start').val());
var endtime = $.trim($('#time-end').val());
if((starttime && !endtime) || (!starttime && endtime)) {layer.msg('请完整时间搜索项');return false;}
if (starttime && endtime && starttime > endtime) {layer.msg('开始时间必须小于等于结束时间');return false;}
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
var start = $("#time-start").val();
var end = $("#time-end").val();
if (start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
window.location.href = url;
var sdate = Date.parse($('#time-start').val()) / 1000;
var edate = Date.parse($('#time-end').val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
return false;
}
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
$(".paixu").click(function(){
var that=$(this);
@ -348,7 +343,7 @@ $(function(){
});
$("#game_type").change();
var game_server = "{:I('server_name')}";
var game_server = "{:I('server_id')}";
$("#game_name").change(function(){
$.ajax({
url:"{:U('Ajax/getGmeServer')}",
@ -358,11 +353,11 @@ $(function(){
success:function(data){
str = "<option value=''>请选择区服</option>";
for (var i in data){
str += "<option value='"+data[i].server_name+"' "+(game_server && data[i].server_name == game_server?'selected':'')+">"+data[i].server_name+"</option>"
str += "<option value='"+data[i].server_id+"' "+(game_server && data[i].server_id == game_server?'selected':'')+">"+data[i].server_name+"</option>"
}
$("#server_name").empty();
$("#server_name").append(str);
$("#server_name").select2();
$("#server_id").empty();
$("#server_id").append(str);
$("#server_id").select2();
}
})
});

@ -47,6 +47,9 @@
<div class="input-list">
<input type="text" name="pay_order_number" class="" value="{:I('pay_order_number')}" placeholder="支付订单号">
</div>
<div class="input-list">
<input type="text" name="extend" class="" value="{:I('extend')}" placeholder="CP订单号">
</div>
<div class="input-list">
<input type="text" readonly id="time-start" name="timestart" class="" value="{$startDate}"
placeholder="充值开始时间"/>
@ -62,7 +65,7 @@
<option value="">设备类型</option>
<option value="1">安卓</option>
<option value="2">苹果</option>
</select>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_name" name="game_name" class="select_gallery" >
@ -541,26 +544,6 @@
*/
//初始化页面加载
$(document).ready(function () {
//初始化select2单选
initSelect2WithSearch();
});
function initSelect2WithSearch() {
$("#sel_order").select2({
tags: true,
placeholder: '订单状态',
allowClear: false,
minimumResultsForSearch: Infinity, // 永久隐藏搜索框
});
}
function initSelect2WithSearch() {
$("#pay_game_status").select2({
tags: true,
placeholder: '游戏通知状态',
allowClear: false,
minimumResultsForSearch: Infinity, // 永久隐藏搜索框
});
}
</script>
</block>

@ -37,7 +37,7 @@ class PromoteController extends BaseController
{
$this->meta_title = "首页";
$loginPromote = $this->getLoginPromote();
$isOpenQuery = true;
if (!$isOpenQuery) {
@ -249,10 +249,12 @@ class PromoteController extends BaseController
$map1['pay_status'] = $map['pay_status'] = 1;
$map1['pay_way'] = $map['pay_way'] = array('gt', 0);
$userId = [];
$this->getLoginPromote();
$promoteId = M("promote", "tab_")->field('id')->where("parent_id=" . get_pid() . " or grand_id=" . get_pid())->select();
$promoteId = array_column($promoteId, 'id');
$promoteId = implode(',', $promoteId) . "," . get_pid();
$promoteId = M("promote", "tab_")
->where(array('chain' => ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%']))
->getField('id', true);
$promoteId[] = $this->loginPromote['id'];
$whereUser['promote_id'] = ['IN', $promoteId];
if ($type == 1) {
@ -295,7 +297,6 @@ class PromoteController extends BaseController
floor(sum(IF(create_time ' . $today . ',pay_amount,0))*100) as today,
floor(sum(IF(create_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(create_time ' . $mounth . ',pay_amount,0))*100) as mounth')
// ->join('tab_user on tab_user.id = tab_spend.user_id','left')
->where($map1)
->group('promote_id')
->select(false);
@ -306,21 +307,18 @@ class PromoteController extends BaseController
floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today,
floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
// ->join('tab_user on tab_user.id = tab_spend.user_id','left')
->where($map)
->union(' (' . $bindrecharge_data . ') ')
->union(' (' . $deposit_data . ') ')
->group('promote_id')
->select(false);
// $promote_map = "tp1.`chain` = '/'";
$promote_id = get_pid();
$promote_map = "tp1.`id` = {$promote_id}";
$spendData = $spend->field('t.pid as promote_id,t.promote_account,sum(a.scount) AS count,sum(a.today) AS today,sum(a. WEEK) AS WEEK,sum(a.mounth) AS mounth')
->join("INNER JOIN (SELECT tp2.*, tp1.id AS pid, tp1.account as promote_account FROM tab_promote tp1 LEFT JOIN tab_promote tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') where $promote_map ) AS t ON promote_id = t.id")
->where($condition)->table('(' . $spendData . ') as a')->group('t.pid')->order('count desc,a.ordertime')->find();
// var_dump($spendData);die();
$spendData['rand'] = 1;
$spendData['count'] = $spendData['count'] / 100;
$spendData['today'] = $spendData['today'] / 100;
@ -903,13 +901,13 @@ class PromoteController extends BaseController
if (count($ids) > 0) {
$countList = M('promote', 'tab_')->field(['count(*)' => 'count', 'parent_id' => 'parent_id'])->where(['parent_id' => ['in', $ids]])->group('parent_id')->select();
$playerList = M('user_play', 'tab_')->field(['count(*)' => 'count', 'promote_id' => 'promote_id'])->where(['promote_id' => ['in', $ids]])->group('promote_id')->select();
$shiftList = M('shift_task', 'sys_')
->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])
->where(['status' => 0, 'type' => 1, 'from_promote_id' => ['in', $ids]])
->group('from_promote_id')
->select();
$shiftPlayerList = M('shift_task', 'sys_')
->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])
->where(['status' => 0, 'type' => 2, 'from_promote_id' => ['in', $ids]])
@ -946,7 +944,7 @@ class PromoteController extends BaseController
if (IS_POST) {
$params = I('post.');
$loginPromote = $this->getLoginPromote();
if ($params['promote_type'] == 0 && $loginPromote['level'] > 1) {
$this->ajaxReturn(['status' => 0, 'msg' => '无权限']);
}

@ -1199,14 +1199,6 @@ class QueryController extends BaseController
}
}
$summaryData['date'] = array_reverse($summaryData['date']);
$summaryData['role_num'] = array_reverse($summaryData['role_num']);
$summaryData['user_num'] = array_reverse($summaryData['user_num']);
$summaryData['new_user_num'] = array_reverse($summaryData['new_user_num']);
$summaryData['new_device_num'] = array_reverse($summaryData['new_device_num']);
$summaryData['spend_user_num'] = array_reverse($summaryData['spend_user_num']);
$summaryData['spend_all_amount'] = array_reverse($summaryData['spend_all_amount']);
$serverData = $this->getServer($relationGameId, $sdkVersion);
$this->assign('meta_title', '每日概况');

Loading…
Cancel
Save