diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php
index 6ebe18b4b..b442ad320 100644
--- a/Application/Admin/Controller/AutoController.class.php
+++ b/Application/Admin/Controller/AutoController.class.php
@@ -890,5 +890,31 @@ public function auto_rrdae(){
}
}
+ //根据时间统计玩家充值
+ public function userPlayDataCount()
+ {
+ $time = strtotime(date('Y-m-d 00:00:00', time() - (3600 * 24)));
+ $spendMap['pay_status'] = 1;
+ $spendMap['pay_game_status'] = 1;
+ $spendMap['game_player_id'] = ['gt', 0];
+ $spendMap['pay_time'] = ['between', [$time, strtotime(date('Y-m-d 23:59:59', $time))]];
+
+ $field = 'FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count';
+ $spendCostData = M('spend', 'tab_')->field($field)
+ ->where($spendMap)
+ ->group('day,game_player_id,server_id,game_id')
+ ->select();
+ $data = [];
+ foreach ($spendCostData as $list) {
+ $save['game_id'] = $list['game_id'];
+ $save['server_id'] = $list['server_id'];
+ $save['role_id'] = $list['game_player_id'];
+ $save['recharge_cost'] = $list['recharge_cost'];
+ $save['recharge_count'] = $list['recharge_count'];
+ $save['create_time'] = strtotime($list['day']);
+ $data[] = $save;
+ }
+ M('user_play_data_count', 'tab_')->addAll($data);
+ }
}
diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index 824276b35..9f99ad237 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -243,6 +243,7 @@ class ExportController extends Controller
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
if ($promoter_ids) {
$map['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
+ $spendprom = " AND ss.promote_id IN (" . implode(',', array_column($promoter_ids, 'id')) . ") ";
}
}
}
@@ -259,24 +260,24 @@ class ExportController extends Controller
// unset($_REQUEST['promote_account']);
// }
if (isset($_REQUEST['register_way'])) {
- if($_REQUEST['type']==1) {
- if ($_GET['register_way'] == 1) {
- empty($hav) || $hav .= ' AND ';
- $hav .= ' tab_user.register_type in (0,1)';
- $maps['tab_user.register_type'] = ['in',[0,1]];
- } elseif($_GET['register_way'] == 7){
- empty($hav) || $hav .= ' AND ';
- $hav .= ' tab_user.register_type in(7)';
- $maps['tab_user.register_type'] = 7;
- }else {
- empty($hav) || $hav .= ' AND ';
- $hav .= ' tab_user.register_type in(2)';
- $maps['tab_user.register_type'] = 2;
- }
- } else {
- $map['register_way'] = I('register_way');
- unset($_REQUEST['register_way']);
- }
+ if($_REQUEST['type']==1) {
+ if ($_GET['register_way'] == 1) {
+ empty($hav) || $hav .= ' AND ';
+ $hav .= ' tab_user.register_type in (0,1)';
+ $maps['tab_user.register_type'] = ['in',[0,1]];
+ } elseif($_GET['register_way'] == 7){
+ empty($hav) || $hav .= ' AND ';
+ $hav .= ' tab_user.register_type in(7)';
+ $maps['tab_user.register_type'] = 7;
+ }else {
+ empty($hav) || $hav .= ' AND ';
+ $hav .= ' tab_user.register_type in(2)';
+ $maps['tab_user.register_type'] = 2;
+ }
+ } else {
+ $map['register_way'] = I('register_way');
+ unset($_REQUEST['register_way']);
+ }
}
if (isset($_REQUEST['register_type'])) {
$map['register_type'] = I('register_type');
@@ -301,16 +302,25 @@ class ExportController extends Controller
$order = 'id desc';
}
- if (isset($_REQUEST['viplevel'])) {
+ if (isset($_REQUEST['viplevel'])) {
- $havs = get_vip_level_limit('recharge_total',$_REQUEST['viplevel']);
- }
+ $havs = get_vip_level_limit('recharge_total',$_REQUEST['viplevel']);
+ }
- $map['puid'] = array('eq',0);
- $map['is_platform'] = 0;
- //数据
- $xlsData = M('user', 'tab_')->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,(IFNULL(sum(b.pay_amount),0) + IFNULL(sum(ss.pay_amount),0)) AS recharge_total')
- ->join('left join tab_deposit AS b ON tab_user.id = b.user_id AND b.pay_status = 1')
+ $map['puid'] = array('eq',0);
+ $map['is_platform'] = 0;
+ if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){
+ $xlsData = M('user', 'tab_')->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,IFNULL(sum(ss.pay_amount),0) AS recharge_total')
+ ->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1'.$spendprom)
+ ->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false)
+ ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false)
+ ->where($map)
+ ->group('tab_user.id')
+ ->order($order)
+ ->having($havs)
+ ->select();
+ }else{
+ $xlsData = M('user', 'tab_')->field('tab_user.id,tab_user.age_status,tab_user.account,tab_user.gold_coin,tab_user.alipay,tab_user.balance,tab_user.promote_account,register_time,tab_user.lock_status,tab_user.register_way,tab_user.register_type,tab_user.register_ip,tab_user.login_time,IFNULL(sum(ss.pay_amount),0) AS recharge_total')
->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false)
@@ -319,38 +329,42 @@ class ExportController extends Controller
->order($order)
->having($havs)
->select();
- if($xlsData) {
- $ids = array_column($xlsData,'id');
- /* 在手里 */
- $small = M('user','tab_')->field('count(id) as count,puid')->where(['puid'=>array('in',$ids)])->group('puid')->select();
- /* 出售中 */
- $small2 = M('user','tab_')->field('count(id) as count,source_puid')->where(['source_puid'=>array('in',$ids),'source_time'=>0])->group('source_puid')->select();
-
- foreach($xlsData as $k => $v) {
-
-
- $xlsData[$k]['vip_level'] = get_vip_level($v['recharge_total']);
- if(empty($v['alipay'])){
- $xlsData[$k]['alipay'] = '--';
- }
-
- $xlsData[$k]['register_type'] = $v['register_type'] == 2?'手机号':($v['register_type']==7?'邮箱':'账号');
-
- $xlsData[$k]['small_count'] = 0;
- foreach($small as $s) {
- if($s['puid'] == $v['id']) {
- $xlsData[$k]['small_count'] += $s['count'];break;
- }
- }
- foreach($small2 as $s) {
- if($s['source_puid'] == $v['id']) {
- $xlsData[$k]['small_count'] += $s['count'];break;
- }
- }
+ }
+ //数据
+
+
+ if($xlsData) {
+ $ids = array_column($xlsData,'id');
+ /* 在手里 */
+ $small = M('user','tab_')->field('count(id) as count,puid')->where(['puid'=>array('in',$ids)])->group('puid')->select();
+ /* 出售中 */
+ $small2 = M('user','tab_')->field('count(id) as count,source_puid')->where(['source_puid'=>array('in',$ids),'source_time'=>0])->group('source_puid')->select();
- }
+ foreach($xlsData as $k => $v) {
- }
+
+ $xlsData[$k]['vip_level'] = get_vip_level($v['recharge_total']);
+ if(empty($v['alipay'])){
+ $xlsData[$k]['alipay'] = '--';
+ }
+
+ $xlsData[$k]['register_type'] = $v['register_type'] == 2?'手机号':($v['register_type']==7?'邮箱':'账号');
+
+ $xlsData[$k]['small_count'] = 0;
+ foreach($small as $s) {
+ if($s['puid'] == $v['id']) {
+ $xlsData[$k]['small_count'] += $s['count'];break;
+ }
+ }
+ foreach($small2 as $s) {
+ if($s['source_puid'] == $v['id']) {
+ $xlsData[$k]['small_count'] += $s['count'];break;
+ }
+ }
+
+ }
+
+ }
break;
case 4:
diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php
index 737e73e07..c8feca33f 100644
--- a/Application/Admin/Controller/MemberController.class.php
+++ b/Application/Admin/Controller/MemberController.class.php
@@ -26,6 +26,7 @@ class MemberController extends ThinkController
if ($promoter_ids) {
$maps['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
$hav .= "tab_user.promote_id in (" . implode(',', array_column($promoter_ids, 'id')) . ") ";
+ $spendprom = " AND ss.promote_id IN (" . implode(',', array_column($promoter_ids, 'id')) . ") ";
}
}
}
@@ -176,7 +177,28 @@ class MemberController extends ThinkController
// ->order($order)
->select(false);
- $data = $usermodel->table('(' . $sql1 . ') as a ')->field('a.id,a.device_number,a.age_status,a.account,a.balance,a.gold_coin,a.alipay,a.promote_id,a.register_type,a.promote_account,a.register_time,a.lock_status,a.register_way,a.register_type,a.register_ip,a.login_time,(a.deposit_total+IFNULL(sum(ss.pay_amount),0)) as recharge_total,check_status')
+ // $data = $usermodel->table('(' . $sql1 . ') as a ')->field('a.id,a.device_number,a.age_status,a.account,a.balance,a.gold_coin,a.alipay,a.promote_id,a.register_type,a.promote_account,a.register_time,a.lock_status,a.register_way,a.register_type,a.register_ip,a.login_time,IFNULL(sum(ss.pay_amount),0) as recharge_total,check_status')
+ // ->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1')
+ // ->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
+ // ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
+ // ->page($page, $row)
+ // ->having($havs)
+ // ->group('a.id')
+ // ->order($order)
+ // ->select();
+ if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){
+ $data = $usermodel->table('(' . $sql1 . ') as a ')->field('a.id,a.device_number,a.age_status,a.account,a.balance,a.gold_coin,a.alipay,a.promote_id,a.register_type,a.promote_account,a.register_time,a.lock_status,a.register_way,a.register_type,a.register_ip,a.login_time,IFNULL(sum(ss.pay_amount),0) as recharge_total,check_status')
+ ->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1'.$spendprom)
+ ->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
+ ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
+ ->page($page, $row)
+ ->having($havs)
+ ->group('a.id')
+ ->order($order)
+ ->select();
+ // echo $data;die();
+ }else{
+ $data = $usermodel->table('(' . $sql1 . ') as a ')->field('a.id,a.device_number,a.age_status,a.account,a.balance,a.gold_coin,a.alipay,a.promote_id,a.register_type,a.promote_account,a.register_time,a.lock_status,a.register_way,a.register_type,a.register_ip,a.login_time,IFNULL(sum(ss.pay_amount),0) as recharge_total,check_status')
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
@@ -185,10 +207,11 @@ class MemberController extends ThinkController
->group('a.id')
->order($order)
->select();
+ }
+
//计数
- $sql = M('user', 'tab_')->field('tab_user.id,(IFNULL(sum(b.pay_amount),0) + IFNULL(sum(ss.pay_amount),0)) AS recharge_total')
- ->join('left join tab_deposit AS b ON tab_user.id = b.user_id AND b.pay_status = 1')
+ $sql = M('user', 'tab_')->field('tab_user.id,IFNULL(sum(ss.pay_amount),0) AS recharge_total')
->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false)
@@ -196,8 +219,22 @@ class MemberController extends ThinkController
->group('tab_user.id')
->where($hav)
->having($havs)->select(false);
- $jcount = M('User', 'tab_')->field('count(a.id) as count')->table('(' . $sql . ') as a')->select();
+ //替换为新表
+ if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){
+ $sql = M('user', 'tab_')->field('tab_user.id,IFNULL(sum(ss.pay_amount),0) AS recharge_total')
+ ->join('left join tab_spend as ss on ss.user_id=tab_user.id AND ss.pay_status = 1'.$spendprom)
+ ->join($game_map ? "tab_user_play on tab_user_play.user_id = tab_user.id $game_map" : false)
+ ->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = tab_user.id $game_play_map" : false)
+ ->where($map)
+ ->group('tab_user.id')
+ ->where($hav)
+ ->having($havs)->select(false);
+ }
+
+ $jcount = M('User', 'tab_')->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $sql . ') as a')->select();
$count = $jcount[0]['count'];
+ // var_dump($jcount);die();
+ $this->assign('pay_allcount', $jcount[0]['recharge_total']);
$model = M('Model')->getByName('user');
diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php
index abaea3399..79f09c30b 100644
--- a/Application/Admin/Controller/PlatformController.class.php
+++ b/Application/Admin/Controller/PlatformController.class.php
@@ -387,6 +387,28 @@ class PlatformController extends ThinkController
->group('tp1.id')
->order('count desc, register_time')
->select();
+ unset($map['tp1.id']);
+ unset($map['tp1.chain']);
+ $map['promote_id'] = 0;
+ //官方渠道数据添加
+ $authorityData = M('user', 'tab_')->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(id) as count,
+ count(IF(register_time ' . $today . ',1,null)) as today,
+ count(IF(register_time ' . $week . ',1,null)) as week,
+ count(IF(register_time ' . $mounth . ',1,null)) as mounth')
+ ->where($map)
+ ->find();
+ $authorityData['promote_account'] = "官方渠道";
+ $authorityData['id'] = "1";
+ if (isset($_REQUEST['promote_id'])||$authorityData['count']==0) {
+ $authorityData = [];
+ } else {
+ array_push($data, $authorityData);
+ }
+
+ //数据排序
+ $last_names = array_column($data,'count');
+ array_multisort($last_names,SORT_DESC,$data);
+
$count = count($data);
foreach ($data as $key => $value) {
static $i = 0;
@@ -489,6 +511,7 @@ class PlatformController extends ThinkController
->where("pay_time".$pay_time)
->find();
$dbdata['promote_account'] = $promote[$i]['account'];
+ $dbdata['promote_id'] = $promote[$i]['id'];
} else {
$dbdata = $spend
->field('
@@ -500,6 +523,7 @@ class PlatformController extends ThinkController
->where("pay_time".$pay_time)
->find();
$dbdata['promote_account'] = $promote[$i]['account'];
+ $dbdata['promote_id'] = $promote[$i]['id'];
}
$data[] = $dbdata;
}
diff --git a/Application/Admin/View/Member/user_info.html b/Application/Admin/View/Member/user_info.html
index c3c0b959e..83d7b0812 100644
--- a/Application/Admin/View/Member/user_info.html
+++ b/Application/Admin/View/Member/user_info.html
@@ -304,6 +304,13 @@
+
+ 汇总:
+
+ 累计充值:{$pay_allcount}
+
+
+
diff --git a/Application/Admin/View/Platform/promote_statistics.html b/Application/Admin/View/Platform/promote_statistics.html
index 597ab3889..f531e3b71 100644
--- a/Application/Admin/View/Platform/promote_statistics.html
+++ b/Application/Admin/View/Platform/promote_statistics.html
@@ -216,20 +216,20 @@ $(function(){
$("#search").click();
}
});
- $(".ljzc").click(function(){
- var id = $(this).attr('data-value');
- var game_name = "{:I('game_name')}";
- var server_name = "{:I('server_id')}";
- var urlr = window.location.host;
- layer.open({
- type: 2,
- title: '注册记录',
- shadeClose: true,
- shade: 0.8,
- area: ['70%', '80%'],
- content: '/admin.php?s=/Platform/zhuce_detail/promote_id/'+id+'/game_name/'+game_name+'/server_name/'+server_name+''//iframe的url
- });
- });
+ // $(".ljzc").click(function(){
+ // var id = $(this).attr('data-value');
+ // var game_name = "{:I('game_name')}";
+ // var server_name = "{:I('server_id')}";
+ // var urlr = window.location.host;
+ // layer.open({
+ // type: 2,
+ // title: '注册记录',
+ // shadeClose: true,
+ // shade: 0.8,
+ // area: ['70%', '80%'],
+ // content: '/admin.php?s=/Platform/zhuce_detail/promote_id/'+id+'/game_name/'+game_name+'/server_name/'+server_name+''//iframe的url
+ // });
+ // });
$(".paixu").click(function(){
var that=$(this);
$data_order=that.attr('data-order');
diff --git a/Application/Admin/View/Platform/promotepay_statistics.html b/Application/Admin/View/Platform/promotepay_statistics.html
index 97b07c39c..b6ab050e3 100644
--- a/Application/Admin/View/Platform/promotepay_statistics.html
+++ b/Application/Admin/View/Platform/promotepay_statistics.html
@@ -120,7 +120,7 @@
{$data['promote_account']}
- {$data.count}
+ {$data.count}
{$data.today}
{$data.week}
@@ -193,19 +193,19 @@ $(function(){
$("#search").click();
}
});
- $(".ljcz").click(function(){
- var id = $(this).attr('data-value');
- var game_name = "{:I('game_name')}";
- var server_name = "{:I('server_id')}";
- layer.open({
- type: 2,
- title: '游戏消费记录',
- shadeClose: true,
- shade: 0.8,
- area: ['70%', '80%'],
- content: 'admin.php?s=/Platform/chongzhi_detail/promote_id/'+id+'/game_name/'+game_name+'/server_name/'+server_name+''//iframe的url
- });
- });
+ // $(".ljcz").click(function(){
+ // var id = $(this).attr('data-value');
+ // var game_name = "{:I('game_name')}";
+ // var server_name = "{:I('server_id')}";
+ // layer.open({
+ // type: 2,
+ // title: '游戏消费记录',
+ // shadeClose: true,
+ // shade: 0.8,
+ // area: ['70%', '80%'],
+ // content: 'admin.php?s=/Platform/chongzhi_detail/promote_id/'+id+'/game_name/'+game_name+'/server_name/'+server_name+''//iframe的url
+ // });
+ // });
$(".paixu").click(function(){
$ddd=$(this).attr('date-url');
$lzhuce="{:I('lzhuce')}";
diff --git a/Application/Base/Repository/UserRepository.class.php b/Application/Base/Repository/UserRepository.class.php
index 3e42e4052..2598a165f 100644
--- a/Application/Base/Repository/UserRepository.class.php
+++ b/Application/Base/Repository/UserRepository.class.php
@@ -133,8 +133,13 @@ class UserRepository
$dayList = $params['dayList'] ?? [];
$params['time_column'] = 'create_time';
$conditions = $this->getDayGroupConditions($params);
- $items = M('login_daily_record', 'tab_')->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day, count(DISTINCT user_id, game_id) as count')
+ $subQuery = M('login_daily_record', 'tab_')->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT user_id) as count')
->where($conditions)
+ ->group('day,game_id')
+ ->buildSql();
+ $items = M()->field('*,sum(count) as count')
+ ->table($subQuery)
+ ->alias('a')
->group('day')
->select();
@@ -294,8 +299,13 @@ class UserRepository
$params['time_column'] = 'create_time';
$conditions = $this->getCreateRoleConditions($params);
- $items = M('user_play_info', 'tab_')->field('count(distinct game_id,user_id) count, FROM_UNIXTIME(create_time, "%Y-%m-%d") as day')
+ $subQuery = M('user_play_info', 'tab_')->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT user_id) as count')
->where($conditions)
+ ->group('day,game_id')
+ ->buildSql();
+ $items = M()->field('*,sum(count) as count')
+ ->table($subQuery)
+ ->alias('a')
->group('day')
->select();
return $this->assembleRecords($items, $dayList, 'count');
@@ -346,10 +356,14 @@ class UserRepository
->where("ti.user_id = user_id and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
->fetchSql(true)
->count();
- $items = $model->field("count(distinct game_id,user_id) count, FROM_UNIXTIME(create_time, '%Y-%m-%d') as day,
- (" . $sql . ") as num")
+ $subQuery = $model->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT user_id) as count')
->where($conditions)
- ->group("day")
+ ->group('day,game_id')
+ ->buildSql();
+ $items = M()->field("*,sum(count) as count,(" . $sql . ") as num")
+ ->table($subQuery)
+ ->alias('a')
+ ->group('day')
->having('num = 0')
->select();
return $this->assembleRecords($items, $dayList, 'count');
@@ -411,10 +425,14 @@ class UserRepository
->where("ti.create_device_number = create_device_number and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
->fetchSql(true)
->count();
- $items = $model->field("count(distinct game_id,create_device_number) count, FROM_UNIXTIME(create_time, '%Y-%m-%d') as day,
- (" . $sql . ") as num")
+ $subQuery = $model->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT create_device_number) as count')
->where($conditions)
- ->group("day")
+ ->group('day,game_id')
+ ->buildSql();
+ $items = M()->field("*,sum(count) as count,(" . $sql . ") as num")
+ ->table($subQuery)
+ ->alias('a')
+ ->group('day')
->having('num = 0')
->select();
return $this->assembleRecords($items, $dayList, 'count');
@@ -476,10 +494,14 @@ class UserRepository
->where("ti.create_ip = create_ip and ti.game_id = game_id and ti.create_time < " . $params['begin_time'])
->fetchSql(true)
->count();
- $items = $model->field("count(distinct game_id,create_ip) count, FROM_UNIXTIME(create_time, '%Y-%m-%d') as day,
- (" . $sql . ") as num")
+ $subQuery = $model->field('FROM_UNIXTIME(create_time, "%Y-%m-%d") as day,count(DISTINCT create_ip) as count')
->where($conditions)
- ->group("day")
+ ->group('day,game_id')
+ ->buildSql();
+ $items = M()->field("*,sum(count) as count,(" . $sql . ") as num")
+ ->table($subQuery)
+ ->alias('a')
+ ->group('day')
->having('num = 0')
->select();
return $this->assembleRecords($items, $dayList, 'count');
diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php
index 6f38130b5..8ed98c5b7 100644
--- a/Application/Common/Common/extend.php
+++ b/Application/Common/Common/extend.php
@@ -1053,7 +1053,7 @@ function is_check_account($account){
$map[$field]=$game_id;
$data=M('game','tab_')->where($map)->find();
if(empty($data)){return '';}
- return $data['dratio'];
+ return $data['ratio'];
}
/**
diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php
index a271b502a..dac68565b 100644
--- a/Application/Home/Controller/DownloadController.class.php
+++ b/Application/Home/Controller/DownloadController.class.php
@@ -412,17 +412,21 @@ class DownloadController extends BaseController {
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
$begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
-
+ $gameId = intval(I('game_id', 0));
+ $status = intval(I('status', 0));
$map['chain'] = ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%'];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$ids[] = $this->loginPromote['id'];
$ids = implode(',', $ids);
$map = [];
$map['promote_id'] = ['in', $ids];
+ $map['pay_status'] = 1;
if (!empty($payOrderNumber)) {
$map['pay_order_number'] = $payOrderNumber;
}
-
+ if (!empty($gameId)) {
+ $map['game_id'] = $gameId;
+ }
if (!empty($begTime) && empty($endTime)) {
$map['pay_time'] = ['egt', $begTime];
} elseif (empty($begTime) && !empty($endTime)) {
@@ -430,6 +434,22 @@ class DownloadController extends BaseController {
} elseif (!empty($begTime) && !empty($endTime)) {
$map['pay_time'] = ['between', [$begTime, $endTime + 86399]];
}
+
+ if (isset($_GET['status'])) {
+ if ($status == -2) {
+ $map['selle_status'] = 0;
+ } else {
+ $withdrawMap['promote_id'] = $this->loginPromote['id'];
+ $withdrawMap['status'] = $status;
+ $withdrawIds = M('withdraw', 'tab_')->where($withdrawMap)->getField('id', true);
+
+ if (empty($withdrawIds)) {
+ $map = '1 = 2';
+ } else {
+ $map['withdraw_id'] = ['in', $withdrawIds];
+ }
+ }
+ }
$conditions = json_encode($map,TRUE);
$addtime = time();
$data = [
@@ -1485,7 +1505,7 @@ class DownloadController extends BaseController {
array_push($ids,PID);
}
- array_push($ids,$queryPromote['id']);
+ //array_push($ids,$queryPromote['id']);
if (!empty($ids)) {
$map['promote_id'] = ['in',$ids];
@@ -1530,7 +1550,7 @@ class DownloadController extends BaseController {
if (($playTimeEnd - $playTimeBegin) > 31 * 24 * 3600) {
$this->error('时间范围不能超过31天');
}
- $map['play_time'] = ['between', [$playTimeBegin, $playTimeEnd]];
+ $map['create_time'] = ['between', [$playTimeBegin, $playTimeEnd]];
}
if ($isSelf) {
$map['promote_id'] = $queryPromote['id'];
@@ -1758,7 +1778,8 @@ class DownloadController extends BaseController {
$xlsName = "注册明细";
$xlsCell = array(
array('account','玩家账号'),
- array('promote_account','推广账号'),
+ array('promote_account','推广账号'),
+ array('device_number','设备IMIE/IDFA'),
array('register_time','注册时间'),
array('register_ip','注册ip'),
array('login_time','登陆时间'),
@@ -1766,7 +1787,7 @@ class DownloadController extends BaseController {
);
$model = M('user','tab_');
- $data = $model->field('account,promote_account,register_time,register_ip,login_time,login_ip')->where($map)->select();
+ $data = $model->field('account,device_number,promote_account,register_time,register_ip,login_time,login_ip')->where($map)->order('tab_user.id desc')->select();
//var_dump($data);
$xlsData = [];
foreach ($data as $key1 => $value1) {
@@ -1788,12 +1809,14 @@ class DownloadController extends BaseController {
array('server_name','区服'),
array('role_name','游戏昵称'),
array('role_level','等级'),
+ array('create_time','创建时间'),
);
$model = M('user_play_info','tab_');
- $data = $model->field('user_account,promote_account,game_name,server_name,role_name,role_level')->where($map)->select();
+ $data = $model->field('user_account,promote_account,game_name,server_name,role_name,role_level')->where($map)->order('create_time desc')->select();
$xlsData = [];
foreach ($data as $key1 => $value1) {
$value1['user_account'] = $this->encryption($value1['user_account']);
+ $value1['create_time'] = date('Y-m-d H:i:s',$value1['create_time']);
$xlsData[] = $value1;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
@@ -1832,7 +1855,7 @@ class DownloadController extends BaseController {
$begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
$params['begin_time'] = $begTime;
- $params['end_time'] = $endTime;
+ $params['end_time'] = $endTime -1;
if(!empty($map['apply_time'][1])) {
$begTime = $map['apply_time'][1][0];
$endTime = $map['apply_time'][1][1];
@@ -2120,6 +2143,11 @@ class DownloadController extends BaseController {
foreach ($data as $key => $value) {
$value['create_time'] = date("Y-m-d H:i:s", $value['create_time']);
$value['user_account'] = $this->encryption($value['user_account']);
+ if($value['check_status'] == 1) {
+ $value['check_status'] = "正常";
+ }else {
+ $value['check_status'] = "拉黑";
+ }
//获取累计发放
$where = array(
"user_id"=>$value['user_id'],
@@ -2202,9 +2230,9 @@ class DownloadController extends BaseController {
$data[$key]['create_time'] = date('Y-m-d H:m:i',$value['create_time']);
$data[$key]['user_account'] = $this->encryption($value['user_account']);
if($value['check_status'] == 1) {
- $data[$key]['check_status'] = "冻结";
- }else {
$data[$key]['check_status'] = "启用";
+ }else {
+ $data[$key]['check_status'] = "冻结";
}
}
$xlsData = $data;
@@ -2431,7 +2459,7 @@ class DownloadController extends BaseController {
array('income','收益'),
array('pay_time','充值时间'),
array('selle_status','订单状态'),
- );
+ );
$model = M('spend', 'tab_');
$data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_time,selle_status,pay_status,withdraw_id')
->where($map)
@@ -2532,23 +2560,23 @@ class DownloadController extends BaseController {
}
public function dailysummaryExcelInfo($id,$map) {
- $xlsName = "每日概况";
- $xlsCell = array(
+ $xlsName = "每日概况";
+ $xlsCell = array(
array('day','日期'),
- array('role_num','创角数'),
- array('user_num','创角用户'),
+ array('role_num','创角数'),
+ array('user_num','创角用户'),
array('new_user_num','新创角用户'),
array('new_device_num','新创角设备'),
- array('new_ip_num','新增创角IP'),
- array('login_user_num','登陆用户数'),
- array('spend_user_num','充值人数'),
- array('spend_num','充值次数'),
- array('spend_all_amount','充值总额'),
- array('spend_cash','现金充值'),
- array('spend_generic','通用币充值'),
- array('spend_binding','绑定币充值'),
- array('spend_discount','折扣币充值'),
- array('spend_voucher','代金劵使用'),
+ array('new_ip_num','新增创角IP'),
+ array('login_user_num','登陆用户数'),
+ array('spend_user_num','充值人数'),
+ array('spend_num','充值次数'),
+ array('spend_all_amount','充值总额'),
+ array('spend_cash','现金充值'),
+ array('spend_generic','通用币充值'),
+ array('spend_binding','绑定币充值'),
+ array('spend_discount','折扣币充值'),
+ array('spend_voucher','代金劵使用'),
);
$nowTime = date('Y-m-d');
@@ -2575,7 +2603,7 @@ class DownloadController extends BaseController {
if(!empty($map['end_time'])) {
$params['end_time'] = $map['end_time'];
}else {
- $params['begin_time'] = $endTime;
+ $params['begin_time'] = $endTime - 1;
}
$params['dayList'] = $map["dayList"];
$summaryData = [];
@@ -2728,15 +2756,21 @@ class DownloadController extends BaseController {
);
$subMap = [];
- $subMap['game_id'] = $map['game_id'];
- $subMap['server_id'] = $map['server_id'];
+ if(!empty($map['game_id'])) {
+ $subMap['game_id'] = $map['game_id'];
+ }
+ if(!empty($map['server_id'])) {
+ $subMap['server_id'] = $map['server_id'];
+ }
$costBegin = $map['costbegin'];
$costEnd = $map['costend'];
unset($map['costbegin']);
unset($map['costend']);
- $roleIds = M('user_play_data_count', 'tab_')->group('role_id')->getField('role_id', true);
+
+ $subMap['create_time'] = ['between', [$map['begintime'], $map['endtime'] - 1]];
+ $roleIdMap = $subMap;
+ $roleIds = M('user_play_data_count', 'tab_')->where($roleIdMap)->group('role_id')->getField('role_id', true);
$map['role_id'] = ['in', $roleIds];
- $subMap['create_time'] = ['between', [$map['begintime'], $map['endtime'] - 1]];
if ($costBegin != '' || $costEnd != '') {
$having = '';
if ($costBegin != '' && $costEnd != '') {
@@ -2767,30 +2801,36 @@ class DownloadController extends BaseController {
->buildSql();
$spendMap['uc.create_time'] = ['between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]];
-
+
$sqlTodayCost = M('user_play_data_count', 'tab_')->alias('uc')
->field('sum(uc.recharge_count) count')
->where($spendMap)
->buildSql();
unset($map['begintime']);
unset($map['endtime']);
- $roles = M('user_play_info', 'tab_')
- ->field("*,$sqlCost as cost,$sqlCount as count,$sqlTodayCost as today_cost")
- ->where($map)
- ->order('play_time desc')
- ->select();
- foreach ($roles as $role) {
+ $subQuery = M('user_play_info', 'tab_')
+ ->field("*,$sqlCost as recharge_cost,$sqlCount as recharge_count,$sqlTodayCost as recharge_cost_today")
+ ->where($map)
+ ->having('recharge_cost > 0')
+ ->order('play_time desc')
+ ->buildSql();
+ $roles = M()->field(' * ')
+ ->table($subQuery)
+ ->alias('a')
+ ->order('play_time desc')
+ ->select();
+ foreach ($roles as $role) {
$records[] = [
- 'user_account' => $role['user_account'],
+ 'user_account' => encryption($role['user_account']),
'game_name' => $role['game_name'],
'role_name' => $role['role_name'],
'role_id' => $role['role_id'],
'role_level' => $role['role_level'],
'server_id' => $role['server_id'],
'server_name' => $role['server_name'],
- 'recharge_cost' => $role['cost'],
- 'recharge_count' => $role['count'],
- 'recharge_cost_today' => $role['cost_today'],
+ 'recharge_cost' => empty($role['recharge_cost']) ? 0 : $role['recharge_cost'],
+ 'recharge_count' => empty($role['recharge_count']) ? 0 : $role['recharge_count'],
+ 'recharge_cost_today' => empty($role['recharge_cost_today']) ? 0 : $role['recharge_cost_today'],
'play_time' => $role['play_time'],
'play_ip' => $role['play_ip'],
'promote_id' => $role['promote_id'],
diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php
index b783521f0..f8b4e8ceb 100644
--- a/Application/Home/Controller/FinanceController.class.php
+++ b/Application/Home/Controller/FinanceController.class.php
@@ -15,6 +15,7 @@ class FinanceController extends BaseController
{
//提现状态
public static $withdrawStatus = [
+ -2 => '已撤销',
-1 => '审核未通过',
0 => '待审核',
1 => '汇款中',
@@ -200,7 +201,7 @@ class FinanceController extends BaseController
$map['pay_order_number'] = $payOrderNumber;
}
if (isset($_GET['status'])) {
- if ($status == -2) {
+ if ($status == -99) {
$map['selle_status'] = 0;
} else {
$withdrawMap['promote_id'] = $this->loginPromote['id'];
@@ -277,8 +278,7 @@ class FinanceController extends BaseController
//是否是会长
$this->purview();
//验证安全密码
- $metaTitle = '结算明细';
- $modelList = ['财务管理', $metaTitle];
+ $modelList = [];
$res = $this->verifyPasswordView($modelList, false);
if ($res == false) {
$data['status'] = 0;
@@ -329,6 +329,7 @@ class FinanceController extends BaseController
$add['status'] = 0;
$add['widthdraw_number'] = $this->produceWithdrawNumber();
$add['settlement_end_time'] = $thisDay - 1;
+ $add['spend_ids'] = '';
M()->startTrans();//开启事物
$withdrawId = M('withdraw', 'tab_')->add($add);
@@ -399,11 +400,9 @@ class FinanceController extends BaseController
}
if (isset($_GET['status']) && $_GET['status'] !== '') {
$status = intval($_GET['status']);
- if (!isset(FinanceController::$withdrawStatus[$status])) {
- $this->error('参数异常');
+ if (isset(FinanceController::$withdrawStatus[$status])) {
+ $map['status'] = $status;
}
-
- $map['status'] = $status;
}
$data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond,transfer_proof')
@@ -420,8 +419,15 @@ class FinanceController extends BaseController
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
$list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']);
$list['status_name'] = FinanceController::$withdrawStatus[$list['status']];
- if ($list['status'] == -1) {
- $list['status_name'] = '' . $list['status_name'] . ' ';
+ switch ($list['status']) {
+ case -2:
+ $list['status_name'] = '' . $list['status_name'] . ' ';
+ break;
+ case -1:
+ $list['status_name'] = '' . $list['status_name'] . ' ';
+ break;
+ default:
+ break;
}
}
}
@@ -567,13 +573,52 @@ class FinanceController extends BaseController
}
//审核拒绝 重新审核
- public function renewReview($id)
+ public function renewReview()
{
//是否是会长
$this->purview();
//验证安全密码
- $metaTitle = '结算明细';
- $modelList = ['财务管理', $metaTitle];
+ $modelList = [];
+ $res = $this->verifyPasswordView($modelList, false);
+ if ($res == false) {
+ $data['status'] = 0;
+ $data['msg'] = '权限异常';
+ $this->ajaxReturn($data);
+ }
+
+ $id = intval(I('id', 0));
+ $data = M('withdraw', 'tab_')->find($id);
+ if (empty($data) || $data['status'] != -1) {
+ $data['status'] = 0;
+ $data['msg'] = '数据异常';
+ $this->ajaxReturn($data);
+ }
+ if ($data['promote_id'] != $this->loginPromote['id']) {
+ $data['status'] = 0;
+ $data['msg'] = '权限异常';
+ $this->ajaxReturn($data);
+ }
+
+ $save['status'] = 0;
+ $save['id'] = $id;
+ $res = M('withdraw', 'tab_')->save($save);
+ if ($res === false) {
+ $data['status'] = 0;
+ $data['msg'] = '提交失败';
+ } else {
+ $data['status'] = 1;
+ $data['msg'] = '提交成功';
+ }
+ $this->ajaxReturn($data);
+ }
+
+ //撤销提现
+ public function cancelWithdraw()
+ {
+ //是否是会长
+ $this->purview();
+ //验证安全密码
+ $modelList = [];
$res = $this->verifyPasswordView($modelList, false);
if ($res == false) {
$data['status'] = 0;
@@ -581,6 +626,54 @@ class FinanceController extends BaseController
$this->ajaxReturn($data);
}
- $id = intval($id);
+ $id = intval(I('id', 0));
+ $data = M('withdraw', 'tab_')->find($id);
+ if (empty($data) || !in_array($data['status'], [-1, 0])) {
+ $data['status'] = 0;
+ $data['msg'] = '数据异常';
+ $this->ajaxReturn($data);
+ }
+ if ($data['promote_id'] != $this->loginPromote['id']) {
+ $data['status'] = 0;
+ $data['msg'] = '权限异常';
+ $this->ajaxReturn($data);
+ }
+
+ $spendMap['withdraw_id'] = $id;
+ $spendIds = M('Spend', 'tab_')->where($spendMap)->getField('id', true);
+ if (empty($spendIds)) {
+ $data['status'] = 0;
+ $data['msg'] = '数据异常';
+ $this->ajaxReturn($data);
+ }
+ $spendIds = implode(',', $spendIds);
+ $time = time();
+ $withdrawSave['id'] = $id;
+ $withdrawSave['status'] = -2;
+ $withdrawSave['spend_ids'] = $spendIds;
+ $withdrawSave['last_up_update_time'] = $time;
+
+ M('withdraw', 'tab_')->startTrans();//开启事物
+ $withdrawRes = M('withdraw', 'tab_')->save($withdrawSave);
+ if ($withdrawRes === false) {
+ M('withdraw', 'tab_')->rollback();//事物回滚
+ $data['status'] = 0;
+ $data['msg'] = '撤销失败';
+ $this->ajaxReturn($data);
+ }
+
+ $spendSave['selle_status'] = 0;
+ $spendSave['withdraw_id'] = 0;
+ $spendRes = M('spend', 'tab_')->where($spendMap)->save($spendSave);
+ if ($spendRes === false) {
+ M('withdraw', 'tab_')->rollback();//事物回滚
+ $data['status'] = 0;
+ $data['msg'] = '撤销失败';
+ } else {
+ M('withdraw', 'tab_')->commit();//事物提交
+ $data['status'] = 1;
+ $data['msg'] = '撤销成功';
+ }
+ $this->ajaxReturn($data);
}
}
\ No newline at end of file
diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php
index ccfd6e84f..0335835b6 100644
--- a/Application/Home/Controller/PromoteController.class.php
+++ b/Application/Home/Controller/PromoteController.class.php
@@ -180,14 +180,14 @@ class PromoteController extends BaseController
$month_add_user_money = $this->pay_total(3, 1, $promoteId);
$yesterday_start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
- $yesterday_end = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
+ $yesterday_end = mktime(0, 0, 0, date('m'), date('d'), date('Y'))-1;
//计算昨天用户的统计数据,当日用户充值数据
$pay_time = " between {$yesterday_start} and {$yesterday_end}";
$createTime = ['between', array($yesterday_start, $yesterday_end - 1)];
- $yesterdaySpendData = $this->caculateSpend($pay_time, [], $createTime);
+// $yesterdaySpendData = $this->caculateSpend($pay_time, []);
+// var_dump($yesterdaySpendData);die();
$todayAddSpendData = $this->caculateSpend($pay_time, [], [], 1);
-// var_dump($todayAddSpendData);die();
$mounthAddSpendData = $this->caculateSpend($pay_time, [], [], 2);
@@ -209,7 +209,7 @@ class PromoteController extends BaseController
$this->assign('data', $data);
// $this->assign('yesterdayData',$yesterdayData);
$this->assign('spendData', $spendData);
- $this->assign('yesterdaySpendData', $yesterdaySpendData);
+// $this->assign('yesterdaySpendData', $yesterdaySpendData);
$this->assign('todayAddSpendData', $todayAddSpendData);
$this->assign('mounthAddSpendData', $mounthAddSpendData);
@@ -240,99 +240,131 @@ class PromoteController extends BaseController
private function caculateSpend($pay_time, $condition, $create = [], $type = 0)
{
+ $map1['promote_id'] = $map['promote_id'] = array('egt', 0);
$spend = M('Spend', 'tab_');
+ $map1['pay_status'] = $map['pay_status'] = 1;
$today = total(1);
+ $yesterday = total(5);
$week = total(2);
$mounth = total(3);
- $yesterday = total(5);
+ unset( $map['create_time']);
- $map1['promote_id'] = $map['promote_id'] = array('gt', 0);
- $map1['pay_status'] = $map['pay_status'] = 1;
- $map1['pay_way'] = $map['pay_way'] = array('gt', 0);
- $userId = [];
- $this->getLoginPromote();
+ $promote_id = get_pid();
$promoteId = M("promote", "tab_")
- ->where(array('chain' => ['like', $this->loginPromote['chain'] . $this->loginPromote['id'] . '/%']))
- ->getField('id', true);
- $promoteId[] = $this->loginPromote['id'];
+ ->field("id")
+ ->where(array('chain' => ['like', '/'.$promote_id . '/%'],'id'=>$promote_id,'_logic'=>'or'))
+ ->select();
+ $promoteId = implode(',',array_column($promoteId,'id'));
+
$whereUser['promote_id'] = ['IN', $promoteId];
if ($type == 1) {
+ $pay_time = total(1);
$start = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$end = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
$whereUser['register_time'] = ['between', array($start, $end - 1)];
$userId = M('user', 'tab_')->field('id')->where($whereUser)->select();
} else if ($type == 2) {
+ $pay_time = total(3);
$start = mktime(0, 0, 0, date('m'), 1, date('Y'));
$end = mktime(0, 0, 0, date('m') + 1, 1, date('Y')) - 1;
$whereUser['register_time'] = ['between', array($start, $end - 1)];
$userId = M('user', 'tab_')->field('id')->where($whereUser)->select();
}
+// if ($userId) {
+// var_dump($userId);
+// }
- $userId = implode(',', array_column($userId, 'id'));
if ($userId) {
+
+ $userId = implode(',', array_column($userId, 'id'));
+// var_dump($userId);
$map1['user_id'] = $map['user_id'] = ['IN', $userId];
} else if (!$userId && $type != 0) {
- return array('today' => 0, 'mounth' => 0);
- }
-
- if ($create) {
- $map['create_time'] = $create;
- }
-
-
- $bindrecharge_data = M('bind_recharge', 'tab_')
- ->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time,
- floor(sum(IF(create_time ' . $pay_time . ',real_amount,0))*100) as scount,
- floor(sum(IF(create_time ' . $today . ',real_amount,0))*100) as today,
- floor(sum(IF(create_time ' . $week . ',real_amount,0))*100) as week,
- floor(sum(IF(create_time ' . $mounth . ',real_amount,0))*100) as mounth')
- ->where($map1)
- ->group('promote_id')
- ->select(false);
-
- $deposit_data = M('deposit', 'tab_')
- ->field('max(id) as id,promote_account,promote_id,create_time as ordertime,date_format(FROM_UNIXTIME(create_time),"%Y-%m-%d") AS time,
- floor(sum(IF(create_time ' . $pay_time . ',pay_amount,0))*100) as scount,
- 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')
- ->where($map1)
- ->group('promote_id')
- ->select(false);
-
- $spendData = $spend
- ->field('max(id) as id,promote_account,promote_id,pay_time as ordertime,date_format(FROM_UNIXTIME(pay_time),"%Y-%m-%d") AS time,
- floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as scount,
- 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')
- ->where($map)
- ->union(' (' . $bindrecharge_data . ') ')
- ->union(' (' . $deposit_data . ') ')
- ->group('promote_id')
- ->select(false);
+ return array('sum_mounth' => 0, 'sum_today' => 0);
+ }
- $promote_id = get_pid();
- $promote_map = "tp1.`id` = {$promote_id}";
+ //获取所有会长
+ $promote_map = "`chain` = '%/{$promote_id}/%' OR id = {$promote_id}";
- $data = $spend->field('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, '/%') OR tp1.id = tp2.id where $promote_map ) AS t ON promote_id = t.id")
- ->where($condition)->table('(' . $spendData . ') as a')->group()->order('count desc,a.ordertime')->find();
+ $promote = M("promote","tab_")->field("id,account")->where($promote_map)->select();
+ $data =array();
+ for ($i=0; $i < count($promote); $i++) {
+ # code...
+ $proid = M("promote","tab_")->field("id")->where("`chain` like '%/{$promote[$i]['id']}/%'")->select();
+ $str = '';
+ for($k=0; $kfield('
+ floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as count,
+ floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today,
+ floor(sum(IF(pay_time ' . $yesterday . ',pay_amount,0))*100) as yesterday,
+ floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week,
+ floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
+ ->where($map)
+ ->where("pay_time".$pay_time)
+ ->find();
+ $dbdata['promote_account'] = $promote[$i]['account'];
+ } else {
+ $dbdata = $spend
+ ->field('
+ floor(sum(IF(pay_time ' . $pay_time . ',pay_amount,0))*100) as count,
+ floor(sum(IF(pay_time ' . $today . ',pay_amount,0))*100) as today,
+ floor(sum(IF(pay_time ' . $yesterday . ',pay_amount,0))*100) as yesterday,
+ floor(sum(IF(pay_time ' . $week . ',pay_amount,0))*100) as week,
+ floor(sum(IF(pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
+ ->where($map)
+ ->where("pay_time".$pay_time)
+ ->find();
+ $dbdata['promote_account'] = $promote[$i]['account'];
+ }
+ $data[] = $dbdata;
+ }
+// if ($userId) {
+// echo $spend->_sql();die();
+// }
+ foreach ($data as $key => $value) {
+ $value['count'] ?: 0;
+ $value['today'] ?: 0;
+ $value['week'] ?: 0;
+ $value['mounth'] ?: 0;
+ static $i = 0;
+ $i++;
+ $data[$key]['rand'] = $i;
+ $data[$key]['count'] = $value['count'] / 100;
+ $data[$key]['today'] = $value['today'] / 100;
+ $data[$key]['yesterday'] = $value['yesterday'] / 100;
+ $data[$key]['week'] = $value['week'] / 100;
+ $data[$key]['mounth'] = $value['mounth'] / 100;
+ }
+ $total = $this->data_total($data);
- $spendData1 = $spend->field('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, '/%') ) AS t ON promote_id = t.id")
- ->where($condition)->table('(' . $spendData . ') as a')->group()->order('count desc,a.ordertime')->find();
+ return $total;
+//
- $data['rand'] = 1;
- $data['count'] = $data['count'] / 100;
- $data['today'] = $spendData1['today'] / 100;
- $data['week'] = $spendData1['week'] / 100;
- $data['mounth'] = $spendData1['mounth'] / 100;
+ }
- return $data;
+ public function data_total($data)
+ {
+ $total['sum_count'] = array_sum(array_column($data, 'count'));
+ $total['sum_today'] = array_sum(array_column($data, 'today'));
+ $total['yesterday'] = array_sum(array_column($data, 'yesterday'));
+ $total['sum_week'] = array_sum(array_column($data, 'week'));
+ $total['sum_mounth'] = array_sum(array_column($data, 'mounth'));
+ return $total;
}
private function pay_total($type = 0, $newadd = 1, $promoteId = "")
@@ -867,6 +899,7 @@ class PromoteController extends BaseController
$realName = I('real_name', '');
$status = I('status', 'all');
$promoteType = I('promote_type', 0);
+ $parentId = I('parent_id', 0);
$loginer = $this->getLoginPromote();
$map = [];
@@ -892,6 +925,9 @@ class PromoteController extends BaseController
if ($realName) {
$map['real_name'] = ['like', '%' . $realName . '%'];
}
+ if ($parentId) {
+ $map['parent_id'] = $parentId;
+ }
if ($status != 'all') {
$map['status'] = ['eq', $status];
}
@@ -899,10 +935,8 @@ class PromoteController extends BaseController
list($records, $pagination, $count) = $this->paginate($query);
foreach ($records as $key => $value) {
-
$records[$key]['idcard'] = encryption($value['idcard']);
$records[$key]['mobile_phone'] = encryption($value['mobile_phone']);
-
}
$ids = array_column($records, 'id');
@@ -941,6 +975,23 @@ class PromoteController extends BaseController
$promoteTypeName = '推广员';
}
+ $parentMap = [];
+ $parentMap['chain'] = ['like', $loginer['chain'] . $loginer['id'] . '/%'];
+ $isGetParents = true;
+ if ($loginer['level'] == 1 && $promoteType == 1) {
+ $parentMap['level'] = 2;
+ } elseif ($loginer['level'] == 1 && $promoteType == 2) {
+ $parentMap['level'] = 3;
+ } elseif ($loginer['level'] == 2 && $promoteType == 2) {
+ $parentMap['level'] = 3;
+ } else {
+ $isGetParents = false;
+ }
+ $parents = null;
+ if ($isGetParents) {
+ $parents = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where($parentMap)->select();
+ }
+ $this->assign('parents', $parents);
$this->assign('promoteTypeName', $promoteTypeName);
$this->assign('hasChildList', $hasChildList);
$this->assign('hasPlayerList', $hasPlayerList);
diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php
index bbbf0f56d..c4d6fa044 100644
--- a/Application/Home/Controller/QueryController.class.php
+++ b/Application/Home/Controller/QueryController.class.php
@@ -1066,7 +1066,7 @@ class QueryController extends BaseController
$params['server_id'] = $serverId;
}
$params['begin_time'] = $begTime;
- $params['end_time'] = $endTime;
+ $params['end_time'] = $endTime - 1;
$summaryData = [];
$dayList = $this->getDayList($begTime, $endTime);
@@ -1227,7 +1227,7 @@ class QueryController extends BaseController
}
$params['begin_time'] = $begTime;
- $params['end_time'] = $endTime;
+ $params['end_time'] = $endTime - 1;
$data = M('Apply', 'tab_')->alias('a')
->field('a.game_id,a.game_name,a.sdk_version')
@@ -1769,9 +1769,10 @@ class QueryController extends BaseController
$map['promote_id'] = $queryPromote['id'];
}
- $roleIds = M('user_play_data_count', 'tab_')->group('role_id')->getField('role_id', true);
- $map['role_id'] = ['in', $roleIds];
$subMap['create_time'] = ['between', [$begTime, $endTime - 1]];
+ $roleIdMap = $subMap;
+ $roleIds = M('user_play_data_count', 'tab_')->where($roleIdMap)->group('role_id')->getField('role_id', true);
+ $map['role_id'] = ['in', $roleIds];
if ($costBegin != '' || $costEnd != '') {
$having = '';
if ($costBegin != '' && $costEnd != '') {
@@ -1833,7 +1834,7 @@ class QueryController extends BaseController
->having('recharge_cost > 0')
->order('play_time desc')
->buildSql();
- $query = M()->field(' * ')
+ $query = M()->field('*')
->table($subQuery)
->alias('a')
->order($orderBy);
@@ -2133,31 +2134,4 @@ class QueryController extends BaseController
$this->ajaxReturn($data);
}
-
- public function userPlayDataCount()
- {
- $time = strtotime(date('Y-m-d 00:00:00', time() - (3600 * 24)));
- $spendMap['pay_status'] = 1;
- $spendMap['pay_game_status'] = 1;
- $spendMap['game_player_id'] = ['gt', 0];
- $spendMap['pay_time'] = ['between', [$time, strtotime(date('Y-m-d 23:59:59', $time))]];
-
- $field = 'FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count';
- $spendCostData = M('spend', 'tab_')->field($field)
- ->where($spendMap)
- ->group('day,game_player_id,server_id,game_id')
- ->select();
-
- $data = [];
- foreach ($spendCostData as $list) {
- $save['game_id'] = $list['game_id'];
- $save['server_id'] = $list['server_id'];
- $save['role_id'] = $list['game_player_id'];
- $save['recharge_cost'] = $list['recharge_cost'];
- $save['recharge_count'] = $list['recharge_count'];
- $save['create_time'] = strtotime($list['day']);
- $data[] = $save;
- }
- M('user_play_data_count', 'tab_')->addAll($data);
- }
}
diff --git a/Application/Home/Controller/SafeController.class.php b/Application/Home/Controller/SafeController.class.php
index f411f529a..260dc2c8c 100644
--- a/Application/Home/Controller/SafeController.class.php
+++ b/Application/Home/Controller/SafeController.class.php
@@ -443,38 +443,13 @@ class SafeController extends BaseController{
public function safeDocument() {
$time = time();
- $today = date('Y-m-d');
- $username = $_REQUEST['username'];
- $tsession =S($today);
- if(S($username)) {
- $code = S($username);
- }else {
- if(!empty($tsession)) {
- $num = $tsession + 1;
- }else {
- $num = 1;
- }
- $promoteRs = M('promote','tab_')->where(['account'=>$username])->getField('create_time',true);
- $code = date('Ymd',$promoteRs[0])."_".$num;
- }
+ $loginPromote = $this->getLoginPromote();
+ $sn = date('Ymd') . '-' . strtoupper(substr(md5($loginPromote['id']), 8, 16));
$endTime = date('Y-m-d',strtotime('+1 year'));
$this->assign('time',date('Y-m-d',$time));
$this->assign('endTime',$endTime);
- $this->assign('code',$code);
- $this->assign('username',$username);
+ $this->assign('sn',$sn);
$this->display();
}
-
- public function ajaxAgree() {
- $username = $_REQUEST['username'];
- $code = $_REQUEST['code'];
- $today = date('Y-m-d');
- if(empty(S($username))) {
- S($username, $code);
- $t = S($today);
- S($today,$t+1);
- }
- $this->ajaxReturn(['code'=>10000]);
- }
}
\ No newline at end of file
diff --git a/Application/Home/View/default/Finance/settlementDtl.html b/Application/Home/View/default/Finance/settlementDtl.html
index 2cbb07ea2..aefcaf46a 100644
--- a/Application/Home/View/default/Finance/settlementDtl.html
+++ b/Application/Home/View/default/Finance/settlementDtl.html
@@ -103,8 +103,8 @@
+
+
@@ -174,9 +178,12 @@
汇款证明
- 重新审核
+ 重新审核
+
+
结算单
+
+ 撤销提现
-
结算单
@@ -269,6 +276,59 @@
});
$(".select_gallery").select2();
+
+ $('.renew-review').click(function () {
+ var id = parseInt($(this).attr('data-id'));
+
+ $.ajax({
+ type: 'post',
+ url: '{:U("renewReview")}',
+ dataType: 'json',
+ data: {id:id},
+ success: function (data) {
+ if (data.status == 1) {
+ layer.msg(data.msg, {icon: 1});
+ setTimeout(function(){
+ window.location.reload();
+ },2000);
+ } else {
+ layer.msg(data.msg, {icon: 5});
+ }
+ },
+ error: function (result) {
+ layer.msg('网络异常', {icon: 5});
+ }
+ });
+ });
+
+ $('.cancel-withdraw').click(function () {
+ var id = parseInt($(this).attr('data-id'));
+ var msg = "确定要撤销提现吗?";
+ layer.confirm(msg, {
+ title: '提示',
+ btn: ['确定', '取消'],
+ }, function () {
+ $.ajax({
+ type: 'post',
+ url: '{:U("cancelWithdraw")}',
+ dataType: 'json',
+ data: {id:id},
+ success: function (data) {
+ if (data.status == 1) {
+ layer.msg(data.msg, {icon: 1});
+ setTimeout(function(){
+ window.location.reload();
+ },2000);
+ } else {
+ layer.msg(data.msg, {icon: 5});
+ }
+ },
+ error: function (result) {
+ layer.msg('网络异常', {icon: 5});
+ }
+ });
+ });
+ });
});
diff --git a/Application/Home/View/default/Promote/children.html b/Application/Home/View/default/Promote/children.html
index 52e049283..d0a0eaef7 100644
--- a/Application/Home/View/default/Promote/children.html
+++ b/Application/Home/View/default/Promote/children.html
@@ -31,6 +31,16 @@
selected>冻结中
+
+
+
+ 请选择上级
+
+ selected>=$parent['account']?>(=$parent['real_name']?>)
+
+
+
+
diff --git a/Application/Home/View/default/Promote/index.html b/Application/Home/View/default/Promote/index.html
index eeeb5b479..0c550f33c 100644
--- a/Application/Home/View/default/Promote/index.html
+++ b/Application/Home/View/default/Promote/index.html
@@ -6,15 +6,15 @@
-
- 当日新增用户充值
¥{$todayAddSpendData.today}
- 当月新增用户充值
¥{$mounthAddSpendData.mounth}
+ 推广总充值
¥{$spendData.sum_count}
+ 当日新增用户充值
¥{$todayAddSpendData.sum_today}
+ 当月新增用户充值
¥{$mounthAddSpendData.sum_mounth}
- 昨日充值金额
¥{$yesterdaySpendData.count}
+ 昨日充值金额
¥{$spendData.yesterday}
- 今日充值金额
¥{$spendData.today}
+ 今日充值金额
¥{$spendData.sum_today}
diff --git a/Application/Home/View/default/Query/userRecharges.html b/Application/Home/View/default/Query/userRecharges.html
index f09abebed..b760808bc 100644
--- a/Application/Home/View/default/Query/userRecharges.html
+++ b/Application/Home/View/default/Query/userRecharges.html
@@ -172,7 +172,7 @@
diff --git a/Application/Home/View/default/Query/userRoles.html b/Application/Home/View/default/Query/userRoles.html
index 5ceef8dfb..81e70c274 100644
--- a/Application/Home/View/default/Query/userRoles.html
+++ b/Application/Home/View/default/Query/userRoles.html
@@ -60,7 +60,7 @@
~
-
diff --git a/Application/Home/View/default/Safe/safeDocument.html b/Application/Home/View/default/Safe/safeDocument.html
index a2f05aaf3..3395e8ae0 100644
--- a/Application/Home/View/default/Safe/safeDocument.html
+++ b/Application/Home/View/default/Safe/safeDocument.html
@@ -51,7 +51,7 @@ and open the template in the editor.
游戏推广服务框架协议
本协议由以下双方于{$time} 签订:
-
合同编号:{$code}
+
合同编号:{$sn}
甲方:海南万盟天下科技有限公司
注册地址:海南省海口市南海大道26号海口国家高新区创业孵化中心A楼5层A1-1268室
联系电话:13067391751
@@ -237,8 +237,6 @@ and open the template in the editor.
同意
-
-
@@ -247,20 +245,10 @@ and open the template in the editor.
$(function() {
- var username = document.getElementById('us').value;
- var code = document.getElementById('code').value;
$("#ag").on('click',function(event) {
- $.ajax({
- type:"POST",
- url:"{:U('Safe/ajaxAgree')}",
- data:{'username':username,'code':code},
- dataType:'json',
- success:function(res) {
- window.localStorage.setItem('checked','checked');
- window.history.back(-1);
- }
- });
- })
+ window.localStorage.setItem('checked','checked');
+ window.location.href = "/index.php?s=/Home/Safe/modifyBaseInfo.html"
+ });
})
diff --git a/Application/Media/View/default/Article/article/detail1.html b/Application/Media/View/default/Article/article/detail1.html
index 01d500f9e..06fb0b828 100644
--- a/Application/Media/View/default/Article/article/detail1.html
+++ b/Application/Media/View/default/Article/article/detail1.html
@@ -239,7 +239,7 @@
-
+
\ No newline at end of file
diff --git a/Application/Media/View/default/Index/hezuo.html b/Application/Media/View/default/Index/hezuo.html
index 67a827811..54afc010c 100644
--- a/Application/Media/View/default/Index/hezuo.html
+++ b/Application/Media/View/default/Index/hezuo.html
@@ -1,4 +1,3 @@
-
@@ -8,6 +7,25 @@
+
+
+
+
+
+
+
@@ -17,14 +35,14 @@
万盟天下一直坚持开放诚信高效的业务合作,欢迎各位业界同仁前来联系,互利共赢。
-
媒体合作
+
商务合作
万盟天下一直希望通过广泛的市场及品牌合作,为用户提供更全面的产品与服务。
-
联系方式
-
公司地址:福建省福州市鼓楼区福大怡山文化创意园11号楼103号
-
联系人: 雷女士
-
联系电话: 13067391751
+
联系方式
+
公司地址:福建省福州市鼓楼区福大怡山文化创意园11号楼103号
+
联系人: 雷女士
+
联系电话: 13067391751
邮政编码:350004
@@ -55,11 +73,13 @@
-
+
-
+
+
+
diff --git a/Application/Media/View/default/Public/base.html b/Application/Media/View/default/Public/base.html
index aa74b0327..390161505 100644
--- a/Application/Media/View/default/Public/base.html
+++ b/Application/Media/View/default/Public/base.html
@@ -95,7 +95,7 @@
-
+
@@ -165,6 +165,10 @@ $(function() {
});
+
+
+
+