Merge branch 'feature/PlatFormCoinData' of wmtx/platform into release

平台币统计
master
廖金灵 5 years ago committed by Gogs
commit 706623235d

@ -2466,7 +2466,230 @@ class ExportController extends Controller
'order_amount'=>$sum_order_amount['sum_order_amount'],
'pay_amount'=>$sum_pay_amount['sum_order_amount']]];
$xlsData = array_merge($xlsData,$sumData);
break;
break;
case 28:
$xlsCell = array(
"账号ID","玩家账号", "账户平台币", "累计使用平台币", "累计充值平台币", "后台发放平台币"
);
$params = I('get.');
$map = [];
$mapBanlance = [];
$mapSpend['pay_status'] = 1;
$mapSpend['pay_way'] = 0;
$mapDeposit['pay_status'] = 1;
$mapPromoteCoin['type'] = 2;
$mapPromoteCoin['sub_type'] = 4;
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initEndTime = date('Y-m-d', time());
if(!empty($params['user_account'])){
$userInfo = M('user', 'tab_')->where(['account'=>I('user_account')])->getField('id');
$map['user_account'] = $params['user_account'];
$mapBanlance['user_account'] = $params['user_account'];
$mapSpend['user_account'] = $params['user_account'];
$mapDeposit['user_account'] = $params['user_account'];
$mapPromoteCoin['target_id'] = $userInfo;
}
if (!empty($params['timestart']) && !empty($params['timeend'])) {
$map['create_time'] = array('between', [strtotime($params['timestart']), strtotime($params['timeend']) + 86399]);
$mapPromoteCoin['create_time'] = array('between', [strtotime($params['timestart']), strtotime($params['timeend']) + 86399]);
$mapDeposit['create_time'] = array('between', [strtotime($params['timestart']), strtotime($params['timeend']) + 86399]);
$mapSpend['pay_time'] = array('between', [strtotime($params['timestart']), strtotime($params['timeend']) + 86399]);
} elseif (!empty($params['timestart']) && empty($params['timeend'])) {
$map['create_time'] = array('between', [strtotime($params['timestart']), time()]);
$mapPromoteCoin['create_time'] = array('between', [strtotime($params['timestart']), time()]);
$mapDeposit['create_time'] = array('between', [strtotime($params['timestart']), time()]);
$mapSpend['pay_time'] = array('between', [strtotime($params['timestart']), time()]);
} elseif (empty($params['timestart']) && !empty($params['timeend'])) {
$map['create_time'] = array('elt', (strtotime($params['timeend']) + 86399));
$mapPromoteCoin['create_time'] = array('elt', (strtotime($params['timeend']) + 86399));
$mapDeposit['create_time'] = array('elt', (strtotime($params['timeend']) + 86399));
$mapSpend['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
}
elseif (empty($_REQUEST['timestart']) && empty($_REQUEST['timeend']) && empty($params['user_account'])) {
$map['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
$mapPromoteCoin['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
$mapDeposit['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
$mapSpend['pay_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
}
$total = M('deposit', 'tab_')->where($mapDeposit)->sum('pay_amount');
$totalSpend = M('spend', 'tab_')->where($mapSpend)->sum('pay_amount');
$total_bind_balance = M('user_play', 'tab_')->where($mapBanlance)->sum('bind_balance');
$totalPromoteCoin = M('promote_coin_record', 'tab_')->where($mapPromoteCoin)->sum('coin');
$total = empty($total) ? '0.00' : $total;
$totalSpend = empty($totalSpend) ? '0.00' : $totalSpend;
$total_bind_balance = empty($total_bind_balance) ? '0.00' : $total_bind_balance;
$totalPromoteCoin = empty($totalPromoteCoin) ? '0.00' : $totalPromoteCoin;
$csvFileName = '平台币统计'.'.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('GBK', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
// $datas = M('user_play','tab_')
// ->group('user_id')
// ->field("id,user_id,user_account,bind_balance")
// ->where($map)
// ->page($page,$row)
// ->select();
$count = M('user_play','tab_')
->field("id,user_id,user_account,bind_balance")
->where($map)
->count('DISTINCT user_id');
$perSize = 10000;//每次查询的条数
$pages = ceil($count / $perSize);
for($i = 1; $i <= $pages; $i++) {
$datas = M('user_play','tab_')
->group('user_id')
->field("user_id,user_account,bind_balance")
->where($map)
->limit(($i-1)*$perSize ,$perSize)
->select();
foreach($datas as $data) {
$user_id = $data['user_id'];
$mapSpend['user_id'] = $user_id;
$mapDeposit['user_id'] = $user_id;
$mapPromoteCoin['target_id'] = $user_id;
$bind_balance = M('user_play', 'tab_')->where(['user_id' => $user_id])->sum('bind_balance');
$spend = M('spend', 'tab_')->where($mapSpend)->sum('pay_amount');
if (empty($spend)) {
$spend = '0.00';
}
$deposit = M('deposit', 'tab_')->where($mapDeposit)->sum('pay_amount');
if (empty($deposit)) {
$deposit = '0.00';
}
$promoteCoin = M('promote_coin_record', 'tab_')->where($mapPromoteCoin)->sum('coin');
if (empty($promoteCoin)) {
$promoteCoin = '0.00';
}
$data['user_id'] = $data['user_id'];
$data['user_account'] = $data['user_account'];
$data['bind_balance'] = $bind_balance;
$data['spend_amount'] = $spend;
$data['deposit_amount'] = $deposit;
$data['coin_amount'] = $promoteCoin;
mb_convert_variables('GBK', 'UTF-8', $data);
fputcsv($fp, $data);
}
unset($datas);//释放变量的内存
//刷新输出缓冲到浏览器
ob_flush();
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
}
$alldatas['user_id'] = "汇总(检索时间内所有数据的统计)";
$alldatas['user_account'] = "";
$alldatas['bind_balance'] = $total_bind_balance;
$alldatas['spend_amount'] = $totalSpend;
$alldatas['deposit_amount'] = $total;
$alldatas['coin_amount'] = $totalPromoteCoin;
mb_convert_variables('GBK', 'UTF-8', $alldatas);
fputcsv($fp, $alldatas);
fclose($fp);
//操作日志
exit();
break;
case 29:
$xlsCell = array(
"订单号","时间", "类型", "变化值", "变化后的平台币"
);
$params = I('get.');
$map = [];
if($orderNumber) {
$map['order_number'] = $params['order_number'];
}
$map['user_id'] = $params['user_id'];
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
} elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
}
$total = 0;
// $valueDetailDatas = M('value_detail_log', 'tab_')->field('order_number, user_id, before_value, value, after_value, create_time, type, remark, pay_type')
// ->where($map)
// ->page($page,$row)
// ->select();
$csvFileName = '平台币明细'.'.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('GBK', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$counts = M('value_detail_log', 'tab_')->field('id')
->where($map)
->count();
$perSize = 10000;//每次查询的条数
$pages = ceil($counts / $perSize);
for($i = 1; $i <= $pages; $i++) {
$valueDetailDatas = M('value_detail_log', 'tab_')->field('order_number, create_time, type, value, after_value, pay_type')
->where($map)
->limit(($i-1)*$perSize ,$perSize)
->select();
foreach ($valueDetailDatas as $key => $valueDetailData) {
$vlaueDetailData['order_number'] = $valueDetailData['order_number'];
$vlaueDetailData['create_time'] = date('Y-m-d H:i:s', $valueDetailData['create_time']);
if($valueDetailData['pay_type'] == 1) {
$vlaueDetailData['type'] = "消费";
$total -= $valueDetailData['value'];
}
if($valueDetailData['pay_type'] == 2) {
$vlaueDetailData['type'] = "充值";
$total += $valueDetailData['value'];
}
if ($valueDetailData['pay_type'] == 3) {
$vlaueDetailData['type'] = "平台发放";
$total += $valueDetailData['value'];
}
$vlaueDetailData['value'] = $valueDetailData['value'];
$vlaueDetailData['after_value'] = $valueDetailData['after_value'];
mb_convert_variables('GBK', 'UTF-8', $vlaueDetailData);
fputcsv($fp, $vlaueDetailData);
}
unset($vlaueDetailDatas);//释放变量的内存
//刷新输出缓冲到浏览器
ob_flush();
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
}
$alldatas['order_number'] = "汇总(检索时间内所有数据的统计)";
$alldatas['create_time'] = "";
$alldatas['type'] = "";
$alldatas['value'] = $total;
$alldatas['after_value'] = "";
mb_convert_variables('GBK', 'UTF-8', $alldatas);
fputcsv($fp, $alldatas);
fclose($fp);
exit;
break;
default:
$xlsName = $xlsCell = $xlsData = [];

@ -1173,4 +1173,171 @@ class FinanceController extends ThinkController
$this->display();
}
public function valueDetail($p = 1) {
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row=10;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$map = [];
$mapBanlance = [];
$mapSpend['pay_status'] = 1;
$mapSpend['pay_way'] = 0;
$mapDeposit['pay_status'] = 1;
$mapPromoteCoin['type'] = 2;
$mapPromoteCoin['sub_type'] = 4;
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initEndTime = date('Y-m-d', time());
if(!empty(I('user_account'))){
$userInfo = M('user', 'tab_')->where(['account'=>I('user_account')])->getField('id');
$map['user_account']=I('user_account');
$mapBanlance['user_account'] = I('user_account');
$mapSpend['user_account'] = I('user_account');
$mapDeposit['user_account'] = I('user_account');
$mapPromoteCoin['target_id'] = $userInfo;
$mapValue['user_id'] = $userInfo;
}
$mapValue['pay_type'] = ['gt', 0];
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$mapPromoteCoin['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$mapDeposit['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$mapSpend['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$mapValue['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
} elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$mapPromoteCoin['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$mapDeposit['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$mapSpend['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$mapValue['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$mapPromoteCoin['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$mapDeposit['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$mapSpend['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$mapValue['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
}elseif (empty($_REQUEST['timestart']) && empty($_REQUEST['timeend']) && empty(I('user_account'))) {
$map['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
$mapPromoteCoin['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
$mapDeposit['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
$mapSpend['pay_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
$mapValue['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
}
$datas = M('user_play','tab_')
->group('user_id')
->field("id,user_id,user_account,bind_balance")
->where($map)
->page($page,$row)
->select();
$count = M('user_play','tab_')
->field("id,user_id,user_account,bind_balance")
->where($map)
->count('DISTINCT user_id');
$total = M('deposit', 'tab_')->where($mapDeposit)->sum('pay_amount');
$totalSpend = M('spend', 'tab_')->where($mapSpend)->sum('pay_amount');
// $total_bind_balance = M('user_play', 'tab_')->where($mapBanlance)->sum('bind_balance');
$totalValueInit = M('value_detail_log', 'tab_')->where(['pay_type'=>0])->sum('after_value');
$totalValueDetail = M('value_detail_log', 'tab_')->where($mapValue)->group('user_id')->order('desc create_time')->sum('after_value');
$total_bind_balance = $totalValueInit + $totalValueDetail;
$totalPromoteCoin = M('promote_coin_record', 'tab_')->where($mapPromoteCoin)->sum('coin');
$total = empty($total) ? '0.00' : $total;
$totalSpend = empty($totalSpend) ? '0.00' : $totalSpend;
$total_bind_balance = empty($total_bind_balance) ? '0.00' : $total_bind_balance;
$totalPromoteCoin = empty($totalPromoteCoin) ? '0.00' : $totalPromoteCoin;
foreach ($datas as $key => $data) {
$user_id = $data['user_id'];
$mapSpend['user_id'] = $user_id;
$mapDeposit['user_id'] = $user_id;
$mapPromoteCoin['target_id'] = $user_id;
$bind_balance = M('user_play', 'tab_')->where(['user_id' => $user_id])->sum('bind_balance');
$spend = M('spend', 'tab_')->where($mapSpend)->sum('pay_amount');
if (empty($spend)) {
$spend = '0.00';
}
$deposit = M('deposit', 'tab_')->where($mapDeposit)->sum('pay_amount');
if (empty($deposit)) {
$deposit = '0.00';
}
$promoteCoin = M('promote_coin_record', 'tab_')->where($mapPromoteCoin)->sum('coin');
if (empty($promoteCoin)) {
$promoteCoin = '0.00';
}
$datas[$key]['bind_balance'] = $bind_balance;
$datas[$key]['spend_amount'] = $spend;
$datas[$key]['deposit_amount'] = $deposit;
$datas[$key]['coin_amount'] = $promoteCoin;
}
$page = set_pagination($count,$row);
// var_dump($page);die();
if($page) {$this->assign('_page', $page);}
if(empty($_REQUEST['timestart']) && empty($_REQUEST['timeend']) && empty(I('user_account'))) {
$this->assign('starttime', $initBegTime);
$this->assign('endtime', $initEndTime);
}else {
$this->assign('starttime', $_REQUEST['timestart']);
$this->assign('endtime', $_REQUEST['endtime']);
}
$this->assign('totalPromoteCoin', $totalPromoteCoin);
$this->assign('total_bind_balance', $total_bind_balance);
$this->assign('totalSpend', $totalSpend);
$this->assign('total', $total);
$this->assign('data', $datas);
$this->display();
}
public function definiteDetaile() {
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row=10;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$user_id = I('user_id');
$orderNumber = I('order_number');
$map = [];
if($orderNumber) {
$map['order_number'] = $orderNumber;
}
$map['user_id'] = $user_id;
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
} elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
}
$total = 0;
$valueDetailDatas = M('value_detail_log', 'tab_')->field('order_number, user_id, before_value, value, after_value, create_time, type, remark, pay_type')
->where($map)
->page($page,$row)
->select();
$counts = M('value_detail_log', 'tab_')->field('id')
->where($map)
->count();
foreach ($valueDetailDatas as $key => $valueDetailData) {
$vlaueDetailDatas[$key]['create_time'] = date('Y-m-d H:i:s', $valueDetailData['create_time']);
$vlaueDetailDatas[$key]['value'] = $valueDetailData['value'];
$vlaueDetailDatas[$key]['after_value'] = $valueDetailData['after_value'];
$vlaueDetailDatas[$key]['order_number'] = $valueDetailData['order_number'];
$vlaueDetailDatas[$key]['pay_type'] = $valueDetailData['pay_type'];
if($valueDetailData['pay_type'] == 1) {
$vlaueDetailDatas[$key]['type'] = "消费";
$total -= $valueDetailData['value'];
}
if($valueDetailData['pay_type'] == 2) {
$vlaueDetailDatas[$key]['type'] = "充值";
$total += $valueDetailData['value'];
}
if ($valueDetailData['pay_type'] == 3) {
$vlaueDetailDatas[$key]['type'] = "平台发放";
$total += $valueDetailData['value'];
}
}
$page = set_pagination($counts,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('total', $total);
$this->assign('listdata', $vlaueDetailDatas);
$this->display();
}
}

@ -0,0 +1,357 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">平台币明细</h3>
<p class="description_text">说明:对于平台币的数据增减记录</p>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list">
<input type="text" id="search-input" name="order_number" class="" value="{:I('order_number')}"
placeholder="订单号"/>
</div>
<div class="input-list">
<input type="hidden" id="search-input" name="user_id" class="" value=""/>
</div>
<div class="input-list">
<input type="text" id="time-start" name="timestart" class="" value="{$timestart}"
placeholder="开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" id="time-end" name="timeend" class="" value="{$timeend}"
placeholder="结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<input type="hidden" name="" value="" class="sortBy">
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('Finance/definiteDetaile','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div>
<table>
<!-- 表头 -->
<thead>
<tr>
<th>订单号</th>
<th>时间</th>
<th>类型</th>
<th>变化值</th>
<th>变化后的平台币</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="listdata">
<td colspan="11" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="listdata" id="data">
<tr>
<td>{$data.order_number}</td>
<td>{$data.create_time}</td>
<td>{$data.type}</td>
<td ><if condition="$data.pay_type eq 1"><span style="color:green">{$data.value}</span><else/><span style="color:red">{$data.value}</span></if></td>
<td>{$data.after_value}</td>
</tr>
</volist>
</empty>
<tr>
<td>汇总(检索时间内所有数据的统计)</td>
<td colspan="8">
<if condition="$total egt 0"><span style="color:red">{$total}</span><else/><span style="color:green">{$total}</span></if>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>29,'xlsname'=>'平台币明细','timestart'=>$startDate,'timeend'=>$endDate),I('get.')))}">导出</a>
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Deposit/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Finance/valueDetail')}');
$(function () {
//搜索功能
$("#search").click(function () {
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
var start = $("#time-start").val();
var end = $("#time-end").val();
if (start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
window.location.href = url;
});
$(".paixu").click(function () {
var that = $(this);
$data_order = that.attr('data-order');
$order_type = '{$userarpu_order}';
if ($order_type == '' || $order_type == '4') {
$(".sortBy").attr('name', 'data_order');
val = '3,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
} else if ($order_type == '3') {
$(".sortBy").attr('name', 'data_order');
val = '4,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
}
});
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
$("#search").click();
}
});
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
$(".drop-down2").on('click', function (event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$('#promoteid').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function () {
navlist.addClass('hidden');
});
event.stopPropagation();
});
var a = $('.i_list_li li a');
$('#promoteid').on('keyup', function (event) {
var val = $.trim($(this).val()).toLowerCase();
$('#promoteid').val(val);
$('#promoteidh').val(-1);
});
$('#promoteidlist').find("a").each(function () {
$(this).click(function () {
var text = $.trim($(this).text()).toLowerCase(),
val = $(this).attr('value');
$('#promoteid').val(text);
$('#promoteidh').val(val);
})
});
$(".d_list").find(".drop-down11").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down11 .nav-list li").find("a").each(function () {
var that = $(".drop-down11");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
$(".d_list").find(".drop-down12").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down12 .nav-list li").find("a").each(function () {
var that = $(".drop-down12");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',
success:function(response){
str = '<option value="">请选择推广员</option>' +
// '<option value="0"'+(promote_id && 0 == promote_id?'selected':'')+'>官方渠道</option>' +
// '<option value="UC"'+(promote_id && 'UC' == promote_id?'selected':'')+'>UC渠道</option>' +
'';
// $.each(response.data, function(index, item){
// console.log(item.id);
// str += '<option value="'+item.id+' '+(promote_id && item.id == promote_id?'selected':'')+'">'+item.nickname+'</option>';
// });
data = response.data;
for (var i in data){
str += "<option value='"+data[i].id+"' "+(promote_id && data[i].id == promote_id?'selected':'')+">"+data[i].nickname+"</option>"
}
$("#promote_id").empty();
$("#promote_id").append(str);
$("#promote_id").select2();
}
})
});
$("#promote_level").change();
})
/**
* 初始化select2单选默认带搜索功能。
*/
//初始化页面加载
$(document).ready(function () {
//初始化select2单选
initSelect2WithSearch();
});
function initSelect2WithSearch() {
// $("#sel_order").select2({
// tags: true,
// placeholder: '订单状态',
// allowClear: false, //清空
// minimumResultsForSearch: Infinity, // 永久隐藏搜索框
// });
}
// 充值补单
$(".pay_repair").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
var pwd2 = prompt("请输入二级密码");
if (!pwd2) {
alert("二级密码不能为空");
return ;
}
$.ajax({
type: 'post',
url: url,
data: {orderNo: data, second: pwd2, type: 'deposit'},
success: function (e) {
if (e.status == 1) {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
} else {
if (e.msg) {
var tip_msg = e.msg;
} else {
var tip_msg = e.info ? e.info : "补单失败";
}
layer.msg(tip_msg, {icon: 2});
}
},
});
});
</script>
</block>

