Merge branches 'dev' and 'dev_zyx' of 47.111.118.107:/srv/git/platform into dev_zyx

master
zhengyongxing 5 years ago
commit 96df83ebfb

@ -96,7 +96,7 @@ $(document).ready(function () {
<tr>
<td>【游戏充值】</td>
<td>游戏充值待补单数</td>
<td><a href="{:U('Spend/lists',array('model'=>'spend','pay_status'=>1,'pay_game_status'=>0))}" target="_blank"><span>{$daiban['spenc']}</span></a></td>
<td><a href="{:U('Spend/lists',array('model'=>'spend','pay_status'=>1,'pay_game_status'=>0, 'timestart'=>'2019-1-1'))}" target="_blank"><span>{$daiban['spenc']}</span></a></td>
</tr>
<tr>
<td>【APP安卓分包】</td>

@ -254,13 +254,15 @@ function all_pay_way($type=false)
$pay_way[1]=array('key'=>-1,'value'=>"绑币");
$pay_way[2]=array('key'=>1,'value'=>"支付宝");
$pay_way[3]=array('key'=>2,'value'=>"微信");
$pay_way[7]=array('key'=>8,'value'=>'金猪');
$pay_way[9]=array('key'=>9,'value'=>"双乾支付-支付宝");
$pay_way[10]=array('key'=>10,'value'=>"双乾支付-银联");
// $pay_way[3]=array('key'=>3,'value'=>'微信APP');
// $pay_way[4]=array('key'=>4,'value'=>'威富通');
/* $pay_way[4]=array('key'=>5,'value'=>'聚宝云'); */
// $pay_way[5]=array('key'=>6,'value'=>'汇付宝');
/* $pay_way[6]=array('key'=>7,'value'=>"苹果支付");
*/
$pay_way[7]=array('key'=>8,'value'=>'金猪');
$pay_way[15]=array('key'=>15,'value'=>'双乾支付-快捷');
return $pay_way;
}
@ -1446,6 +1448,8 @@ function cash_pay_way()
/* $pay_way[6]=array('key'=>7,'value'=>"苹果支付");
*/
$pay_way[7]=array('key'=>8,'value'=>'金猪');
$pay_way[9]=array('key'=>9,'value'=>"双乾支付-支付宝");
$pay_way[10]=array('key'=>10,'value'=>"双乾支付-银联");
$pay_way[15]=array('key'=>15,'value'=>'双乾支付-快捷');
return $pay_way;
}
@ -1493,6 +1497,18 @@ function getPayType($type) {
case 6:
$return = '竣付通';
break;
case 7:
$return = '金猪';
break;
case 9:
$return = '双乾支付-支付宝';
break;
case 10:
$return = '双乾支付-银联';
break;
case 15:
$return = '双乾支付-快捷';
break;
default:
$return = '未知';
break;

@ -907,6 +907,7 @@ public function auto_rrdae(){
{
$res = M('user_play_data_count', 'tab_')->order('id asc')->find();
if (empty($res)) {
ini_set('memory_limit','500M');
$time = strtotime(date('Y-m-d 00:00:00', time()));
$map['pay_time'] = ['lt', $time];
@ -923,6 +924,7 @@ public function auto_rrdae(){
$map['pay_status'] = 1;
$map['pay_game_status'] = 1;
$map['game_player_id'] = ['gt', 0];
$map['server_id'] = ['gt', 0];
$field = 'FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,promote_id,user_id,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count';
$spendData = M('spend', 'tab_')->field($field)
->where($map)
@ -931,17 +933,20 @@ public function auto_rrdae(){
if (!empty($spendData)) {
$data = [];
foreach ($spendData as $list) {
$save['promote_id'] = $list['promote_id'];
$save['user_id'] = $list['user_id'];
$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;
foreach ($spendData as &$list) {
$data[] = [
'promote_id' => $list['promote_id'],
'user_id' => $list['user_id'],
'game_id' => $list['game_id'],
'server_id' => $list['server_id'],
'role_id' => $list['game_player_id'],
'recharge_cost' => $list['recharge_cost'],
'recharge_count' => $list['recharge_count'],
'create_time' => strtotime($list['day']),
];
unset($list);
}
unset($spendData);
M('user_play_data_count', 'tab_')->addAll($data);
}
}

@ -89,12 +89,22 @@ class ConsoleController extends Think {
}
}
public function modifyLoginRepair()
{
$this->modifyLogin(1569686400);
}
public function modifyLoginGenerate()
{
$this->modifyLogin(strtotime(date("Y-m-d"))-86400);
}
/**
* 登录校验
*/
public function modifyLogin()
private function modifyLogin($start_time=0)
{
$start_time = $current_time = strtotime(date("Y-m-d"));
$current_time = strtotime(date("Y-m-d"))-86400;
for ($i=$start_time; $i<=$current_time; $i+=86400) {
$end_time = $i+86400;
$result = M()->query("SELECT
@ -129,29 +139,14 @@ class ConsoleController extends Think {
public function deleteRepeatUserPlayInfo()
{
/* INSERT INTO `tab_server`(`game_id`, `game_name`, `server_name`, `server_num`, `recommend_status`, `show_status`, `stop_status`, `server_status`, `icon`, `start_time`, `desride`, `prompt`, `parent_id`, `create_time`, `server_version`, `developers`, `server_id`) VALUES
(148, '王者纷争(安卓版)', 'O3-潜龙于渊', 3294, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3294'),
(148, '王者纷争(安卓版)', 'O4-攻心为上', 3301, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3301'),
(148, '王者纷争(安卓版)', 'O5-知人善用', 3311, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3311'),
(148, '王者纷争(安卓版)', 'O8-剑拔弩张', 3332, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3332'),
(148, '王者纷争(安卓版)', 'O12-七擒七纵', 3336, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3336'),
(148, '王者纷争(安卓版)', 'O15-遮空蔽日', 3375, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3375'); */
$gameIds = [157, 155, 153, 150, 151, 148, 175, 142, 143, 172, 173, 155, 154];
foreach($gameIds as $gameId) {
$this->doDeleteRepeatUserPlayInfo($gameId);
}
}
// $gameId = 157;
// $gameId = 155;
// $gameId = 153;
// $gameId = 150;
// $gameId = 151;
// 需要先执行上面sql插入区服才能清理干净
// $gameId = 148;
// $gameId = 175;
// $gameId = 142;
// $gameId = 143;
// $gameId = 172;
// $gameId = 173;
// $gameId = 155;
// $gameId = 154;
$gameId = 153;
public function doDeleteRepeatUserPlayInfo($gameId)
{
$sql = 'select id from tab_user_play_info a left join (
select role_id, server_id, game_id, count(1) from tab_user_play_info where server_id="' . $serverId . '" and game_id = ' . $gameId . ' GROUP BY role_id, server_id, game_id, server_name having count(1) > 1
) b on a.role_id=b.role_id where a.server_id=b.server_id and a.game_id=b.game_id and a.server_id="' . $serverId . '" and a.game_id = ' . $gameId . ' order by a.role_id, a.server_id, a.game_id';
@ -198,24 +193,14 @@ class ConsoleController extends Think {
public function deleteRepeatUserPlayInfo2()
{
// $gameId = 157;
// $gameId = 148;
// $gameId = 150;
// $gameId = 151;
// $gameId = 158;
// $gameId = 175;
// $gameId = 142;
// $gameId = 143;
// $gameId = 172;
// $gameId = 173;
// $gameId = 154;
// $gameId = 155;
// $gameId = 176;
// $gameId = 165;
// $gameId = 164;
// $gameId = 179;
// $gameId = 156;
$gameId = 153;
$gameIds = [157, 148, 150, 151, 158, 175, 142, 143, 172, 173, 154, 155, 176, 165, 164, 179, 156, 153];
foreach ($gameIds as $gameId) {
$this->doDeleteRepeatUserPlayInfo2($gameId);
}
}
public function doDeleteRepeatUserPlayInfo2($gameId)
{
$sql = 'select id from tab_user_play_info a left join (
select role_id, server_id, game_id, count(1) from tab_user_play_info where server_id="' . $serverId . '" and game_id = ' . $gameId . ' GROUP BY role_id, server_id, game_id, server_name having count(1) > 1
) b on a.role_id=b.role_id where a.server_id=b.server_id and a.game_id=b.game_id and a.server_id="' . $serverId . '" and a.game_id = ' . $gameId . ' order by a.role_id, a.server_id, a.game_id';

@ -196,7 +196,7 @@ class ExportController extends Controller
}
break;
case 3:
if($_REQUEST['type']==2){
if($_REQUEST['type']==2){
// $xlsCell = array(
// array('id', L('Account_number_ID')),
// array('register_type', L('Third_party_source'), "get_registertype", '*'),
@ -213,15 +213,14 @@ class ExportController extends Controller
// array('register_ip', L('Register_iP')),
// array('lock_status', L('Account_status'), 'get_info_status', '*', '4'),
// );
$field = 'a.id,a.account,a.id as get_registertype,a.promote_account,a.balance,IFNULL(sum(ss.pay_amount),0) as recharge_total,
a.gold_coin,a.alipay,a.id as small_count,a.id as vip_level,a.register_type
,a.register_ip,a.login_time,a.device_number,a.lock_status,check_status,a.age_status,a.register_way,
a.register_type';
$xlsCell = [L('Account_number_ID'),"第三方来源","绑定账号",L('Subordinate_channel'), "账户平台币"
, "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", L('Registration_time'),
L('Register_iP'), "最后登录时间","设备号", L('Account_status'),"拉黑状态"];
// $map['tab_user.register_type']= ['in','3,4,5,6'];
}else{
$field = 'tab_user.id,tab_user.register_type,tab_user.account,tab_user.promote_account,tab_user.balance
,IFNULL(sum(ss.pay_amount),0) AS recharge_total,tab_user.gold_coin,tab_user.alipay,tab_user.id as small_count,
tab_user.id as vip_level,register_time,tab_user.login_time,tab_user.register_ip,tab_user.lock_status,
tab_user.age_status,tab_user.register_way';
$xlsCell = [L('Account_number_ID'),L('Third_party_source'),"玩家账号",L('Subordinate_channel'), "账户平台币"
, "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", L('Registration_time'), "最后登录时间", L('Register_iP'), L('Account_status')];
$map['tab_user.register_type']= ['in','3,4,5,6'];
}else{
// $xlsCell = array(
// array('id', L('Account_number_ID')),
// array('account', "玩家账号"),
@ -238,192 +237,111 @@ class ExportController extends Controller
// array('register_ip', L('Register_iP')),
// array('lock_status', L('Account_status'), 'get_info_status', '*', '4'),
// );
$field = 'a.id,a.account,a.promote_account,a.balance,IFNULL(sum(ss.pay_amount),0) as recharge_total,
a.gold_coin,a.alipay,a.id as small_count,a.id as vip_level,a.register_type,a.register_time
,a.register_ip,a.login_time,a.device_number,a.lock_status,check_status,a.age_status,a.register_way,
a.register_type';
$xlsCell = [L('Account_number_ID'),"玩家账号",L('Subordinate_channel'), "账户平台币"
, "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", "注册方式", L('Registration_time'),
L('Register_iP'), "最后登录时间","设备号", L('Account_status'),"拉黑状态"];
$map['tab_user.register_type']=['in','1,2'];
$map['tab_user.register_type']=['in','0,1,2,7'];
}
$hav = '';
$field = 'tab_user.id,tab_user.account,tab_user.promote_account,tab_user.balance,
IFNULL(sum(ss.pay_amount),0) AS recharge_total,tab_user.gold_coin,tab_user.alipay
,tab_user.id as small_count,tab_user.id as vip_level,tab_user.register_type,register_time,tab_user.login_time
,tab_user.register_ip,tab_user.lock_status,tab_user.age_status,tab_user.register_way';
$xlsCell = [L('Account_number_ID'),"玩家账号",L('Subordinate_channel'), "账户平台币"
, "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", "注册方式", L('Registration_time'),
"最后登录时间", L('Register_iP'), L('Account_status')];
$map['tab_user.register_type']=['in','1,2'];
$map['tab_user.register_type']=['in','0,1,2,7'];
}
if (isset($_REQUEST['user_id'])) {
$map['tab_user.id'] = $_REQUEST['user_id'];
unset($_REQUEST['user_id']);
}
if (isset($_REQUEST['device_number'])) {
$map['tab_user.device_number'] = $_REQUEST['device_number'];
unset($_REQUEST['device_number']);
}
if ($_REQUEST['promote_id'] != '') {
if ($_REQUEST['promote_id'] == 'UC') {
$maps['tab_user.promote_account'] = 'UC用户';
$hav .= "tab_user.promote_account = 'UC用户' ";
} else if ($_REQUEST['promote_id'] == 0) {
$maps['tab_user.promote_id'] = 0;
$hav .= "tab_user.promote_id = 0";
} else {
if($_REQUEST['promote_id']=='UC'){
$map['tab_user.promote_account'] = 'UC用户';
} else if ($_REQUEST['promote_id']==0) {
$map['tab_user.promote_id'] = 0;
} else{
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
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')) . ") ";
$map['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
$spendprom = " AND ss.promote_id IN (" . implode(',', array_column($promoter_ids, 'id')) . ") ";
}
}
}
if (I('type', 1) == 1) {
if (isset($_GET['register_way'])) {
$game_map = "";
if (isset($_REQUEST['game_name'])) {
$game_map .= " and tab_user_play.game_id in (".implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')).")";
}
$game_play_map = '';
if (isset($_REQUEST['server_name'])) {
$game_play_map .= " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' ";
}
// if (isset($_REQUEST['promote_account'])) {
// $map['promote_id'] = get_promote_id(trim(I('promote_account')));
// 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 (1)';
$maps['tab_user.register_type'] = 1;
} elseif ($_GET['register_way'] == 7) {
$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 {
}else {
empty($hav) || $hav .= ' AND ';
$hav .= ' tab_user.register_type in(2)';
$maps['tab_user.register_type'] = 2;
}
} else {
empty($hav) || $hav .= ' AND ';
$hav .= ' tab_user.register_type in (1,2,7)';
$maps['tab_user.register_type'] = ['in', [1, 2, 7]];
}
} else {
if (isset($_GET['register_type'])) {
empty($hav) || $hav .= ' AND ';
$hav .= ' tab_user.register_type = ' . $_GET['register_type'];
$maps['tab_user.register_type'] = $_GET['register_type'];
} else {
empty($hav) || $hav .= ' AND ';
$hav .= ' tab_user.register_type in (0,3,4,5,6)';
$maps['tab_user.register_type'] = ['in', [0, 3, 4, 5, 6]];
}
}
if (isset($_REQUEST['user_id'])) {
empty($hav) || $hav .= ' AND ';
$hav .= "tab_user.id = '{$_REQUEST['user_id']}'";
$maps['tab_user.id'] = $_REQUEST['user_id'];
unset($_REQUEST['user_id']);
}
if (isset($_REQUEST['account'])) {
empty($hav) || $hav .= ' AND ';
$hav .= "tab_user.account like '%" . I('account') . "%'";
$maps['tab_user.account'] = ['like', "%" . I('account') . "%"];
unset($_REQUEST['account']);
}
if (isset($_REQUEST['device_number'])) {
empty($hav) || $hav .= ' AND ';
$hav .= "tab_user.device_number = '{$_REQUEST['device_number']}'";
$maps['tab_user.device_number'] = $_REQUEST['device_number'];
unset($_REQUEST['device_number']);
}
if (isset($_REQUEST['age_status'])) {
empty($hav) || $hav .= ' AND ';
$hav .= 'tab_user.age_status =' . I('age_status');
$maps['tab_user.age_status'] = I('age_status');
unset($_REQUEST['age_status']);
}
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
empty($hav) || $hav .= ' AND ';
$hav .= 'tab_user.register_time BETWEEN ' . strtotime(I('time_start')) . ' AND ' . (strtotime(I('time_end')) + 24 * 60 * 60 - 1);
$maps['tab_user.register_time'] = ['between', [strtotime(I('time_start')), strtotime(I('time_end')) + 86399]];
unset($_REQUEST['time_start']);
unset($_REQUEST['time_end']);
} elseif (isset($_REQUEST['time_start'])) {
empty($hav) || $hav .= ' AND ';
$hav .= 'tab_user.register_time > ' . strtotime(I('time_start'));
$maps['tab_user.register_time'] = ['GT', strtotime(I('time_start'))];
unset($_REQUEST['time_start']);
} elseif (isset($_REQUEST['time_end'])) {
empty($hav) || $hav .= ' AND ';
$hav .= 'tab_user.register_time < ' . (strtotime(I('time_end')) + 86399);
$maps['tab_user.register_time'] = ['LT', strtotime(I('time_end')) + 86399];
unset($_REQUEST['time_end']);
}
if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) {
empty($hav) || $hav .= ' AND ';
$hav .= 'tab_user.register_time BETWEEN ' . strtotime(I('start')) . ' AND ' . strtotime(I('end'));
$maps['tab_user.register_time'] = array('between', [strtotime(I('start')), strtotime(I('end'))]);
unset($_REQUEST['start']);
unset($_REQUEST['end']);
$map['register_way'] = I('register_way');
unset($_REQUEST['register_way']);
}
}
if (!empty(I('line_day'))) {
$day = strtotime(date('Y-m-d')) - intval(I('line_day')) * 86400;
empty($hav) || $hav .= ' AND ';
$hav .= $day . '> tab_user.login_time';
$maps['tab_user.login_time'] = ['lt', $day];
if (isset($_REQUEST['register_type'])) {
$map['register_type'] = I('register_type');
unset($_REQUEST['register_type']);
}
if (isset($_REQUEST['status'])) {
$map['lock_status'] = $_REQUEST['status'];
$map['lock_status'] = I('status');
unset($_REQUEST['status']);
}
// if (isset($_REQUEST['game_name'])) {
// //$game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
// }
$game_map = "";
// $game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
if (!empty($_REQUEST['game_name']) || !empty($_REQUEST['game_type'])) {
$game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
}
$spendprom = " and ss.game_id in (".implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')).")";
if (isset($_REQUEST['server_name'])) {
$map['server_name'] = ['like', "{$_REQUEST['server_name']}%"];
if (!empty(I('time_start')) && !empty(I('time_end'))) {
$map['register_time'] = array('BETWEEN', array(strtotime(I('get.time_start')), strtotime(I('time_end')) + 24 * 60 * 60 - 1));
unset($_REQUEST['time_start']);
unset($_REQUEST['time_end']);
}
$game_play_map = '';
if (isset($_REQUEST['server_name'])) {
$game_play_map .= " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' ";
empty(I('account')) || $map['account'] = ['like', '%' . I('account') . '%'];
//排序
if (I('total_status') == 1) {
$order = 'cumulative asc';
} elseif (I('total_status') == 2) {
$order = 'cumulative desc';
} else {
$order = 'id desc';
}
if (isset($_REQUEST['viplevel'])) {
$havs = get_vip_level_limit('recharge_total', $_REQUEST['viplevel']);
$havs = get_vip_level_limit('recharge_total',$_REQUEST['viplevel']);
}
//排序
$order = '';
if (I('key') == 1) {
if (I('balance_status') == 1) {
$order = 'balance,';
} elseif (I('balance_status') == 2) {
$order = 'balance desc,';
}
} else {
if (I('recharge_status') == 1) {
$order .= 'recharge_total,';
} elseif (I('recharge_status') == 2) {
$order .= 'recharge_total desc,';
}
}
$order .= 'a.id desc';
$user = M('user', 'tab_');
$map['puid'] = array('eq', 0);
$map['puid'] = array('eq',0);
$map['is_platform'] = 0;
$usermodel = M('user', 'tab_');
$sql1 = $usermodel->field('tab_user.*,IFNULL(sum(b.pay_amount),0) as deposit_total')
->join('left join tab_deposit AS b ON tab_user.id = b.user_id AND b.pay_status = 1')
->where($map)
->group('tab_user.id')
->where($hav)
// ->order($order)
->select(false);
set_time_limit(0);
// $columns = [
// '序号ID', '姓名', '电话',
// ];
// $fileName = '导出.xlsx';
$fileName = '导出.xlsx';
$csvFileName = $xlsName.'.csv';
//设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer');
@ -437,57 +355,68 @@ class ExportController extends Controller
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$accessNum = '100000';//从数据库获取总量,假设是十万
//计数
$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)
->where($map)
->group('tab_user.id')
->where($hav)
->having($havs)->select(false);
//替换为新表
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)
$accessNum = M('user', 'tab_')
->field('IFNULL(sum(ss.pay_amount),0) AS recharge_total,count(tab_user.id) as count')
// ->field($field)
->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);
}
->having($havs)
->select(false);
$sql = "select count(t.count) as count from ({$accessNum}) as t ";
$accessNum = M('user', 'tab_')->query($sql);
}else{
$accessNum = 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')
->field('IFNULL(sum(ss.pay_amount),0) AS recharge_total,count(tab_user.id) as count')
->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)
->where($map)
->group('tab_user.id')
->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();
$accessNum = $jcount[0]['count'] ?:0 ;
$sql = "select count(t.count) as count from ({$accessNum}) as t ";
$accessNum = M('user', 'tab_')->query($sql);
}
$accessNum = $accessNum[0]['count'];
$perSize = 5000;//每次查询的条数
$pages = ceil($accessNum / $perSize);
$lastId = 0;
for($i = 1; $i <= $pages; $i++) {
if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){
$xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field)
->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)
$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')
->field($field)
->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)
->limit(($i-1)*$perSize ,$perSize)
->having($havs)
->group('a.id')
->group('tab_user.id')
->order($order)
->having($havs)
->select();
// echo $data;die();
}else{
$xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field)
->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)
$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')
->field($field)
->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)
->where($map)
->limit(($i-1)*$perSize ,$perSize)
->having($havs)
->group('a.id')
->group('tab_user.id')
->order($order)
->having($havs)
->select();
}
// echo $usermodel->_sql();die();
//数据
@ -505,17 +434,10 @@ class ExportController extends Controller
if(empty($v['alipay'])){
$xlsData[$k]['alipay'] = '--';
}
if($_REQUEST['type']==2){
$xlsData[$k]['register_type'] = get_registertype($v['register_type']);
}
if ($_REQUEST['type']!=2) {
$xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']);
}
$xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']);
$xlsData[$k]['login_time'] = date('Y-m-d H:i:s',$xlsData[$k]['login_time']);
$xlsData[$k]['lock_status'] = $xlsData[$k]['lock_status']==1?'正常':'锁定';
$xlsData[$k]['check_status'] = $xlsData[$k]['check_status']==1?'正常':'已拉黑';
$xlsData[$k]['device_number'] = $xlsData[$k]['device_number']."'";
$xlsData[$k]['register_type'] = $v['register_type'] == 2?'手机号':($v['register_type']==7?'邮箱':'账号');
@ -1723,11 +1645,18 @@ class ExportController extends Controller
$arraypage=$page;
$row = 10;
$user=M('User','tab_');
$map['fgame_id']=array('gt',0);$map['puid'] = 0;
$map['fgame_id']=array('egt',0);$map['puid'] = 0;
if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
} elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['register_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())];
unset($_REQUEST['timestart']);
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['register_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399];
unset($_REQUEST['timeend']);
}
if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
unset($_REQUEST['start']);unset($_REQUEST['end']);
@ -1746,13 +1675,18 @@ class ExportController extends Controller
count(IF(register_time '.$mounth.',1,null)) as mounth')
->where($map)
->group('fgame_id')
->order('count desc')
->order('count desc,register_time')
->select();
$count=count($data);
foreach ($data as $key => $value) {
static $i=0;
$i++;
$data[$key]['rand']=$i;
if ($data[$key]['fgame_id'] == 0) {
$data[$key]['fgame_name'] = '其他注册';
}
}
$total=A('Platform')->data_total($data);
if($_REQUEST['data_order']!=''){
@ -2044,11 +1978,18 @@ class ExportController extends Controller
if(isset($_REQUEST['timestart'])&&isset($_REQUEST['timeend'])){
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['timestart']),strtotime($_REQUEST['timeend'])+24*60*60-1));
unset($_REQUEST['timestart']);unset($_REQUEST['timeend']);
} elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['register_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())];
unset($_REQUEST['timestart']);
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['register_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399];
unset($_REQUEST['timeend']);
}
if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
$map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
unset($_REQUEST['start']);unset($_REQUEST['end']);
}
// if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
// $map['register_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
// unset($_REQUEST['start']);unset($_REQUEST['end']);
// }
$play_info_map = '';
if (isset($_REQUEST['game_name'])) {
@ -2068,28 +2009,51 @@ class ExportController extends Controller
$map['tp1.chain'] = '/';
}
$data = M('promote', 'tab_')->alias('tp1')->field('tp1.account as promote_account,tp1.id as promote_id, date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(u.id) as count,
$data = M('promote', 'tab_')->alias('tp1')->field('tp1.account as promote_account,tp1.id, date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time, count(u.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')
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%')", 'left')
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
->join("tab_user as u on tp2.id = u.promote_id", 'left')
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->where($map)
->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);
// var_dump($data);die();
$count=count($data);
foreach ($data as $key => $value) {
static $i=0;
$i++;
$data[$key]['rand']=$i;
}
foreach ($data as $key => $value) {
if($data[$key]['promote_id']==0){
unset($data[$key]);
}
}
// foreach ($data as $key => $value) {
// if($data[$key]['promote_id']==0){
// unset($data[$key]);
// }
// }
$total=A('Platform')->data_total($data);
if($_REQUEST['data_order']!=''){
@ -2105,24 +2069,27 @@ class ExportController extends Controller
}
$data=my_sort($data,$data_order_type,(int)$data_order);
$size=$row;//每页显示的记录数
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage-1)*$size, $size);
// $data = array_slice($data, ($arraypage-1)*$size, $size);
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'推广员注册统计';
$xlsCell = array(
array('promote_id', "推广员账号"),
array('promote_account', "推广员账号"),
array('count' , "累计注册"),
array('rand' , "排行榜"),
array('today' , "今日注册"),
array('week' , "本周注册"),
array('mounth' , "本月注册"),
);
foreach ($data as $key => $value) {
$data[$key]['promote_id'] = get_promote_account($data[$key]['promote_id']);
}
// foreach ($data as $key => $value) {
// $data[$key]['promote_id'] = get_promote_account($data[$key]['promote_id']);
// }
// var_dump($data);die();
$length = count($data);
$data[$length] = array(
'promote_id'=>'汇总',
'promote_account'=>'汇总',
'count'=>$total['sum_count'],
'rand'=>'---',
'today'=>$total['sum_today'],
@ -2130,6 +2097,7 @@ class ExportController extends Controller
'mounth'=>$total['sum_mounth']
);
$xlsData = $data;
// var_dump($xlsData);die();
$this->exportExcel($xlsName, $xlsCell, $xlsData);
}
@ -2143,7 +2111,18 @@ class ExportController extends Controller
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 (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['create_time'] = ['between', array(strtotime($_REQUEST['timestart']), time())];
$pay_time = " between " . strtotime($_REQUEST['timestart']) . " and " . time() . " ";
unset($_REQUEST['timestart']);
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['create_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399];
$pay_time = " between 0 and " . (strtotime($_REQUEST['timeend']) + 86399) . " ";
unset($_REQUEST['timeend']);
} else {
$pay_time = " between 0 and " . time();
}
if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){
$map['pay_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1));
unset($_REQUEST['start']);unset($_REQUEST['end']);
@ -2153,82 +2132,82 @@ class ExportController extends Controller
// unset($_REQUEST['promote_id']);
// }
$map1['pay_status'] = $map['pay_status']=1;
$map1['pay_way'] = $map['pay_way'] = array('gt', 0);
// $map1['pay_way'] = $map['pay_way'] = array('gt', 0);
$today=total(1);
$week=total(2);
$mounth=total(3);
$map1['pay_way'] = $map['pay_way'] = array('gt',0);
$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, sum(real_amount) as count,
sum(IF(create_time '.$today.',real_amount,0)) as today,
sum(IF(create_time '.$week.',real_amount,0)) as week,
sum(IF(create_time '.$mounth.',real_amount,0)) 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, sum(pay_amount) as count,
sum(IF(create_time '.$today.',pay_amount,0)) as today,
sum(IF(create_time '.$week.',pay_amount,0)) as week,
sum(IF(create_time '.$mounth.',pay_amount,0)) as mounth')
->where($map1)
->group('promote_id')
->select(false);
if(isset($_REQUEST['game_name'])){
$map['game_name'] = $_REQUEST['game_name'];
if(isset($_REQUEST['server_id'])){
$map['server_name'] = $_REQUEST['server_id'];
unset($_REQUEST['server_id']);
}
$data=$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, sum(pay_amount) as count,
sum(IF(pay_time '.$today.',pay_amount,0)) as today,
sum(IF(pay_time '.$week.',pay_amount,0)) as week,
sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth')
->where($map)
->group('promote_id')
->select(false);
}else{
$data=$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, sum(pay_amount) as count,
sum(IF(pay_time '.$today.',pay_amount,0)) as today,
sum(IF(pay_time '.$week.',pay_amount,0)) as week,
sum(IF(pay_time '.$mounth.',pay_amount,0)) as mounth')
->where($map)
->union(' ('.$bindrecharge_data.') ')
->union(' ('.$deposit_data.') ')
->group('promote_id')
->select(false);
}
$promote_map = "tp1.`chain` = '/'";
unset( $map['create_time']);
//获取所有会长
$promote_map = "`chain` = '/'";
if (isset($_REQUEST['promote_id'])) {
$promote_map = "tp1.`id` = {$_REQUEST['promote_id']}";
unset($_REQUEST['promote_id']);
$promote_map = "`chain` = '%/{$_REQUEST['promote_id']}/%' OR id = {$_REQUEST['promote_id']}";
}
$data = $spend->field('t.pid as promote_id,t.promote_account,sum(a.count) 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('(' . $data . ') as a')->group('t.pid')->order('count desc,a.ordertime')->select();
$count=count($data);
foreach ($data as $key => $value) {
static $i=0;
$i++;
$data[$key]['rand']=$i;
if($data[$key]['promote_id']=='0'){
unset($data[$key]);
$promote = M("promote","tab_")->field("id,account")->page($page,$row)->where($promote_map)->select();
$pcount = M("promote","tab_")->field("count(*) acount")->where($promote_map)->find()['acount'];
// var_dump( $promote);
$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; $k<count($proid); $k++){
# code...
$str .= ($proid[$k]['id'].",");
}
$str .= "{$promote[$i]['id']}";
$map['promote_id'] = array("in",$str);
if (isset($_REQUEST['game_name'])) {
$map['game_name'] = $_REQUEST['game_name'];
if (isset($_REQUEST['server_id'])) {
$map['server_name'] = $_REQUEST['server_id'];
unset($_REQUEST['server_id']);
}
$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 ' . $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'];
$dbdata['promote_id'] = $promote[$i]['id'];
} 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 ' . $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'];
$dbdata['promote_id'] = $promote[$i]['id'];
}
$data[] = $dbdata;
}
$total=A('Platform')->data_total($data);
if($_REQUEST['data_order']!=''){
$data_order=reset(explode(',',$_REQUEST['data_order']));
$data_order_type=end(explode(',',$_REQUEST['data_order']));
$count = count($data);
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]['week'] = $value['week'] / 100;
$data[$key]['mounth'] = $value['mounth'] / 100;
}
$data=my_sort($data,$data_order_type,(int)$data_order);
$size=$row;//每页显示的记录数
$pnum = ceil(count($data) / $size); //总页数ceil()函数用于求大于数字的最小整数
//用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度)
$data = array_slice($data, ($arraypage-1)*$size, $size);
$total = $this->data_total($data);
$xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'推广员充值统计';
$xlsCell = array(
array('promote_id', "推广员账号"),
@ -2254,6 +2233,15 @@ class ExportController extends Controller
$this->exportExcel($xlsName, $xlsCell, $xlsData);
}
public function data_total($data)
{
$total['sum_count'] = array_sum(array_column($data, 'count'));
$total['sum_today'] = array_sum(array_column($data, 'today'));
$total['sum_week'] = array_sum(array_column($data, 'week'));
$total['sum_mounth'] = array_sum(array_column($data, 'mounth'));
return $total;
}
public function userretention_export($p = 0)
{
$request=$_REQUEST;
@ -4752,6 +4740,9 @@ if ($key == 'model'){
$map['id']=array('in',$zid);
}
$map['level'] = I('promote_level');
if(I('oa_associated',-1) != -1) {
$map['oa_associated'] = I('oa_associated');
}
}

