平台币

master
sunke 5 years ago
parent ae0e10166a
commit 163388e75c

@ -2569,15 +2569,27 @@ class ExportController extends Controller
$map8[] = ['u.id = v.user_id'];
$map8['v.create_time'] = $map['create_time'];
$valueQuery5 = M('value_detail_log', 'tab_')->alias('v')->field('if(sum(abs(v.value)) != null, sum(abs(v.value)) , 0) as spend_value')
$map9[] = ['u.id = v.user_id'];
$map9['v.pay_type'] = 3;
if (!empty($map['create_time'][1][1])) {
$map9['v.create_time'] = ['elt', $map['create_time'][1][1] ];
}
if (!empty($map['create_time'][1][0]) && empty($map['create_time'][1][1])) {
$map9['v.create_time'] = ['egt', $map['create_time'][1][0] ];
}
$valueQuery5 = M('value_detail_log', 'tab_')->alias('v')->field('IFNULL(sum(abs(v.value)), 0) 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();
$valueQuery8 = M('value_detail_log', 'tab_')->alias('v')->field('after_value')->where($map8)->order('create_time desc')->limit(1)->buildSql();
$datas = M('user', 'tab_')->alias('u')->field("u.id, u.account, {$valueQuery8} as totalvalue, {$valueQuery5} as spendvalue, {$valueQuery6} as deposit, {$valueQuery7} as promoteCoin , if (({$valueQuery6}) - ({$valueQuery5}) > 0, ({$valueQuery6}) - ({$valueQuery5}), 0) as restvalue")->where($map)->limit(($i-1)*$perSize ,$perSize)->order('restvalue desc')->group('u.id')->select();
$query = M('user', 'tab_')->alias('u')->field("u.id, u.account, {$valueQuery8} as totalvalue, {$valueQuery5} as spendvalue, {$valueQuery6} as deposit, {$valueQuery7} as promoteCoin , if (({$valueQuery6}) - ({$valueQuery5}) > 0, ({$valueQuery6}) - ({$valueQuery5}), 0) as restvalue")->where($map)->order('id desc')->group('u.id')->buildSql();
$valueQuery9 = M('value_detail_log', 'tab_')->alias('v')->field('IFNULL(sum(abs(v.value)), 0) as spend_value')
->where($map9)->buildSql();
$datas = M('user', 'tab_')->alias('u')->field("u.id, u.account, {$valueQuery8} as totalvalue, {$valueQuery5} as spendvalue, {$valueQuery6} as deposit, {$valueQuery7} as promoteCoin , if (({$valueQuery8}) - ({$valueQuery9}) > 0, ({$valueQuery8}) - ({$valueQuery9}), 0) as restvalue")->where($map)->limit(($i-1)*$perSize ,$perSize)->order('restvalue desc')->group('u.id')->select();
$query = M('user', 'tab_')->alias('u')->field("u.id, u.account, {$valueQuery8} as totalvalue, {$valueQuery5} as spendvalue, {$valueQuery6} as deposit, {$valueQuery7} as promoteCoin , if (({$valueQuery8}) - ({$valueQuery9}) > 0, ({$valueQuery8}) - ({$valueQuery9}), 0) as restvalue")->where($map)->order('id desc')->group('u.id')->buildSql();
$allTotalValue1 = M()->alias('t')->table($query)->sum('t.totalvalue');
$allRestValue = M()->alias('rest')->table($query)->sum('rest.restvalue');
$allDatas = [];
@ -2607,7 +2619,7 @@ class ExportController extends Controller
// $map7['pay_type'] = 3;
// $map7['create_time'] = $map['create_time'];
// $promoteCoin = M('value_detail_log', 'tab_')->where($map7)->sum('value');
$promoteCoin = $data['promoteCoin'];
$promoteCoin = $data['promotecoin'];
if(empty($promoteCoin)) {
$promoteCoin = '0.00';
}

@ -1335,15 +1335,26 @@ class FinanceController extends ThinkController
$map8[] = ['u.id = v.user_id'];
$map8['v.create_time'] = $map['create_time'];
$valueQuery5 = M('value_detail_log', 'tab_')->alias('v')->field('if(sum(abs(v.value)) != null, sum(abs(v.value)) , 0) as spend_value')
$map9[] = ['u.id = v.user_id'];
$map9['v.pay_type'] = 3;
if (!empty($map['create_time'][1][1])) {
$map9['v.create_time'] = ['elt', $map['create_time'][1][1] ];
}
if (!empty($map['create_time'][1][0]) && empty($map['create_time'][1][1])) {
$map9['v.create_time'] = ['egt', $map['create_time'][1][0] ];
}
$valueQuery5 = M('value_detail_log', 'tab_')->alias('v')->field('IFNULL(sum(abs(v.value)), 0) 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();
$valueQuery9 = M('value_detail_log', 'tab_')->alias('v')->field('IFNULL(sum(abs(v.value)), 0) as spend_value')
->where($map9)->buildSql();
$valueQuery8 = M('value_detail_log', 'tab_')->alias('v')->field('after_value')->where($map8)->order('create_time desc')->limit(1)->buildSql();
$datas = M('user', 'tab_')->alias('u')->field("u.id, u.account, {$valueQuery8} as totalvalue, {$valueQuery5} as spendvalue, {$valueQuery6} as deposit, {$valueQuery7} as promoteCoin , if (({$valueQuery6}) - ({$valueQuery5}) > 0, ({$valueQuery6}) - ({$valueQuery5}), 0) as restvalue")->where($map0)->page($page,$row)->order($order)->group('u.id')->select();
$query = M('user', 'tab_')->alias('u')->field("u.id, u.account, {$valueQuery8} as totalvalue, {$valueQuery5} as spendvalue, {$valueQuery6} as deposit, {$valueQuery7} as promoteCoin , if (({$valueQuery6}) - ({$valueQuery5}) > 0, ({$valueQuery6}) - ({$valueQuery5}), 0) as restvalue")->where($map0)->order($order)->group('u.id')->buildSql();
$datas = M('user', 'tab_')->alias('u')->field("u.id, u.account, {$valueQuery8} as totalvalue, {$valueQuery5} as spendvalue, {$valueQuery6} as deposit, {$valueQuery7} as promoteCoin , if (({$valueQuery8}) - ({$valueQuery9}) > 0, ({$valueQuery8}) - ({$valueQuery9}), 0) as restvalue")->where($map0)->page($page,$row)->order($order)->group('u.id')->select();
$query = M('user', 'tab_')->alias('u')->field("u.id, u.account, {$valueQuery8} as totalvalue, {$valueQuery5} as spendvalue, {$valueQuery6} as deposit, {$valueQuery7} as promoteCoin , if (({$valueQuery8}) - ({$valueQuery9}) > 0, ({$valueQuery8}) - ({$valueQuery9}), 0) as restvalue")->where($map0)->order($order)->group('u.id')->buildSql();
$allTotalValue1 = M()->alias('t')->table($query)->sum('t.totalvalue');
$allRestValue = M()->alias('rest')->table($query)->sum('rest.restvalue');

Loading…
Cancel
Save