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

平台币统计bug修复
master
廖金灵 5 years ago committed by Gogs
commit f8228ae41b

@ -2505,16 +2505,15 @@ class ExportController extends Controller
$map2['create_time'] = $map['create_time'];
$map2['pay_type'] = 2;
$deposit = M('value_detail_log', 'tab_')->where($map2)->sum('value');
$deposit= empty($deposit) ? '0.00' : $deposit;
$deposit1 = M('value_detail_log', 'tab_')->where($map2)->sum('value');
$deposit1= empty($deposit1) ? '0.00' : $deposit1;
$map3['create_time'] = $map['create_time'];
$map3['pay_type'] = 3;
$allpromoteCoin = M('value_detail_log', 'tab_')->where($map3)->sum('value');
$allpromoteCoin = empty($promoteCoin) ? '0.00' : $promoteCoin;
$map4['create_time'] = $map['create_time'];
$banlace = M('value_detail_log', 'tab_')->field('user_id, after_value')->where($map4)->group('user_id')->select();
$banlace = M('value_detail_log', 'tab_')->field('user_id, after_value')->where($map4)->order('create_time desc')->limit(1)->select();
$banlaceTotal = 0;
foreach($banlace as $k222 => $vvv) {
$banlaceTotal += $vvv['after_value'];
@ -2546,18 +2545,20 @@ class ExportController extends Controller
->select();
$allDatas = [];
foreach($datas as $key => $data) {
$allDatas['user_id'] = $data['id'];
$allDatas['user_account'] = $data['account'];
$spend = M('value_detail_log', 'tab_')->where(['user_id'=>$id, 'pay_type'=>1])->sum('value');
$map5['user_id'] = $id;
$spend = M('value_detail_log', 'tab_')->where(['user_id'=>$data['id'], 'pay_type'=>1])->sum('value');
$map5['user_id'] = $data['id'];
$map5['pay_type'] = 1;
$map5['create_time'] = $map['create_time'];
$spend = M('value_detail_log', 'tab_')->where($map5)->sum('value');
if(empty($spend)) {
$spend = '0.00';
}else {
$spend = number_format(abs($spend),2,'.','');
}
$map6['user_id'] = $id;
$map6['user_id'] = $data['id'];
$map6['pay_type'] = 2;
$map6['create_time'] = $map['create_time'];
$deposit = M('value_detail_log', 'tab_')->where($map6)->sum('value');
@ -2572,13 +2573,13 @@ class ExportController extends Controller
$promoteCoin = '0.00';
}
$map8['user_id'] = $id;
$map8['user_id'] = $data['id'];
$map8['create_time'] = $map['create_time'];
$newValueByTimeDatas = M('value_detail_log', 'tab_')->field('after_value')->where($map8)->group('user_id')->select();
$newValueByTimeDatas = M('value_detail_log', 'tab_')->field('after_value')->where($map8)->order('create_time desc')->limit(1)->select();
if(empty($newValueByTimeDatas)) {
$aValue = '0.00';
}else {
$aValue = $newValueByTimeDatas['after_value'];
$aValue = $newValueByTimeDatas[0]['after_value'];
}
$allDatas['bind_balance'] = $aValue;
$allDatas['spend_amount'] = $spend;
@ -2597,8 +2598,8 @@ class ExportController extends Controller
$alldatas1['user_id'] = "汇总(检索时间内所有数据的统计)";
$alldatas1['user_account'] = "";
$alldatas1['bind_balance'] = $banlaceTotal;
$alldatas1['spend_amount'] = $totalSpend;
$alldatas1['deposit_amount'] = $deposit;
$alldatas1['spend_amount'] = abs($totalSpend);
$alldatas1['deposit_amount'] = $deposit1;
$alldatas1['coin_amount'] = $promoteCoin;
mb_convert_variables('GBK', 'UTF-8', $alldatas1);
fputcsv($fp, $alldatas1);
@ -2694,9 +2695,14 @@ class ExportController extends Controller
ob_flush();
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
}
if($t >= 0 ) {
$fuhao = '+';
}else {
$fuhao = '-';
}
$alldatas['order_number'] = "汇总(检索时间内所有数据的统计)";
$alldatas['create_time'] = "";
$alldatas['type'] = "";
$alldatas['type'] = $fuhao;
$alldatas['value'] = $t;
$alldatas['after_value'] = $first;