@ -124,14 +124,10 @@ class MemberController extends ThinkController
}
$game_map = "";
if (!empty($_REQUEST['game_name']) || !empty($_REQUEST['game_type'])) {
if (isset($_REQUEST['game_name'])) {
$game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
}
$spendprom .= " and ss.game_id in (".implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')).")";
if (isset($_REQUEST['server_name'])) {
$spendprom .= " and ss.server_name like '{$_REQUEST['server_name']}%' ";
}
$game_play_map = '';
if (isset($_REQUEST['server_name'])) {
$game_play_map .= " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' ";
@ -216,16 +212,18 @@ class MemberController extends ThinkController
//计数
$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('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)
->where($map)
->group('tab_user.id')
->where($hav)
->having($havs)->select(false);
$allcountsql = str_replace("tab_user.promote_id","ss.promote_id",$sql);
//获取总额
$allcount = M()->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $sql . ') as a')->select();
$this->assign('history_count', $allcount[0]['recharge_total']);
$allcount = M()->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $allcountsql . ') as a')->select();
$this->assign('history_count', $allcount[0]['recharge_total']?:0);
//替换为新表
if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){
@ -240,10 +238,10 @@ class MemberController extends ThinkController
}
$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(M('User', 'tab_')->getLastSql());die();
$count = $jcount[0]['count'] ?:0 ;
$this->assign('user_count', $count);
$this->assign('now_count', $jcount[0]['recharge_total']);
// var_dump($jcount);die();
$this->assign('now_count', $jcount[0]['recharge_total']?:0);
$model = M('Model')->getByName('user');
@ -791,7 +789,6 @@ class MemberController extends ThinkController
}
// $map['type'] = 1;
// $map['login_time'] = ['exp', 'login_time<>0'];
// $map['login_time'] = ['gt',0];
$extend = array();
$extend['map'] = $map;
@ -1253,8 +1250,6 @@ class MemberController extends ThinkController
}
if ($type == 2 && !preg_match("/(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i", $tag)) {
return $this->error("请填写正确的ip信息如127.0.0.1");
} else if ($type == 1 && preg_match("/(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/i", $tag)) {
return $this->error("请填写正确的设备号信息");
}
$map['type'] = $type;
$map['tag'] = $tag;

