diff --git a/Application/Admin/Controller/SpendCountSetController.class.php b/Application/Admin/Controller/SpendCountSetController.class.php index a20fc3417..2ea622e92 100644 --- a/Application/Admin/Controller/SpendCountSetController.class.php +++ b/Application/Admin/Controller/SpendCountSetController.class.php @@ -20,7 +20,7 @@ class SpendCountSetController extends \Think\Controller $this->endThismonth = mktime(0,0,0,date('m'),1,date('Y'))-1; $this->date = date('Y')."-".((date('m')-1) > 9 ? (date('m')-1) : "0".(date('m')-1)); $this->nowdata =time(); - $this->model =M("spend_count",'tab_'); + $this->model =M(); $this->usermodel =M("spend_user_count",'tab_'); $this->monthmodel =M("spend_month_count",'tab_'); $this->gamemodel =M("spend_count",'tab_'); @@ -75,7 +75,6 @@ class SpendCountSetController extends \Think\Controller die("error:Repeated statistics,msg:{$this->date}已经聚合过"); } $this->model->startTrans(); - $this->usermodel->startTrans(); $this->continue =true; //执行游戏表统计 $this->setGameCount(); @@ -85,8 +84,6 @@ class SpendCountSetController extends \Think\Controller $this->setMonthCount(); //执行 $this->model->commit(); - $this->usermodel->commit(); - $t2 = microtime(true); die("success runtime:".round($t2-$t1,3).'s'); } @@ -216,7 +213,7 @@ class SpendCountSetController extends \Think\Controller //执行 for ($i=0; $i < $count; $i++) { $d = $gameres[$i]; - if($d['level'] == 0){ + if($d['level'] < 2){ $adddata[$d['promote_id']] = $d; $userarr[] =$d['promote_id']; }else{ @@ -273,7 +270,7 @@ class SpendCountSetController extends \Think\Controller $chain = trim($d['chain'],"/"); $pid = explode("/", $chain); $pid[] = $d['promote_id'];//添加自己 - if($d['level'] == 0){ + if($d['level'] < 2){ if(in_array($d["promote_id"], $userarr)){ //存在 $adddata[$pid[$k]]["inside_cash_count"] += $insideRes[$i]['num']; @@ -316,7 +313,11 @@ class SpendCountSetController extends \Think\Controller $v["create_time"] = $this->nowdata; //聚合不含内充流水 $v['all_count'] = $v["cash_count"]-0+$v["balance_coin_count"]-0+$v["bind_coin_count"]; - $this->usermodel->add($v); + $tempdbres = $this->usermodel->add($v); + if($tempdbres === false){ + $this->model->rollback(); + die("addUserDb error"); + } } } @@ -340,7 +341,11 @@ class SpendCountSetController extends \Think\Controller $initdata["all_count"] = $initdata["inside_cash_count"]-0+$initdata["cash_count"]-0+$deposit; $initdata["count_date"] = $this->date; $initdata["create_time"] = $this->nowdata; - M("spend_month_count","tab_")->add($initdata); + $tempdbres = $this->monthmodel->add($initdata); + if($tempdbres === false){ + $this->model->rollback(); + die("setMonthCount error"); + } # code... } //获取除了内充的 @@ -348,9 +353,9 @@ class SpendCountSetController extends \Think\Controller { $tempmap = array( "count_date"=>$this->date, - "level"=>0 + "level"=>array("LT",2) ); - return M("spend_user_count","tab_")->field("sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(bind_coin_count) bind_coin_count,sum(inside_cash_count) inside_cash_count")->where($tempmap)->find(); + return $this->usermodel->field("sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(bind_coin_count) bind_coin_count,sum(inside_cash_count) inside_cash_count")->where($tempmap)->find(); } //获取平台币充值流水 protected function getBalanceDeposit()