超级签统计--导出

master
zhanglingsheng 5 years ago
parent 94b66e3edd
commit cbbbf6350c

@ -1864,6 +1864,109 @@ class ExportController extends Controller
}
$xlsData = $data;
break;
case 22:
$xlsCell = array(
array('game_name', '游戏'),
array('authorization_num', '已授权游戏数量'),
array('pay_game_supersign', '超级签被购买数量'),
array('promote_super_money', '推广超级签金额'),
array('official_super_money', '官方超级签金额'),
);
$map['supersign_token'] = ['NEQ',''];
$supersign_game = M('game', 'tab_')->field('id,game_name,supersign_token')->where($map)->select();
$xlsData = [];
$count['authorization'] = 0;
$count['pay_num'] = 0;
$count['promote_super_money'] = 0;
$count['official_super_money'] = 0;
foreach($supersign_game as $k => $v) {
$arr['game_name'] = $v['game_name'];
$re_data = [];
$curl['token'] = $v['token'];
$curl['limit'] = 2000;
for ($i = 1;$i > 0;$i++) {
if($i != 1) {
$pop = array_pop($data);
$curl['lastid'] = $pop['id'];
}
$curl_re = json_decode(curl_post('https://app.ipa365.com/Kirin/OpenApi/TicketList',$curl),true);
if($curl_re['errno'] == 0) {
$data = $curl_re['data']['list'];
$re_data = array_merge($re_data,$data);
} else {
break;
}
if(count($data) != $curl['limit']) {
break;
}
}
$arr['authorization_num'] = count($re_data);
$game_supersign = M('game_supersign', 'tab_')->field('promote_id')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->where(['game_id' => $v['id'], 'pay_status' => 1])->select();
$arr['pay_game_supersign'] = count($game_supersign);
$arr['promote_super_money'] = 0;
$arr['official_super_money'] = 0;
foreach($game_supersign as $key => $val) {
if($val['promote_id'] != 0) {
$arr['promote_super_money'] += 10;
}else {
$arr['official_super_money'] += 10;
}
}
$xlsData[] = $arr;
}
break;
case 23:
$xlsCell = array(
array('order_id', '订单号'),
array('account', '游戏账号'),
array('promote_account', '所属推广员'),
array('device_number', '设备号'),
array('game_name', '游戏'),
array('pay_time', '购买时间'),
array('super_money', '超级签金额'),
);
$xlsData = M('game_supersign', 'tab_')->field('tab_game_supersign.id,tab_game_supersign.order_id,tab_user.account,tab_user.promote_account,tab_user.device_number,tab_game.game_name,tab_game_supersign.pay_time')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->join('tab_game on tab_game_supersign.game_id = tab_game.id')->where(['tab_game_supersign.pay_status' => 1])->order('id DESC')->select();
foreach($xlsData as $k => $v) {
$xlsData[$k]['pay_time'] = date('Y-m-d H:i:s',$v['pay_time']);
}
break;
case 24:
$xlsCell = array(
array('authorization_all_num', '已授权游戏总数'),
array('buy_num', '超级签被购买数量'),
array('money_all', '超级签金额合计'),
);
$map['supersign_token'] = ['NEQ',''];
$supersign_game = M('game', 'tab_')->field('supersign_token')->where($map)->select();
$supersign_token = array_column($supersign_game, 'supersign_token');
$authorization_all_num = 0;
foreach($supersign_token as $k => $v) {
$re_data = [];
$curl['token'] = $v;
$curl['limit'] = 2000;
for ($i = 1;$i > 0;$i++) {
if($i != 1) {
$pop = array_pop($data);
$curl['lastid'] = $pop['id'];
}
$curl_re = json_decode(curl_post('https://app.ipa365.com/Kirin/OpenApi/TicketList',$curl),true);
if($curl_re['errno'] == 0) {
$data = $curl_re['data']['list'];
$re_data = array_merge($re_data,$data);
} else {
break;
}
if(count($data) != $curl['limit']) {
break;
}
}
$authorization_all_num += count($re_data);
}
$where['pay_status'] = 1;
$xlsData[0]['buy_num'] = M('game_supersign', 'tab_')->where($where)->count();
$xlsData[0]['money_all'] = $xlsData[0]['buy_num'] * 10;
$xlsData[0]['authorization_all_num'] = $authorization_all_num;
break;
default:
$xlsName = $xlsCell = $xlsData = [];

