diff --git a/Application/Base/Repository/PromoteRepository.class.php b/Application/Base/Repository/PromoteRepository.class.php index b02423985..176a1998c 100644 --- a/Application/Base/Repository/PromoteRepository.class.php +++ b/Application/Base/Repository/PromoteRepository.class.php @@ -3,8 +3,6 @@ namespace Base\Repository; class PromoteRepository { - private $model; - public function __construct() { diff --git a/Application/Base/Repository/SpendRepository.class.php b/Application/Base/Repository/SpendRepository.class.php new file mode 100644 index 000000000..5b88e0a5f --- /dev/null +++ b/Application/Base/Repository/SpendRepository.class.php @@ -0,0 +1,32 @@ + 0 ? $gameId : ['gt', 0]; + $map['promote_id'] = ['in', [1,2]]; + $map['pay_way'] = $isBan ? ['neq', '-10'] : ['neq', '-1']; + + $field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time,game_id as pay_num'; + $subTable = M('spend', 'tab_')->field($field)->where($map)->group('pay_time')->select(false); + $data = M('spend', 'tab_')->field('a.pay_time,count(DISTINCT a.pay_num) as pay_num')->table('(' . $subTable . ') as a')->group('a.pay_time')->select(); + var_dump(M()->getLastSql());die(); + return $data; + } +} \ No newline at end of file diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index b9b8751ea..ea41649c2 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -5,7 +5,7 @@ namespace Home\Controller; use OT\DataDictionary; use User\Api\PromoteApi; use Base\Repository\PromoteRepository; - +use Base\Repository\SpendRepository; /** * 前台首页控制器 * 主要获取首页聚合数据 @@ -631,6 +631,29 @@ class QueryController extends BaseController public function arpu_analysis() { $this->meta_title = "ARPU统计"; + + $time = I('time', date('Y-m-d')); + $sdkVersion = I('sdk_version', 0); + $gameId = I('game_id', 0); + $serverId = I('server_id', 0); + + $params = []; + if ($gameId > 0) { + $params['game_id'] = $gameId; + } + if ($serverId > 0) { + $params['server_id'] = $serverId; + } + if ($sdkVersion > 0) { + $params['sdk_version'] = $sdkVersion; + } + list($beginTime, $endTime) = $this->getBetweenTime($time); + $params['begin_time'] = $beginTime; + $params['end_time'] = $endTime; + + $spendRepository = new SpendRepository(); + $spendRepository->getPayGameByDay($params); + A('User', 'Event')->arpu_analysis(); } diff --git a/Application/Home/Model/SpendModel.class.php b/Application/Home/Model/SpendModel.class.php index 3f6735a35..90dab1272 100644 --- a/Application/Home/Model/SpendModel.class.php +++ b/Application/Home/Model/SpendModel.class.php @@ -112,9 +112,9 @@ class SpendModel extends Model{ $field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as pay_time,user_id as pay_num'; - $sql = $this->field($field)->where($map)->group('pay_time')->select(false); + $subTable = $this->field($field)->where($map)->group('pay_time')->buildSql(); - return $this->field('a.pay_time,count(distinct a.pay_num) as pay_num')->table('('.$sql.') as a')->group('a.pay_time')->select(); + return $this->field('a.pay_time,count(distinct a.pay_num) as pay_num')->table('(' . $subTable . ') as a')->group('a.pay_time')->select(); } diff --git a/Application/Home/View/default/Query/arpu_analysis.html b/Application/Home/View/default/Query/arpu_analysis.html index da3920b2c..9cc671852 100644 --- a/Application/Home/View/default/Query/arpu_analysis.html +++ b/Application/Home/View/default/Query/arpu_analysis.html @@ -46,6 +46,18 @@ .chakan:hover{color: #2bd8ed;} .trunk-list{position: relative;min-height: 66vh;} +.form-group { + float: left; + margin-bottom: 10px; +} +.form-group label { + line-height: 34px; + height: 34px; +} +.form-group .txt { + width: 180px; + height: 34px; +} @@ -95,43 +107,63 @@