diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 4f99ee409..c5e1fc945 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -694,6 +694,9 @@ class PromoteController extends ThinkController */ public function spend_list() { + if(!array_key_exists("timeStart",$_REQUEST)){ + $this->redirect(ACTION_NAME, array('timeStart' => date('Y-m-d',strtotime('-30 day')),"timeEnd"=>date('Y-m-d'))); + } if (isset($_REQUEST['game_name'])) { if ($_REQUEST['game_name']=='全部') { unset($_REQUEST['game_name']); @@ -799,7 +802,7 @@ class PromoteController extends ThinkController setPowerPromoteIds($map); // dd($map); $model = array( - 'm_name' => 'Spend', + 'm_name' => 'spend use index(promote_time)', 'map' => $map, 'order' => 'id desc', 'title' => '渠道充值', @@ -814,9 +817,9 @@ class PromoteController extends ThinkController ]; //为数据权限添加 setPowerPromoteIds($map2); - $total = null_to_0(D('Spend')->where($map1)->sum('pay_amount'));//累计充值 - $ttotal = null_to_0(D('Spend')->where(['pay_time' => total(1, false)])->where($map2)->sum('pay_amount'));//昨日充值 - $ytotal = null_to_0(D('Spend')->where(['pay_time' => total(5, false)])->where($map2)->sum('pay_amount'));//今日充值 + $total = null_to_0(M('Spend use index(promote_time)',"tab_")->where($map1)->sum('pay_amount'));//累计充值 + $ttotal = null_to_0(M('Spend use index(promote_time)',"tab_")->where(['pay_time' => total(1, false)])->where($map2)->sum('pay_amount'));//昨日充值 + $ytotal = null_to_0(M('Spend use index(promote_time)',"tab_")->where(['pay_time' => total(5, false)])->where($map2)->sum('pay_amount'));//今日充值 // dd($total,$ttotal,$ytotal); $this->assign('total', $total); $this->assign('ttotal', $ttotal); diff --git a/Application/Admin/Event/SpendEvent.class.php b/Application/Admin/Event/SpendEvent.class.php index 141f6b7ca..1ef3df1d3 100644 --- a/Application/Admin/Event/SpendEvent.class.php +++ b/Application/Admin/Event/SpendEvent.class.php @@ -31,8 +31,8 @@ class SpendEvent extends ThinkEvent { $model['order'] = $data_order_type.' '.$sort; } - $new_model = D($name); - $data = D($name) + $new_model = M($name,"tab_"); + $data = $new_model // 查询条件 ->where($map) /* 默认通过id逆序排列 */ @@ -44,7 +44,7 @@ class SpendEvent extends ThinkEvent { /* 执行查询 */ ->select(); /* 查询记录总数 */ - $count = D($name) + $count = $new_model // 查询条件 ->where($map) /* 默认通过id逆序排列 */