@ -37,21 +37,23 @@ class SuperStatisticalController extends ThinkController
$this->display('index');
}
public function lists() {
public function lists($p = 1,$row = 10) {
$page = $p ? $p : 1;
$row = $row ? $row : 10;
$map['supersign_token'] = ['NEQ',''];
$supersign_game = M('game', 'tab_')->field('id,game_name,supersign_token')->where($map)->select();
$supersign_game = M('game', 'tab_')->field('id,game_name,supersign_token')->where($map)->page($page,$row)->select();
$data = [];
$count['authorization'] = 0;
$count['pay_num'] = 0;
$count['promote_super_money'] = 0;
$count['official_super_money'] = 0;
$num['authorization'] = 0;
$num['pay_num'] = 0;
$num['promote_super_money'] = 0;
$num['official_super_money'] = 0;
foreach($supersign_game as $k => $v) {
$arr['game_name'] = $v['game_name'];
$arr['authorization_num'] = count($this->game_supersign_num($v['supersign_token']));
$count['authorization'] += $arr['authorization_num'];
$num['authorization'] += $arr['authorization_num'];
$game_supersign = M('game_supersign', 'tab_')->field('promote_id')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->where(['game_id' => $v['id'], 'pay_status' => 1])->select();
$arr['pay_game_supersign'] = count($game_supersign);
$count['pay_num'] += $arr['pay_game_supersign'];
$num['pay_num'] += $arr['pay_game_supersign'];
$arr['promote_super_money'] = 0;
$arr['official_super_money'] = 0;
@ -62,12 +64,15 @@ class SuperStatisticalController extends ThinkController
$arr['official_super_money'] += $this->super_money;
}
}
$count['official_super_money'] += $arr['official_super_money'];
$count['promote_super_money'] += $arr['promote_super_money'];
$num['official_super_money'] += $arr['official_super_money'];
$num['promote_super_money'] += $arr['promote_super_money'];
$data[] = $arr;
}
$count = M('game', 'tab_')->where($map)->count();
$page = set_pagination($count, $row);
$this->assign('_page', $page);
$this->assign('data', $data);
$this->assign('count', $count);
$this->assign('num', $num);
$this->display('lists');
}
@ -94,26 +99,15 @@ class SuperStatisticalController extends ThinkController
return $re_data;
}
public function superDetail() {
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row = 10;
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
$data = M('game_supersign', 'tab_')->field('tab_game_supersign.order_id,tab_user.account,tab_user.promote_account,tab_user.device_number,tab_game.game_name,tab_game_supersign.pay_time')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->join('tab_game on tab_game_supersign.game_id = tab_game.id')->where(['tab_game_supersign.pay_status' => 1])->page($page,$row)->select();
public function superDetail($p = 1,$row = 10) {
$page = $p ? $p : 1;
$row = $row ? $row : 10;
$data = M('game_supersign', 'tab_')->field('tab_game_supersign.id,tab_game_supersign.order_id,tab_user.account,tab_user.promote_account,tab_user.device_number,tab_game.game_name,tab_game_supersign.pay_time')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->join('tab_game on tab_game_supersign.game_id = tab_game.id')->where(['tab_game_supersign.pay_status' => 1])->page($page,$row)->order('id DESC')->select();
$count = M('game_supersign', 'tab_')->field('tab_game_supersign.order_id,tab_user.account,tab_user.promote_account,tab_user.device_number,tab_game.game_name,tab_game_supersign.pay_time')->join('tab_user on tab_game_supersign.user_id = tab_user.id')->join('tab_game on tab_game_supersign.game_id = tab_game.id')->where(['tab_game_supersign.pay_status' => 1])->count();
$super_money_all = $count * $this->super_money;
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('_page', $page);
$this->assign('data', $data);
$this->assign('super_money', $this->super_money);
$this->assign('super_money_all', $super_money_all);

@ -63,6 +63,9 @@
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('SuperStatistical/index','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
</div>
<div class="input-list search_item">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>24,'xlsname'=>'超级签订单'),I('get.')))}">导出</a>
</div>
</div>

@ -53,16 +53,17 @@
</volist>
<tr>
<td>合计</td>
<td>{$count.authorization}</td>
<td>{$count.pay_num}</td>
<td>{$count.promote_super_money}</td>
<td>{$count.official_super_money}</td>
<td>{$num.authorization}</td>
<td>{$num.pay_num}</td>
<td>{$num.promote_super_money}</td>
<td>{$num.official_super_money}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>22,'xlsname'=>'游戏授权数量余额统计'),I('get.')))}">导出</a>
{$_page|default=''}
</div>
</div>

@ -69,6 +69,7 @@
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>23,'xlsname'=>'超级签购买明细'),I('get.')))}">导出</a>
{$_page|default=''}
</div>
</div>

Loading…
Cancel
Save