@ -66,6 +66,11 @@ unset($_REQUEST['parent_id']);
if (I('status') || I('status', -1) == 0) {
$map['status'] = I('status');
}
if (I('ver_status') || I('ver_status', -1) == 0) {
$map['ver_status'] = I('ver_status');
}
if (I("promote_level")) {
$map['level'] = I("promote_level");
}
@ -95,9 +100,11 @@ unset($_REQUEST['parent_id']);
}
}
$promote = D(self::model_name)->field('id,account')->where(['oa_associated' => 0])->order('id DESC')->select();
// $promote = D(self::model_name)->field('id,account')->where(['oa_associated' => 0])->order('id DESC')->select(); //只获取之前未关联
$promote = D(self::model_name)->field('id,account')->order('id DESC')->select(); //全部重新获取
$oa_data = array_column($oa_data, 'platform_account');
foreach($promote as $k => $v) {
$v['account'] = trim($v['account']);
if(in_array($v['account'], $oa_data)) {
M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => 1]);
}
@ -109,9 +116,10 @@ unset($_REQUEST['parent_id']);
if(I('oa_associated',-1) == -1) {
foreach($list_data as $k => $v)
{
if($v['oa_associated'] != 1) {
$oa_data[] = $v['account'];
}
// $list_data[$k]['account'] = trim($v['account']);
// if($v['oa_associated'] != 1) {
$oa_data[] = trim($v['account']);
// }
}
if(!empty($oa_data))
{
@ -133,7 +141,7 @@ unset($_REQUEST['parent_id']);
}
}
}
$count = (I('oa_associated',-1) != -1) ? D(self::model_name)->where($map)->count() : D(self::model_name)->count();
$count = D(self::model_name)->where($map)->count();
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('list_data', $list_data);