@ -0,0 +1,380 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">平台币统计</h3>
<p class="description_text">说明:对于平台币的数据概览,会根据时间搜索进行数据展示</p>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list">
<input type="text" id="search-input" name="user_account" class="" value="{:I('user_account')}"
placeholder="玩家账号"/>
</div>
<div class="input-list">
<input type="text" id="time-start" name="timestart" class="" value="{$starttime}"
placeholder="开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" id="time-end" name="timeend" class="" value="{$endtime}"
placeholder="结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<!-- <div class="input-list search_item input-list-gamenoticestatus">-->
<!-- <select name="promote_level" style="color:#444" class="select_gallery" id="promote_level">-->
<!-- <option value="">请选择推广员等级</option>-->
<!-- <option value="1" <?php if ($_POST['promote_level'] == 1):?>selected<?php endif;?>>会长</option>-->
<!-- <option value="2" <?php if ($_POST['promote_level'] == 2):?>selected<?php endif;?>>部门长</option>-->
<!-- <option value="3" <?php if ($_POST['promote_level'] == 3):?>selected<?php endif;?>>组长</option>-->
<!-- <option value="4" <?php if ($_POST['promote_level'] == 4):?>selected<?php endif;?>>组员</option>-->
<!-- </select>-->
<!-- - -->
<!-- </div>-->
<!-- <div class="input-list search_item input-list-gamenoticestatus">-->
<!-- <select name="promote_id" style="color:#444" class="select_gallery" id="promote_id">-->
<!-- <option value="">请选择推广员</option>-->
<!-- </select>-->
<!-- </div>-->
<input type="hidden" name="" value="" class="sortBy">
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('Finance/valueDetail','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div>
<table>
<!-- 表头 -->
<thead>
<tr>
<th>账号ID</th>
<th>玩家账号</th>
<th>账户平台币</th>
<th>累计使用平台币</th>
<th>累计充值平台币</th>
<th>后台发放平台币</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="data">
<td colspan="11" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="data" id="data">
<tr>
<td>{$data.user_id}</td>
<td>{$data.user_account}</td>
<td>{$data.bind_balance}</td>
<td><span>{$data.spend_amount}</span></td>
<td>{$data.deposit_amount}</td>
<td>{$data.coin_amount}</td>
<td>
<a href="{:U('Finance/definiteDetaile',['user_id'=>$data['user_id']])}" >查看详情</a>
</td>
</tr>
</volist>
</empty>
<tr>
<td colspan="2">汇总(检索时间内所有数据的统计)</td>
<td>{$total_bind_balance}</td>
<td>{$totalSpend}</td>
<td>{$total}</td>
<td>{$totalPromoteCoin}</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>28,'xlsname'=>'平台币统计','timestart'=>$startDate,'timeend'=>$endDate),I('get.')))}">导出</a>
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Deposit/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Finance/valueDetail')}');
$(function () {
//搜索功能
$("#search").click(function () {
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
var start = $("#time-start").val();
var end = $("#time-end").val();
if (start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
window.location.href = url;
});
$(".paixu").click(function () {
var that = $(this);
$data_order = that.attr('data-order');
$order_type = '{$userarpu_order}';
if ($order_type == '' || $order_type == '4') {
$(".sortBy").attr('name', 'data_order');
val = '3,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
} else if ($order_type == '3') {
$(".sortBy").attr('name', 'data_order');
val = '4,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
}
});
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
$("#search").click();
}
});
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
$(".drop-down2").on('click', function (event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$('#promoteid').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function () {
navlist.addClass('hidden');
});
event.stopPropagation();
});
var a = $('.i_list_li li a');
$('#promoteid').on('keyup', function (event) {
var val = $.trim($(this).val()).toLowerCase();
$('#promoteid').val(val);
$('#promoteidh').val(-1);
});
$('#promoteidlist').find("a").each(function () {
$(this).click(function () {
var text = $.trim($(this).text()).toLowerCase(),
val = $(this).attr('value');
$('#promoteid').val(text);
$('#promoteidh').val(val);
})
});
$(".d_list").find(".drop-down11").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down11 .nav-list li").find("a").each(function () {
var that = $(".drop-down11");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
$(".d_list").find(".drop-down12").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down12 .nav-list li").find("a").each(function () {
var that = $(".drop-down12");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',
success:function(response){
str = '<option value="">请选择推广员</option>' +
// '<option value="0"'+(promote_id && 0 == promote_id?'selected':'')+'>官方渠道</option>' +
// '<option value="UC"'+(promote_id && 'UC' == promote_id?'selected':'')+'>UC渠道</option>' +
'';
// $.each(response.data, function(index, item){
// console.log(item.id);
// str += '<option value="'+item.id+' '+(promote_id && item.id == promote_id?'selected':'')+'">'+item.nickname+'</option>';
// });
data = response.data;
for (var i in data){
str += "<option value='"+data[i].id+"' "+(promote_id && data[i].id == promote_id?'selected':'')+">"+data[i].nickname+"</option>"
}
$("#promote_id").empty();
$("#promote_id").append(str);
$("#promote_id").select2();
}
})
});
$("#promote_level").change();
})
/**
* 初始化select2单选默认带搜索功能。
*/
//初始化页面加载
$(document).ready(function () {
//初始化select2单选
initSelect2WithSearch();
});
function initSelect2WithSearch() {
// $("#sel_order").select2({
// tags: true,
// placeholder: '订单状态',
// allowClear: false, //清空
// minimumResultsForSearch: Infinity, // 永久隐藏搜索框
// });
}
// 充值补单
$(".pay_repair").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
var pwd2 = prompt("请输入二级密码");
if (!pwd2) {
alert("二级密码不能为空");
return ;
}
$.ajax({
type: 'post',
url: url,
data: {orderNo: data, second: pwd2, type: 'deposit'},
success: function (e) {
if (e.status == 1) {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
} else {
if (e.msg) {
var tip_msg = e.msg;
} else {
var tip_msg = e.info ? e.info : "补单失败";
}
layer.msg(tip_msg, {icon: 2});
}
},
});
});
</script>
</block>

