平台币新增需求

master
sunke 5 years ago
parent bf8c6603a0
commit 2adcb68c06

@ -1243,6 +1243,10 @@ class FinanceController extends ThinkController
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initEndTime = date('Y-m-d', time());
$sort = $_REQUEST['sort'];
if (empty($sort)) {
$sort = 13;
}
if(!empty($_REQUEST['user_account'])) {
$map['account'] = $_REQUEST['user_account'];
$map0['account'] = $_REQUEST['user_account'];
@ -1266,11 +1270,70 @@ class FinanceController extends ThinkController
$map['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]);
}
$datas = M('user', 'tab_')
->field('id, account')
->where($map0)
->page($page,$row)
->select();
$order = 'id desc';
if ($sort == 1) {
$order = 'spendvalue desc';
}
if ($sort == 2) {
$order = 'deposit desc';
}
if ($sort == 3 || $sort == 5) {
$order = 'spendvalue desc';
}
if ($sort == 4) {
$order = 'spendvalue asc';
}
if ($sort == 6) {
$order = 'deposit desc';
}
if ($sort == 7) {
$order = 'deposit asc';
}
if ($sort == 9) {
$order = 'promoteCoin desc';
}
if ($sort == 10) {
$order = 'promoteCoin asc';
}
if ($sort == 11) {
$order = 'id asc';
}
if ($sort == 12) {
$order = 'id desc';
}
$this->assign('sorting', $sort);
$map5['v.pay_type'] = 1;
$map5['v.create_time'] = $map['create_time'];
$map5[] = ['u.id = v.user_id'] ;
$map6[] = ['u.id = v.user_id'];
$map6['v.pay_type'] = 2;
$map6['v.create_time'] = $map['create_time'];
$map7[] = ['u.id = v.user_id'];
$map7['v.pay_type'] = 3;
$map7['v.create_time'] = $map['create_time'];
$valueQuery5 = M('value_detail_log', 'tab_')->alias('v')->field('sum(abs(v.value)) as spend_value')
->where($map5)->buildSql();
$valueQuery6 = M('value_detail_log', 'tab_')->alias('v')->field('sum(v.value) as spend_value')
->where($map6)->buildSql();
$valueQuery7 = M('value_detail_log', 'tab_')->alias('v')->field('sum(v.value) as spend_value')
->where($map7)->buildSql();
$datas = M('user', 'tab_')->alias('u')->field("u.id, u.account, {$valueQuery5} as spendvalue, {$valueQuery6} as deposit, {$valueQuery7} as promoteCoin")->where($map0)->page($page,$row)->order($order)->group('u.id')->select();
// var_dump($datas);die();
// $datas = M('user', 'tab_')
// ->field('id, account')
// ->where($map0)
// ->page($page,$row)
// ->order('id desc')
// ->select();
$count = M('user', 'tab_')
->field('id, account')
->where($map)
@ -1285,30 +1348,38 @@ class FinanceController extends ThinkController
$account = $data['account'];
$allDatas[$key]['user_id'] = $id;
$allDatas[$key]['user_account'] = $account;
$map5['user_id'] = $id;
$map5['pay_type'] = 1;
$map5['create_time'] = $map['create_time'];
$spend = M('value_detail_log', 'tab_')->where($map5)->sum('value');
// $map5['user_id'] = $id;
// $map5['pay_type'] = 1;
// $map5['create_time'] = $map['create_time'];
// $spend = M('value_detail_log', 'tab_')->where($map5)->sum('value');
$spend = $data['spendvalue'];
if(empty($spend)) {
$spend = '0.00';
}else {
$spend = number_format(abs($spend),2,'.','');
}
$map6['user_id'] = $id;
$map6['pay_type'] = 2;
$map6['create_time'] = $map['create_time'];
$deposit = M('value_detail_log', 'tab_')->where($map6)->sum('value');
// $map6['user_id'] = $id;
// $map6['pay_type'] = 2;
// $map6['create_time'] = $map['create_time'];
// $deposit = M('value_detail_log', 'tab_')->where($map6)->sum('value');
$deposit = $data['deposit'];
if(empty($deposit)) {
$deposit = '0.00';
}
$map7['user_id'] = $id;
$map7['pay_type'] = 3;
$map7['create_time'] = $map['create_time'];
$promoteCoin = M('value_detail_log', 'tab_')->where($map7)->sum('value');
// $map7['user_id'] = $id;
// $map7['pay_type'] = 3;
// $map7['create_time'] = $map['create_time'];
// $promoteCoin = M('value_detail_log', 'tab_')->where($map7)->sum('value');
$promoteCoin = $data['promoteCoin'];
if(empty($promoteCoin)) {
$promoteCoin = '0.00';
}
$restValue = $data['restValue'];
if(empty($restValue)) {
$restValue = '0.00';
}
// $allDatas[$key]['bind_balance'] = $bind_balance;
$allDatas[$key]['rest_value'] = $deposit - $spend ;
$allDatas[$key]['spend_amount'] = $spend;
$allDatas[$key]['deposit_amount'] = $deposit;
$allDatas[$key]['coin_amount'] = $promoteCoin;

@ -74,9 +74,11 @@
<!-- </div>-->
<input type="hidden" name="" value="" class="sortBy">
<input type="hidden" name="sort" value="" id="sort">
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('Finance/valueDetail','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
url="{:U('Finance/valueDetail','model='.$model['name'] . '&row='.I('row'),false)}">搜索{$sorting}</a>
</div>
</div>
@ -90,12 +92,47 @@
<!-- 表头 -->
<thead>
<tr>
<th>账号ID</th>
<if condition="$sorting eq 13">
<th onclick="idsort(0)" id="zheng">账号ID</th>
<elseif condition="$sorting eq 12" />
<th onclick="idsort(1)" id="dao">账号ID<span ></span></th>
<elseif condition="$sorting eq 11" />
<th onclick="idsort(2)" id="sheng">账号ID<span></span></th>
<else />
<th onclick="idsort(0)" id="zheng">账号ID</th>
</if>
<th>玩家账号</th>
<th>账户平台币</th>
<th>累计使用平台币</th>
<th>累计充值平台币</th>
<th>后台发放平台币</th>
<th>平台币余额</th>
<th>平台币直充余额</th>
<if condition="$sorting eq 13">
<th onclick="idsort(3)" id="zheng1">平台币直充支出</th>
<elseif condition="$sorting eq 3" />
<th onclick="idsort(4)" id="dao1">平台币直充支出<span ></span></th>
<elseif condition="$sorting eq 4" />
<th onclick="idsort(5)" id="sheng1">平台币直充支出<span ></span></th>
<else />
<th onclick="idsort(3)" id="zheng1">平台币直充支出</th>
</if>
<if condition="$sorting eq 13">
<th onclick="idsort(6)" id="zheng1">平台币直充金额</th>
<elseif condition="$sorting eq 6" />
<th onclick="idsort(7)" id="dao1">平台币直充金额<span ></span></th>
<elseif condition="$sorting eq 7" />
<th onclick="idsort(8)" id="sheng1">平台币直充金额<span ></span></th>
<else />
<th onclick="idsort(6)" id="zheng1">平台币直充金额</th>
</if>
<if condition="$sorting eq 13">
<th onclick="idsort(9)" id="zheng1">后台发放平台币</th>
<elseif condition="$sorting eq 9" />
<th onclick="idsort(10)" id="dao1">后台发放平台币<span ></span></th>
<elseif condition="$sorting eq 10" />
<th onclick="idsort(15)" id="sheng1">后台发放平台币<span ></span></th>
<else />
<th onclick="idsort(9)" id="zheng1">后台发放平台币</th>
</if>
<th>操作</th>
</tr>
</thead>
@ -110,6 +147,7 @@
<td>{$data.user_id}</td>
<td>{$data.user_account}</td>
<td>{$data.after_value}</td>
<td>{$data.rest_value}</td>
<td><span>{$data.spend_amount}</span></td>
<td>{$data.deposit_amount}</td>
<td>{$data.coin_amount}</td>
@ -377,4 +415,62 @@
});
});
</script>
<script>
function idsort(status) {
if(status == 0) {
document.getElementById('sort').value = 11
document.getElementById('search').click();
}
if (status == 1 ) {
document.getElementById('sort').value = 11
document.getElementById('search').click();
}
if (status == 2 ) {
alert('aaa')
document.getElementById('sort').value = 12
document.getElementById('search').click();
}
if (status == 3) {
document.getElementById('sort').value = 4
document.getElementById('search').click();
}
if (status == 4) {
document.getElementById('sort').value = 4
document.getElementById('search').click();
}
if (status == 5) {
document.getElementById('sort').value = 3
document.getElementById('search').click();
}
if (status == 6) {
document.getElementById('sort').value = 6
document.getElementById('search').click();
}
if (status == 7) {
document.getElementById('sort').value = 7
document.getElementById('search').click();
}
if (status == 8) {
document.getElementById('sort').value = 6
document.getElementById('search').click();
}
if (status == 9) {
document.getElementById('sort').value = 9
document.getElementById('search').click();
}
if (status == 10) {
document.getElementById('sort').value = 10
document.getElementById('search').click();
}
if (status == 15) {
document.getElementById('sort').value = 9
document.getElementById('search').click();
}
}
</script>
</block>

Loading…
Cancel
Save