@ -1234,6 +1234,8 @@ class FinanceController extends ThinkController
$spend = M('value_detail_log', 'tab_')->where($map5)->sum('value');
if(empty($spend)) {
$spend = '0.00';
}else {
$spend = number_format(abs($spend),2,'.','');
}
$map6['user_id'] = $id;
$map6['pay_type'] = 2;
@ -1271,14 +1273,15 @@ class FinanceController extends ThinkController
$allpromoteCoin = empty($promoteCoin) ? '0.00' : number_format($allpromoteCoin,2,'.','');
$map4['create_time'] = $map['create_time'];
$banlace = M('value_detail_log', 'tab_')->field('user_id, after_value')->where($map4)->group('user_id')->select();
$banlace = M('value_detail_log', 'tab_')->field('user_id, after_value')->where($map4)->order('create_time desc')->limit(1)->select();
$banlaceTotal = '0.00';
foreach($banlace as $k222 => $vvv) {
$banlaceTotal += $vvv['after_value'];
}
$banlaceTotal = number_format($banlaceTotal,2,'.','');
$map['user_id'] = ['in', $ids];
$newValueByTimeDatas = M('value_detail_log', 'tab_')->field('user_id, after_value')->where($map)->group('user_id')->select();
$newValueByTimeDatas = M('value_detail_log', 'tab_')->field('user_id, after_value, create_time')->where($map)->order('create_time desc')->limit(1)->select();
// var_dump($newValueByTimeDatas);die();
foreach ($allDatas as $k => $allData) {
$allDatas[$k]['after_value'] = "0.00";
@ -1300,9 +1303,8 @@ class FinanceController extends ThinkController
$this->assign('endtime', $initEndTime);
}else {
$this->assign('starttime', $_REQUEST['timestart']);
$this->assign('endtime', $_REQUEST['endtime']);
$this->assign('endtime', $_REQUEST['timeend']);
}
//var_dump($allDatas);die();
$this->assign('banlaceTotal', $banlaceTotal);
$this->assign('total', $totalSpend);
$this->assign('deposit', $deposit);
@ -1334,6 +1336,9 @@ class FinanceController extends ThinkController
}
$total = '0.00';
$t = M('value_detail_log', 'tab_')->where($map)->sum('value');
if (empty($t)) {
$t = '0.00';
}
$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)
@ -1367,15 +1372,21 @@ class FinanceController extends ThinkController
$totalAfterValue = '0.00';
}
$total = number_format($total,2,'.','');
// if($total >= 0 ) {
// $fuhao = '+';
// }else {
// $fuhao = '-';
// }
if($t >= 0 ) {
$fuhao = '+';
}else {
$fuhao = '-';
}
$page = set_pagination($counts,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('fuhao', $fuhao);
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('total', $t);
$this->assign('listdata', $vlaueDetailDatas);
$this->assign('totalAfterValue', $totalAfterValue);

@ -48,11 +48,11 @@
</div>
<div class="input-list">
<input type="text" id="time-start" name="timestart" class="" value="{$timestart}"
<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="{$timeend}"
<input type="text" id="time-end" name="timeend" class="" value="{$endtime}"
placeholder="结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
@ -102,6 +102,7 @@
<tr>
<td>汇总(检索时间内所有数据的统计)</td>
<td colspan="3">
<if condition="$total egt 0"><span style="color:red">{$fuhao}</span><else/><span style="color:green">{$fuhao}</span></if>
<if condition="$total egt 0"><span style="color:red">{$total}</span><else/><span style="color:green">{$total}</span></if>
</td>
<td colspan="1">
@ -113,7 +114,7 @@
</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>
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>29,'xlsname'=>'平台币明细','timestart'=>$starttime,'timeend'=>$endtime),I('get.')))}">导出</a>
{$_page|default=''}
</div>

@ -114,7 +114,7 @@
<td>{$data.deposit_amount}</td>
<td>{$data.coin_amount}</td>
<td>
<a href="{:U('Finance/definiteDetaile',['user_id'=>$data['user_id']])}" >查看详情</a>
<a href="{:U('Finance/definiteDetaile',['user_id'=>$data['user_id'], 'timestart'=>$starttime, 'timeend'=>$endtime])}" >查看详情</a>
</td>
</tr>
@ -133,7 +133,7 @@
</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>
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>28,'xlsname'=>'平台币统计','timestart'=>$starttime,'timeend'=>$endtime),I('get.')))}">导出</a>
{$_page|default=''}
</div>

Loading…
Cancel
Save