@ -67,8 +67,12 @@ class PromoteCoinRecordService {
return $items;
}
public function addRecord($params) {
public function addRecord($params,$valueDetailData = []) {
$data = $this->createRecord($params);
if(!empty($valueDetailData)) {
$valueDetailData['order_number'] = $data['sn'];
addValueDetail($valueDetailData);
}
return M('PromoteCoinRecord', 'tab_')->add($data);
}

@ -443,6 +443,7 @@ class PromoteService {
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$user = M('user', 'tab_')->where(['id' => $userId])->find();
$userPlay = M('user_play', 'tab_')->where(['user_id' => $userId])->find();
$before_value = M('user_play', 'tab_')->where(['user_id' => $userId])->sum('bind_balance');
$game = M('game', 'tab_')->where(['id' => $gameId])->find();
$fromBalanceCoin = 0;
if ($isUseBind) {
@ -513,8 +514,19 @@ class PromoteService {
'description' => $isUseBind ? '绑定币转账' : '通用币转账',
'remark' => $remark,
];
$promoteCoinRecordService->addRecord($fromRecord);
$valueDetailData = [
'user_id' => $userId,
'before_value' => $before_value,
'value' => $num,
'after_value' => $num + $before_value,
'create_time' => time(),
'type' => 1,
'remark' => $remark,
'pay_type' => 3,
];
$promoteCoinRecordService->addRecord($fromRecord, $valueDetailData);
$incStatus = M('user_play', 'tab_')->where(['game_id' => $gameId, 'user_id' => $userId])->setInc('bind_balance', $num);
$decStatus = $this->decCoin($promoteId, $num, $isUseBind ? $gameId : 0);
if (!$incStatus || !$decStatus) {

@ -1483,4 +1483,13 @@ function getGameGroup($uid) {
return $groupId['group_id']?$groupId['group_id']:0;
}
function addValueDetail($data) {
$user_id = $data['user_id'];
$detailInfo = M('value_detail_log', 'tab_')->field('id')->where(['user_id'=>$user_id, 'pay_type'=>0])->find();
if(!empty($detailInfo)) {
M('value_detail_log', 'tab_')->where(['id'=>$detailInfo['id']])->delete();
}
return M('value_detail_log', 'tab_')->add($data);
}

@ -350,11 +350,11 @@
success: function (data) {
console.log();
str = "<option value=''>请选择区服</option>";
var support_quota = "<span>单角色可申请上限0</span>";
// var support_quota = "<span>单角色可申请上限0</span>";
for (var i in data) {
str += "<option server-id="+data[i].id+" value='" + data[i].server_name + "'>" + data[i].server_name + "</option>"
var support_quota = "<span>单角色可申请上限:" + data[i].support_quota + "</span>"
// var support_quota = "<span>单角色可申请上限:" + data[i].support_quota + "</span>"
}
$('#support_quota').html(support_quota);

Loading…
Cancel
Save