@ -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":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},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":2},{"time":"20:00","count":1},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":3,"active":4,"player":0,"money":0},"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":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},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":3},{"time":"20:00","count":1},{"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":0},{"time":"16:00","count":0},{"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},{"time":"16:00","count":0},{"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":6},{"time":"1:00","count":9},{"time":"2:00","count":7},{"time":"3:00","count":11},{"time":"4:00","count":16},{"time":"5:00","count":7},{"time":"6:00","count":9},{"time":"7:00","count":11},{"time":"8:00","count":14},{"time":"9:00","count":40},{"time":"10:00","count":58},{"time":"11:00","count":86},{"time":"12:00","count":41},{"time":"13:00","count":55},{"time":"14:00","count":194},{"time":"15:00","count":180},{"time":"16:00","count":121},{"time":"17:00","count":98},{"time":"18:00","count":120},{"time":"19:00","count":147},{"time":"20:00","count":146},{"time":"21:00","count":124},{"time":"22:00","count":93},{"time":"23:00","count":56}],"sum":{"news":1649,"active":8210,"player":1715,"money":226618},"active":[{"time":"0:00","count":967},{"time":"1:00","count":343},{"time":"2:00","count":176},{"time":"3:00","count":135},{"time":"4:00","count":118},{"time":"5:00","count":177},{"time":"6:00","count":465},{"time":"7:00","count":661},{"time":"8:00","count":622},{"time":"9:00","count":547},{"time":"10:00","count":480},{"time":"11:00","count":414},{"time":"12:00","count":326},{"time":"13:00","count":237},{"time":"14:00","count":354},{"time":"15:00","count":328},{"time":"16:00","count":215},{"time":"17:00","count":219},{"time":"18:00","count":256},{"time":"19:00","count":335},{"time":"20:00","count":274},{"time":"21:00","count":244},{"time":"22:00","count":197},{"time":"23:00","count":120}],"player":[{"time":"0:00","count":211},{"time":"1:00","count":84},{"time":"2:00","count":29},{"time":"3:00","count":25},{"time":"4:00","count":16},{"time":"5:00","count":24},{"time":"6:00","count":32},{"time":"7:00","count":56},{"time":"8:00","count":71},{"time":"9:00","count":66},{"time":"10:00","count":63},{"time":"11:00","count":69},{"time":"12:00","count":58},{"time":"13:00","count":62},{"time":"14:00","count":50},{"time":"15:00","count":99},{"time":"16:00","count":68},{"time":"17:00","count":61},{"time":"18:00","count":77},{"time":"19:00","count":157},{"time":"20:00","count":107},{"time":"21:00","count":101},{"time":"22:00","count":74},{"time":"23:00","count":55}],"money":[{"time":"0:00","count":"31554.00"},{"time":"1:00","count":"4117.00"},{"time":"2:00","count":"1839.00"},{"time":"3:00","count":"4513.00"},{"time":"4:00","count":"1008.00"},{"time":"5:00","count":"1981.00"},{"time":"6:00","count":"1270.00"},{"time":"7:00","count":"1906.00"},{"time":"8:00","count":"6683.00"},{"time":"9:00","count":"6119.00"},{"time":"10:00","count":"8974.00"},{"time":"11:00","count":"14147.00"},{"time":"12:00","count":"9775.00"},{"time":"13:00","count":"11908.00"},{"time":"14:00","count":"6781.00"},{"time":"15:00","count":"12626.00"},{"time":"16:00","count":"6742.00"},{"time":"17:00","count":"8303.00"},{"time":"18:00","count":"8804.00"},{"time":"19:00","count":"23476.00"},{"time":"20:00","count":"17464.00"},{"time":"21:00","count":"16899.00"},{"time":"22:00","count":"13143.00"},{"time":"23:00","count":"6586.00"}]}

@ -279,23 +279,30 @@ $(".select_gallery").select2();
})
});
$("#promote_level").change();
var game_server = "{:I('server_name')}";
var game_id = "{:I('server_id')}";
$("#game_type").change(function(){
$.ajax({
url:"{:U('Ajax/getGmeServer')}",
type:"post",
data:{sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()},
dataType:'json',
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>"
var game_name = $("#game_name option:selected").val();
if(game_name != ''){
$.ajax({
url:"{:U('Ajax/getGmeServer')}",
type:"post",
data:{sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()},
dataType:'json',
success:function(data){
str = "<option value=''>请选择区服</option>";
for (var i in data){
str += "<option value='"+data[i].server_id+"' "+(game_id && data[i].server_id == game_id?'selected':'')+">"+data[i].server_name+"</option>"
}
$("#server_id").empty();
$("#server_id").append(str);
$("#server_id").select2();
}
$("#server_name").empty();
$("#server_name").append(str);
$("#server_name").select2();
}
})
})
}else{
$("#server_id").html("");
$("#server_id").append("<option value=''>请选择</option>");
}
});
$("#game_name").change(function(){

@ -10,6 +10,7 @@ use QRcode;
*/
class CoinOrderController extends BaseController
{
const LV = 2;//平台币充值手续费
public function page_show($model,$map,$p=1)
{
if (isset($_REQUEST['row'])) {
@ -89,7 +90,7 @@ class CoinOrderController extends BaseController
//创建订单
public function order_add(){
$status = promoteCan(session('promote_auth.pid'), function($level) {
if ($level == 1) {
return true;
@ -104,7 +105,7 @@ class CoinOrderController extends BaseController
$this->error('无权限操作');
}
}
$this->assign("LV",self::LV);
if(IS_POST){
SafeFilter($_POST);
$coin_num = I("coin_num");
@ -122,7 +123,7 @@ class CoinOrderController extends BaseController
$data['create_time'] = time();
$data['discount'] = "0";
if($pay_type==1){ // 在线转账
$free = sprintf("%.2f",$coin_num*(0.2/100));
$free = sprintf("%.2f",$coin_num*(self::LV/100));
$free = $free<'0.1' ? '0.1':$free;
$data['pay_amount'] = bcadd($coin_num,$free,2);
$data['order_status'] = 0;

@ -48,6 +48,7 @@ class DownloadController extends BaseController {
$cellNum = count($expCellName);
$dataNum = count($expTableData);
Vendor("PHPExcel.PHPExcel");
$objPHPExcel = new \PHPExcel();
$cellName = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ');
$objPHPExcel->getActiveSheet(0)->mergeCells('A1:' . $cellName[$cellNum - 1] . '1');//合并单元格
@ -57,10 +58,11 @@ class DownloadController extends BaseController {
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($cellName[$i] . '2', $expCellName[$i][1]);
}
for ($i = 0; $i < $dataNum; $i++) {
for ($j = 0; $j < $cellNum; $j++) {
$objPHPExcel->getActiveSheet(0)->setCellValue($cellName[$j] . ($i + 3), $expTableData[$i][$expCellName[$j][0]]);
}
for ($j = 0; $j < $cellNum; $j++) {
$objPHPExcel->getActiveSheet(0)->setCellValue($cellName[$j] . ($i + 3), $expTableData[$i][$expCellName[$j][0]]);
}
}
ob_end_clean();//清除缓冲区,避免乱码
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $xlsTitle . '.xls"');
@ -1161,9 +1163,6 @@ class DownloadController extends BaseController {
* @author sunke
*/
public function recharge_data_export() {
if (empty(I('begtime')) || empty(I('endtime'))) {
$this->error('请选择起止时间');
}
$beginTime = strtotime(I('begtime') . ' 00:00:00');
$endtime = strtotime(I('endtime') . ' 23:59:59');
if (($endtime - $beginTime) > 31 * 24 * 3600) {
@ -1296,13 +1295,14 @@ class DownloadController extends BaseController {
$map = ['promote_id' => ['in', $ids]];
$subMap = ['promote_id' => ['in', $ids]];
if ($gameId != 0) {
$gameMap['relation_game_id'] = $gameId;
if ($gameId != 0 || $sdkVersion != 0) {
if ($gameId != 0) {
$gameMap['relation_game_id'] = $gameId;
}
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
$map['game_id'] = ['in', $gameId1];
$subMap['game_id'] = ['in', $gameId1];
}
@ -1417,22 +1417,24 @@ class DownloadController extends BaseController {
$map['parentsinfo'] = json_encode($parent,FALSE);;
$map['currentDisplay'] = $currentDisplay;
$map['ids'] = $ids;
if ($gameId > 0) {
$gameMap['relation_game_id'] = $gameId;
if ($sdkVersion > 0) {
if ($gameId != 0 || $sdkVersion != 0) {
if ($gameId != 0) {
$gameMap['relation_game_id'] = $gameId;
}
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
$params['game_id'] = ['in', $gameId1];
$map['game_id'] = ['in', $gameId1];
}
if ($serverId > 0) {
$params['server_id'] = $serverId;
$map['server_id'] = $serverId;
}
if ($sdkVersion > 0) {
$params['sdk_version'] = $sdkVersion;
$map['sdk_version'] = $sdkVersion;
}
if ($status > 0) {
$params['lock_status'] = $status;
$map['lock_status'] = $status;
}
list($beginTime, $endTime) = $this->getBetweenTime($time);
$map['begin_time'] = $beginTime;
@ -1514,9 +1516,10 @@ class DownloadController extends BaseController {
$map['_string'] = '1<>1';
}
if ($gameId != 0) {
$gameMap['relation_game_id'] = $gameId;
if ($gameId != 0 || $sdkVersion != 0) {
if ($gameId != 0) {
$gameMap['relation_game_id'] = $gameId;
}
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
@ -1634,7 +1637,7 @@ class DownloadController extends BaseController {
array_push($ids,PID);
}
array_push($ids,$queryPromote['id']);
// array_push($ids,$queryPromote['id']);
if (!empty($ids)) {
$map['tab_apply.promote_id'] = ['in',$ids];
@ -1662,7 +1665,7 @@ class DownloadController extends BaseController {
$map["apply_time"] = ["between",[strtotime($begtime1),strtotime($endtime1)]];
}
if(!empty($begtime) && !empty($endtime)) {
$map["apply_time"] = ["between",[strtotime($begtime),strtotime($endtime)]];
$map["apply_time"] = ["between",[strtotime($begtime),strtotime($endtime) + 3600 * 24 -1]];
}
$serverField = '';
$serverJoin = '';
@ -1861,12 +1864,12 @@ class DownloadController extends BaseController {
$begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
$params['begin_time'] = $begTime;
$params['end_time'] = $endTime -1;
$params['end_time'] = $endTime +3600 * 24 -1;
if(!empty($map['apply_time'][1])) {
$begTime = $map['apply_time'][1][0];
$endTime = $map['apply_time'][1][1];
$params['begin_time'] = $begTime;
$params['end_time'] = $endTime;
$params['end_time'] = $endTime + 3600 * 24 -1;
unset($map['apply_time']);
}
if(!empty($map['tab_server.server_id'])) {
@ -1881,6 +1884,7 @@ class DownloadController extends BaseController {
->group('tab_apply.game_id')
->order('g.sort desc,g.id desc')
->select();
$records = [];
if (!empty($data)) {
if (intval($endTime - $begTime) / (24 * 3600) <= 30) {
@ -1889,7 +1893,6 @@ class DownloadController extends BaseController {
$gameIds[] = $list['game_id'];
}
$params['game_ids'] = $gameIds;
$userRepository = new UserRepository();
$spendRepository = new SpendRepository();
$roleNumList = $userRepository->getCreateRoleCountByGame($params);//创角数
@ -2356,34 +2359,34 @@ class DownloadController extends BaseController {
}
public function withdrawDtlExcelInfo($id,$map) {
$xlsName = "提现记录";
$xlsCell = array(
array('pay_order_number','充值订单号'),
array('game_name','游戏'),
array('sdk_version','平台'),
array('user_account','玩家账号'),
array('pay_amount','订单总额'),
array('cash_base','现金分成基数'),
array('selle_ratio','现金分成比例'),
array('platform_base','平台币分成基数'),
array('selle_ratio','平台币分成比例'),
array('bind_base','绑定币分成基数'),
array('selle_ratio','绑定币分成比例'),
array('pay_way_name','现金支付通道'),
array('income','收益'),
array('status','订单状态'),
array('pay_time','充值时间'),
);
$spendModel = M('spend', 'tab_');
$withdrawId = $map['withdraw_id'];
$withdraw = M('withdraw', 'tab_')->field('promote_id,status')->where(array('id' => $withdrawId))->find();
$xlsName = "提现记录";
$xlsCell = array(
'充值订单号',
'游戏',
'平台',
'玩家账号',
'订单总额',
'充值时间',
'收益',
'现金支付通道',
'现金分成基数',
'现金分成比例',
'平台币分成基数',
'平台币分成比例',
'绑定币分成基数',
'绑定币分成比例',
'订单状态',
);
$spendModel = M('spend', 'tab_');
$withdrawId = $map['withdraw_id'];
$withdraw = M('withdraw', 'tab_')->field('promote_id,status')->where(array('id' => $withdrawId))->find();
$data = $spendModel
->field('id,pay_order_number,game_name,sdk_version,user_account,pay_amount,pay_way,selle_ratio,pay_time')
->field('pay_order_number,game_name,sdk_version,user_account,pay_amount,pay_way,selle_ratio,pay_time')
->where($map)
->order('id desc')
->select();
if (!empty($data)) {
foreach ($data as &$list) {
if (!empty($data)) {
foreach ($data as $key => &$list) {
$list['income'] = bcmul($list['pay_amount'], bcdiv($list['selle_ratio'], 100, 2), 2);
$list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']);
switch ($list['pay_way']) {
@ -2401,27 +2404,55 @@ class DownloadController extends BaseController {
}else {
$list['cash_base'] = 0;
}
$list['cash_selle_ratio'] = $list['selle_ratio'];
if($list['pay_way'] == 0) {
$list['platform_base'] = $list['pay_amount'];
$list['platform_base'] = $list['pay_amount'];
}else {
$list['platform_base'] = 0;
}
if($list['pay_way'] == -1) {
$list['bind_base'] = $list['pay_amount'];
$list['platform_selle_ratio'] = $list['selle_ratio'];
if($list['pay_way'] == -1) {
$list['bind_base'] = $list['pay_amount'];
}else {
$list['bind_base'] = 0;
}
$list['bind_selle_ratio'] = $list['selle_ratio'];
$list['status'] = FinanceController::$withdrawStatus[$withdraw['status']];
}
}
$xlsData = $data;
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
}
unset($list['pay_way']);
unset($list['selle_ratio']);
}
}
$csvFileName = $xlsName.'.csv';
//设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="'. $csvFileName .'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
$fp = fopen('php://output', 'a');//打开output流
mb_convert_variables('gb2312', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$accessNum = '100000';//从数据库获取总量,假设是十万
$accessNum = count($data)?:0 ;
$perSize = 5000;//每次查询的条数
$pages = ceil($accessNum / $perSize);
for($i = 1; $i <= $pages; $i++) {
foreach($data as $value) {
mb_convert_variables('GBK', 'UTF-8', $value);
fputcsv($fp, $value);
}
unset($data);
ob_flush();
flush();
}
fclose($fp);
$this->backSuccessExport($id);
}
public function withdrawRecordExcelInfo($id,$map) {
$xlsName = "提现记录";
@ -2902,28 +2933,53 @@ class DownloadController extends BaseController {
public function rechargeExcelInfo($id,$map) {
$xlsName = "订单查询";
$xlsCell = array(
array('user_account','玩家账号'),
array('order_number','游戏订单'),
array('pay_amount','订单金额'),
array('pay_way','支付方式'),
array('game_name','游戏名称'),
array('server_name','区服'),
array('game_player_name','角色名'),
array('p_p_proinfo','部门长'),
array('p_proinfo','组长'),
array('proinfo','推广员'),
array('pay_time','付款时间'),
'玩家账号',
'游戏订单',
'订单金额',
'支付方式',
'游戏名称',
'区服',
'角色名',
'部门长',
'组长',
'推广员',
'付款时间',
);
$model = M('spend','tab_');
$data = $model
->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.chain as chain')
$data1 = $model
->field('tab_spend.id')
->join('tab_game on tab_spend.game_id = tab_game.id')
->join('left join tab_promote on tab_spend.promote_id = tab_promote.id')
->where($map)
->order('tab_spend.id desc')
->select();
$xlsData = [];
foreach ($data as $key1 => $value1) {
$csvFileName = $xlsName.'.csv';
//设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="'. $csvFileName .'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
$fp = fopen('php://output', 'a');//打开output流
mb_convert_variables('gb2312', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$accessNum = count($data1)?:0 ;
$perSize = 5000;//每次查询的条数
$pages = ceil($accessNum / $perSize);
for($i = 1; $i <= $pages; $i++) {
$model = M('spend','tab_');
$data = $model
->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.chain as chain')
->join('tab_game on tab_spend.game_id = tab_game.id')
->join('left join tab_promote on tab_spend.promote_id = tab_promote.id')
->where($map)
->limit(($i-1)*$perSize ,$perSize)
->order('tab_spend.id desc')
->select();
foreach ($data as $key1 => $value1) {
$value1['pay_way'] = $this->payWay[$value1['pay_way']];
$value1['pay_time'] = date('Y-m-d H:i:s',$value1['pay_time']);
$value1['p_p_proinfo'] = $value1['pro_account'].'('.$value1['pro_real_name'].')';
@ -2952,9 +3008,27 @@ class DownloadController extends BaseController {
}
$xlsData[] = $value1;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
$csvData["user_account"] = $value1["user_account"];
$csvData["order_number"] = $value1["order_number"];
$csvData["pay_amount"] = $value1["pay_amount"];
$csvData["pay_way"] = $value1["pay_way"];
$csvData["game_name"] = $value1["game_name"];
$csvData["server_name"] = $value1["server_name"];
$csvData["game_player_name"] = $value1["game_player_name"];
$csvData["p_p_proinfo"] = $value1["p_p_proinfo"];
$csvData["p_proinfo"] = $value1["p_proinfo"];
$csvData["proinfo"] = $value1["proinfo"];
$csvData["pay_time"] = $value1["pay_time"];
mb_convert_variables('GBK', 'UTF-8', $csvData);
fputcsv($fp, $csvData);
$xlsData[] = $csvData;
}
unset($xlsData);
ob_flush();
flush();
}
fclose($fp);
$this->backSuccessExport($id);
}
public function backSuccessExport($id) { //导出成功后

@ -1633,8 +1633,10 @@ class QueryController extends BaseController
$map['_string'] = '1<>1';
}
if ($relationGameId != 0) {
$gameMap['relation_game_id'] = $relationGameId;
if ($relationGameId != 0 || $sdkVersion != 0) {
if ($relationGameId != 0) {
$gameMap['relation_game_id'] = $relationGameId;
}
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
@ -1743,8 +1745,10 @@ class QueryController extends BaseController
$map = ['uc.promote_id' => ['in', $ids]];
$subMap = ['promote_id' => ['in', $ids]];
if ($relationGameId != 0) {
$gameMap['relation_game_id'] = $relationGameId;
if ($relationGameId != 0 || $sdkVersion != 0) {
if ($relationGameId != 0) {
$gameMap['relation_game_id'] = $relationGameId;
}
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
@ -1998,9 +2002,11 @@ class QueryController extends BaseController
'isContainSubs' => true,
'basicPromotes' => $basicPromotes,
];
if ($relationGameId > 0) {
$gameMap['relation_game_id'] = $relationGameId;
if ($sdkVersion > 0) {
if ($relationGameId != 0 || $sdkVersion != 0) {
if ($relationGameId != 0) {
$gameMap['relation_game_id'] = $relationGameId;
}
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
$gameId = M('game', 'tab_')->where($gameMap)->getField('id', true);

@ -42,7 +42,7 @@
</tr>
<tr>
<td class="l">购买数量:</td>
<td class="r"><input type="text" class="txt" name="coin_num" autocomplete="off" placeholder="">
<td class="r"><input type="text" class="txt" name="coin_num" autocomplete="off" placeholder="" oninput="this.value=this.value.replace(/[^0-9]+|^0|\d{9}/,'');">
<span class="noticetxt">平台币</span>
</td>
</tr>
@ -87,7 +87,7 @@
</tr>
<tr id="tip">
<td class="l" colspan="2">
<span class="noticetxt">(手续费说明:每笔交易支付服务商将收取 0.20% 手续费最低收取0.1元,上不封顶)</span>
<span class="noticetxt">(手续费说明:每笔交易支付服务商将收取 {$LV}% 手续费最低收取0.1元,上不封顶)</span>
</td>
</tr>
<tr>
@ -143,7 +143,7 @@
var rodio_val = $('.jspayradio input:radio:checked').val();
coin_num = (discount/100)*coin_num;
if(rodio_val==1){ //在线转账
var fee = coin_num*(0.2/100);
var fee = coin_num*({$LV}/100);
if(fee<0.1){
fee=0.1
}

@ -125,7 +125,7 @@
</div>
<div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" href="{:U('download/children_data_export',array_merge(['promote_type'=>I('promote_type')],I('post.')))}" class="ajax-get" >导出</a>
<a id="sch-btn" href="{:U('download/children_data_export',array_merge(['promote_type'=>I('promote_type')],I('get.')))}" class="ajax-get" >导出</a>
<?php endif ;?>
{$pagination}
</div>

@ -510,26 +510,22 @@ ADD INDEX `widthdraw_number`(`widthdraw_number`);
--
CREATE TABLE `tab_user_play_data_count` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`game_id` int(11) NOT NULL DEFAULT '0' COMMENT '游戏id',
`user_id` int(11) NOT NULL DEFAULT 0 COMMENT '玩家ID',
`promote_id` int(11) NOT NULL DEFAULT 0 COMMENT '推广员ID',
`game_id` int(11) NOT NULL DEFAULT 0 COMMENT '游戏id',
`server_id` varchar(255) NOT NULL COMMENT '区服id',
`role_id` varchar(255) NOT NULL COMMENT '角色id',
`recharge_cost` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '充值总额',
`recharge_count` int(10) NOT NULL DEFAULT '0' COMMENT '充值次数',
`create_time` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
`recharge_count` int(10) NOT NULL DEFAULT 0 COMMENT '充值次数',
`create_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (`id`),
KEY `recharge_cost` (`recharge_cost`) USING BTREE,
KEY `recharge_count` (`recharge_count`) USING BTREE,
KEY `search` (`game_id`,`server_id`,`role_id`) USING BTREE,
KEY `create_time` (`create_time`) USING BTREE
KEY `create_time` (`create_time`) USING BTREE,
KEY `search` (`user_id`,`promote_id`,`game_id`,`server_id`,`role_id`,`create_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
ALTER TABLE `tab_user_play_data_count`
ADD INDEX `search`(`game_id`, `server_id`, `role_id`, `create_time`) USING BTREE,
ADD INDEX `create_time`(`create_time`) USING BTREE;
ADD INDEX `recharge_cost`(`recharge_cost`) USING BTREE,
ADD INDEX `recharge_count`(`recharge_count`) USING BTREE;
--
-- 身份证认证信息
CREATE TABLE `tab_idcard_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) NOT NULL COMMENT '姓名',
@ -542,24 +538,51 @@ CREATE TABLE `tab_idcard_log` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COMMENT='身份证认证信息';
-- 公告已读表
CREATE TABLE `tab_notice_read` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`notice_id` int(11) NOT NULL COMMENT '广告id',
`game_id` int(11) DEFAULT NULL,
`user_id` int(11) NOT NULL COMMENT '用户id',
`is_read` tinyint(2) DEFAULT '0' COMMENT '0未读1已读',
`create_time` int(11) DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
-- 短信日志
CREATE TABLE `tab_sms_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` int(11) DEFAULT NULL COMMENT '验证码',
`phone` varchar(20) NOT NULL COMMENT '手机号',
`content` text NOT NULL COMMENT '发送内容',
`status` tinyint(2) NOT NULL COMMENT '发送状态',
`msg` varchar(80) DEFAULT NULL COMMENT '发送返回的信息',
`ip` varchar(20) DEFAULT NULL COMMENT 'ip地址',
`create_time` int(11) DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='短信日志';
--
ALTER TABLE `tab_withdraw`
ADD COLUMN `last_up_update_time` int(10) NOT NULL DEFAULT 0 COMMENT '最后更新时间',
ADD COLUMN `spend_ids` longtext NOT NULL COMMENT '充值订单id';
--广oa
-- 推广员添加oa关
ALTER TABLE `tab_promote`
ADD COLUMN`oa_associated` tinyint(1) DEFAULT '0' COMMENT 'oa是否关联',
----ID广ID
ALTER TABLE `tab_user_play_data_count`
ADD COLUMN `user_id` int(11) NOT NULL DEFAULT 0 COMMENT '玩家ID',
ADD COLUMN `promote_id` int(11) NOT NULL DEFAULT 0 COMMENT '推广员ID';
ALTER TABLE `tab_user_play_data_count`
DROP INDEX `search`,
ADD INDEX `search`(`user_id`, `promote_id`, `game_id`, `server_id`, `role_id`, `create_time`) USING BTREE;
----
ALTER TABLE `tab_user_play_info`
ADD INDEX `game_id`(`game_id`, `server_id`, `role_id`);
ADD INDEX `game_id`(`game_id`, `server_id`, `role_id`);
-- SDK菜单配置
INSERT INTO `tab_tool` (`name`, `title`, `config`, `template`, `type`, `status`, `create_time` )
VALUES
('personal_menu', '个人中心列表', '[{\"name\":\"gift\",\"title\":\"\\u793c\\u5305\",\"menu_version\":\"0\",\"url\":\"\\/sdk.php\\/GameGiftPage\\/gift_list\",\"type\":\"0\",\"act\":\"gift\",\"ios_url\":\"?action=gift\",\"sort\":\"1\",\"id\":1,\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd526395e339.png\",\"cover\":\"1986\"},{\"name\":\"balance\",\"title\":\"\\u4f59\\u989d\",\"menu_version\":\"0\",\"url\":\"\\/sdk.php\\/UserH\\/get_user_money\",\"type\":\"0\",\"act\":\"\\/sdk.php\\/UserH\\/get_user_money\",\"ios_url\":\"\\/sdk.php\\/UserH\\/get_user_money\",\"sort\":\"2\",\"id\":\"2\",\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd5264d1e202.png\",\"cover\":\"1987\"},{\"name\":\"message\",\"title\":\"\\u6d88\\u606f\",\"menu_version\":\"0\",\"url\":\"\",\"type\":\"1\",\"act\":\"msg\",\"ios_url\":\"\",\"sort\":\"3\",\"id\":3,\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd5265fb396d.png\",\"cover\":\"1988\"},{\"name\":\"support\",\"title\":\"\\u5ba2\\u670d\",\"menu_version\":\"0\",\"url\":\"\",\"type\":\"1\",\"act\":\"support\",\"ios_url\":\"\",\"sort\":\"4\",\"id\":4,\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd52674492b7.png\",\"cover\":\"1989\"}]', '', 5, 1, 1571723212 );
INSERT INTO `tab_tool` (`name`, `title`, `config`, `template`, `type`, `status`, `create_time` )
VALUES
('contact_cs', '联系客服', '[{\"name\":\"support\",\"title\":\"\\u8054\\u7cfb\\u5ba2\\u670d\",\"menu_version\":\"0\",\"url\":\"\",\"type\":\"2\",\"act\":\"3007567814\",\"ios_url\":\"3007567814\",\"sort\":\"1\",\"id\":1,\"icon\":\"\",\"cover\":\"\"}]', '', 5, 1, 1571723212 );
INSERT INTO `tab_tool` (`name`, `title`, `config`, `template`, `type`, `status`, `create_time` )
VALUES
('sdk_menu', 'SDK用户菜单', '[{\"name\":\"mine\",\"title\":\"\\u6211\\u7684\",\"menu_version\":\"0\",\"url\":\"\",\"type\":\"1\",\"act\":\"my\",\"ios_url\":\"\",\"sort\":\"1\",\"id\":\"1\",\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd524dfd76fa.png\",\"cover\":\"1980\"},{\"name\":\"gift\",\"title\":\"\\u793c\\u5305\",\"menu_version\":\"0\",\"url\":\"\\/sdk.php\\/GameGiftPage\\/gift_list\",\"type\":\"0\",\"act\":\"gift\",\"ios_url\":\"?action=gift\",\"sort\":\"2\",\"id\":2,\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd52509f3767.png\",\"cover\":\"1981\"},{\"name\":\"support\",\"title\":\"\\u5ba2\\u670d\",\"menu_version\":\"0\",\"url\":\"\",\"type\":\"1\",\"act\":\"support\",\"ios_url\":\"\",\"sort\":\"3\",\"id\":3,\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd5251e0aee3.png\",\"cover\":\"1982\"},{\"name\":\"message\",\"title\":\"\\u6d88\\u606f\",\"menu_version\":\"0\",\"url\":\"\",\"type\":\"1\",\"act\":\"msg\",\"ios_url\":\"\",\"sort\":\"4\",\"id\":4,\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd525606ff53.png\",\"cover\":\"1983\"},{\"name\":\"logout\",\"title\":\"\\u9000\\u51fa\",\"menu_version\":\"0\",\"url\":\"\",\"type\":\"1\",\"act\":\"logout\",\"ios_url\":\"\",\"sort\":\"5\",\"id\":5,\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd525d99ed99.png\",\"cover\":\"1984\"},{\"name\":\"suppersign\",\"title\":\"\\u8d85\\u7ea7\\u7b7e\",\"menu_version\":\"2\",\"url\":\"\\/mobile.php\\/ssg\\/home\",\"type\":\"2\",\"act\":\"suppersign\",\"ios_url\":\"http:\\/\\/m.wmtxkj.cn\\/mobile.php\\/ssg\\/home\",\"sort\":\"6\",\"id\":6,\"icon\":\"\\/Uploads\\/Picture\\/2019-11-20\\/5dd525f388843.png\",\"cover\":\"1985\"}]', '', 5, 1, 1571723212 );
Loading…
Cancel
Save