master
sunke 5 years ago
parent dee22176f5
commit 5b74e65585

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

@ -1231,6 +1231,8 @@ class FinanceController extends ThinkController
$spend = M('value_detail_log', 'tab_')->where($map5)->sum('value'); $spend = M('value_detail_log', 'tab_')->where($map5)->sum('value');
if(empty($spend)) { if(empty($spend)) {
$spend = '0.00'; $spend = '0.00';
}else {
$spend = number_format(abs($spend),2,'.','');
} }
$map6['user_id'] = $id; $map6['user_id'] = $id;
$map6['pay_type'] = 2; $map6['pay_type'] = 2;
@ -1268,14 +1270,15 @@ class FinanceController extends ThinkController
$allpromoteCoin = empty($promoteCoin) ? '0.00' : number_format($allpromoteCoin,2,'.',''); $allpromoteCoin = empty($promoteCoin) ? '0.00' : number_format($allpromoteCoin,2,'.','');
$map4['create_time'] = $map['create_time']; $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'; $banlaceTotal = '0.00';
foreach($banlace as $k222 => $vvv) { foreach($banlace as $k222 => $vvv) {
$banlaceTotal += $vvv['after_value']; $banlaceTotal += $vvv['after_value'];
} }
$banlaceTotal = number_format($banlaceTotal,2,'.',''); $banlaceTotal = number_format($banlaceTotal,2,'.','');
$map['user_id'] = ['in', $ids]; $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(); // var_dump($newValueByTimeDatas);die();
foreach ($allDatas as $k => $allData) { foreach ($allDatas as $k => $allData) {
$allDatas[$k]['after_value'] = "0.00"; $allDatas[$k]['after_value'] = "0.00";
@ -1297,9 +1300,8 @@ class FinanceController extends ThinkController
$this->assign('endtime', $initEndTime); $this->assign('endtime', $initEndTime);
}else { }else {
$this->assign('starttime', $_REQUEST['timestart']); $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('banlaceTotal', $banlaceTotal);
$this->assign('total', $totalSpend); $this->assign('total', $totalSpend);
$this->assign('deposit', $deposit); $this->assign('deposit', $deposit);
@ -1331,6 +1333,9 @@ class FinanceController extends ThinkController
} }
$total = '0.00'; $total = '0.00';
$t = M('value_detail_log', 'tab_')->where($map)->sum('value'); $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') $valueDetailDatas = M('value_detail_log', 'tab_')->field('order_number, user_id, before_value, value, after_value, create_time, type, remark, pay_type')
->where($map) ->where($map)
->page($page,$row) ->page($page,$row)
@ -1364,15 +1369,21 @@ class FinanceController extends ThinkController
$totalAfterValue = '0.00'; $totalAfterValue = '0.00';
} }
$total = number_format($total,2,'.',''); $total = number_format($total,2,'.','');
// if($total >= 0 ) { if($t >= 0 ) {
// $fuhao = '+'; $fuhao = '+';
// }else { }else {
// $fuhao = '-'; $fuhao = '-';
// } }
$page = set_pagination($counts,$row); $page = set_pagination($counts,$row);
if($page) {$this->assign('_page', $page);} if($page) {$this->assign('_page', $page);}
$this->assign('fuhao', $fuhao); $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('total', $t);
$this->assign('listdata', $vlaueDetailDatas); $this->assign('listdata', $vlaueDetailDatas);
$this->assign('totalAfterValue', $totalAfterValue); $this->assign('totalAfterValue', $totalAfterValue);

@ -48,11 +48,11 @@
</div> </div>
<div class="input-list"> <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="开始时间"/> placeholder="开始时间"/>
- -
<div class="input-append date" id="datetimepicker" style="display:inline-block"> <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="结束时间"/> placeholder="结束时间"/>
<span class="add-on"><i class="icon-th"></i></span> <span class="add-on"><i class="icon-th"></i></span>
</div> </div>
@ -102,6 +102,7 @@
<tr> <tr>
<td>汇总(检索时间内所有数据的统计)</td> <td>汇总(检索时间内所有数据的统计)</td>
<td colspan="3"> <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> <if condition="$total egt 0"><span style="color:red">{$total}</span><else/><span style="color:green">{$total}</span></if>
</td> </td>
<td colspan="1"> <td colspan="1">
@ -113,7 +114,7 @@
</div> </div>
</div> </div>
<div class="page"> <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=''} {$_page|default=''}
</div> </div>

@ -114,7 +114,7 @@
<td>{$data.deposit_amount}</td> <td>{$data.deposit_amount}</td>
<td>{$data.coin_amount}</td> <td>{$data.coin_amount}</td>
<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> </td>
</tr> </tr>
@ -133,7 +133,7 @@
</div> </div>
</div> </div>
<div class="page"> <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=''} {$_page|default=''}
</div> </div>

Loading…
Cancel
Save