|
|
|
@ -29,9 +29,6 @@ class SpendCountSetController extends \Think\Controller
|
|
|
|
|
*/
|
|
|
|
|
public function setMonthSpendCount()
|
|
|
|
|
{
|
|
|
|
|
set_time_limit(0);
|
|
|
|
|
$t1 = microtime(true);
|
|
|
|
|
|
|
|
|
|
$month = I("count_date");
|
|
|
|
|
if(empty($month)) die("参数错误");
|
|
|
|
|
|
|
|
|
@ -39,25 +36,8 @@ class SpendCountSetController extends \Think\Controller
|
|
|
|
|
$tarry = explode('-',$month);
|
|
|
|
|
$this->beginThismonth=mktime(0,0,0,$tarry[1],1,$tarry[0]);
|
|
|
|
|
$this->endThismonth=mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1;
|
|
|
|
|
//判断是否已经聚合
|
|
|
|
|
$countRes = M("spend_count","tab_")->field("count(*) date_count")->where("count_date = '{$this->date}'")->find()['date_count'];
|
|
|
|
|
$countUserRes = M("spend_user_count","tab_")->field("count(*) date_count")->where("count_date = '{$this->date}'")->find()['date_count'];
|
|
|
|
|
if($countRes > 0 || $countUserRes >0){
|
|
|
|
|
die("error:Repeated statistics");
|
|
|
|
|
}
|
|
|
|
|
$this->model->startTrans();
|
|
|
|
|
$this->usermodel->startTrans();
|
|
|
|
|
$this->continue =true;
|
|
|
|
|
//执行游戏表统计
|
|
|
|
|
$this->setGameCount();
|
|
|
|
|
//执行用户表统计
|
|
|
|
|
$this->setUserCount();
|
|
|
|
|
//执行
|
|
|
|
|
$this->model->commit();
|
|
|
|
|
$this->usermodel->commit();
|
|
|
|
|
|
|
|
|
|
$t2 = microtime(true);
|
|
|
|
|
die("success runtime:".round($t2-$t1,3).'s');
|
|
|
|
|
|
|
|
|
|
$this->setSpendCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|