diff --git a/Application/Admin/Controller/ConsoleController.class.php b/Application/Admin/Controller/ConsoleController.class.php
index da1080c87..28e24525b 100644
--- a/Application/Admin/Controller/ConsoleController.class.php
+++ b/Application/Admin/Controller/ConsoleController.class.php
@@ -743,4 +743,23 @@ class ConsoleController extends Think {
}
} while($hasNext);
}
+
+ /* public function shiftPromote()
+ {
+ $service = new PromoteService();
+ $fromPromoteId = 0;
+ $fromCompanyId = 0;
+ $toPromoteId = 0;
+ $toCompanyId = 0;
+ $adminId = 0;
+ $service->shiftPromote([
+ 'from_promote_id' => $fromPromoteId,
+ 'to_promote_id' => $toPromoteId,
+ 'shift_ids' => '',
+ ]);
+ M('promote', 'tab_')->where(['level1_id' => $fromPromoteId, 'company_id' => $fromCompanyId])->save([
+ 'company_id' => $toCompanyId,
+ 'admin_id' => $adminId
+ ]);
+ } */
}
diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index c3a3791be..efe4386b8 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -4147,6 +4147,7 @@ class ExportController extends Controller
$promoteId = I('promote_id', 0);
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
+ $companyId = I('company_id', 0);
$status = true;
$data = false;
@@ -4183,6 +4184,7 @@ class ExportController extends Controller
'start_time' => $start,
'end_time' => $end,
'promote_id' => I('promote_id', 0),
+ 'company_id' => I('company_id', 0),
'game_ids' => $gameIds,
]
]);
@@ -4198,6 +4200,11 @@ class ExportController extends Controller
if ($promoteId) {
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$promoteName = $promote['account'];
+ $promote['model_type'] = 'promote';
+ } elseif ($companyId) {
+ $promote = M('promote_company', 'tab_')->where(['id' => $companyId])->find();
+ $promoteName = $promote['company_name'];
+ $promote['model_type'] = 'company';
}
$data = $result['data']['records'];
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
@@ -4232,7 +4239,7 @@ class ExportController extends Controller
$xlsCell = [
['date', "日期"],
['game_name', "游戏名称"],
- ['promote_name', "推广员账号"],
+ ['promote_name', "渠道名称"],
['register_count', '新增玩家', 'time_format', '*'],
['retention_day1', '1日留存', 'time_format', '*'],
['retention_day2', '2日留存'],
diff --git a/Application/Admin/Controller/GameRebateController.class.php b/Application/Admin/Controller/GameRebateController.class.php
index 1435a425d..b66b254e5 100644
--- a/Application/Admin/Controller/GameRebateController.class.php
+++ b/Application/Admin/Controller/GameRebateController.class.php
@@ -72,6 +72,13 @@ class GameRebateController extends ThinkController
$where['_string'] .= ' and send_time<=' . strtotime(I('send_time_end') . ' 23:59:59');
}
+ if (I('create_time_start', '') != '') {
+ $where['_string'] .= ' and create_time>=' . strtotime(I('create_time_start') . ' 00:00:00');
+ }
+ if (I('create_time_end', '') != '') {
+ $where['_string'] .= ' and create_time<=' . strtotime(I('create_time_end') . ' 23:59:59');
+ }
+
$query = M('rebate_orders', 'tab_')->where($where);
$records = [];
@@ -116,6 +123,7 @@ class GameRebateController extends ThinkController
$records[$key]['review_time'] = $record['review_time'] > 0 ? date('Y-m-d H:i:s', $record['review_time']) : '--';
$records[$key]['send_status_text'] = $sendStatusList[$record['send_status']];
$records[$key]['send_time'] = $record['send_time'] > 0 ? date('Y-m-d H:i:s', $record['send_time']) : '--';
+ $records[$key]['create_time'] = $record['create_time'] > 0 ? date('Y-m-d H:i:s', $record['create_time']) : '--';
$records[$key]['award_date_range'] = is_null($record['award_started_at']) || is_null($record['award_ended_at'])
? '' : $record['award_started_at'] . ' ~ ' . $record['award_ended_at'];
$records[$key]['gift_content'] = implode($newLine, explode('|', $record['gift_content']));
@@ -128,6 +136,7 @@ class GameRebateController extends ThinkController
'role_id' => '角色ID',
'role_name' => '角色名称',
'gift_content' => '奖励内容',
+ 'create_time' => '订单生成时间',
'review_status_text' => '审核状态',
'review_time' => '审核时间',
'send_status_text' => '发放状态',
diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php
index bdde203d9..d45135ead 100644
--- a/Application/Admin/Controller/StatController.class.php
+++ b/Application/Admin/Controller/StatController.class.php
@@ -151,6 +151,7 @@ class StatController extends ThinkController
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
$promoteId = I('promote_id', 0);
+ $companyId = I('company_id', 0);
$orderType = 'asc';
$orderColumn = 'date';
@@ -196,6 +197,7 @@ class StatController extends ThinkController
'start_time' => $start,
'end_time' => $end,
'promote_id' => I('promote_id', 0),
+ 'company_id' => I('company_id', 0),
'game_ids' => $gameIds,
]
]);
@@ -213,6 +215,11 @@ class StatController extends ThinkController
if ($promoteId) {
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$promoteName = $promote['account'];
+ $promote['model_type'] = 'promote';
+ } elseif ($companyId) {
+ $promote = M('promote_company', 'tab_')->where(['id' => $companyId])->find();
+ $promoteName = $promote['company_name'];
+ $promote['model_type'] = 'company';
}
foreach ($data as $key => $item) {
$item['promote_name'] = $promoteName;
@@ -246,7 +253,15 @@ class StatController extends ThinkController
}
$baseGames = M('base_game', 'tab_')->select();
-
+ $companies = M('promote_company', 'tab_')->field(['id', 'company_name'])->select();
+ $promoteMap = ['_string' => '1=1'];
+ if ($companyId) {
+ $promoteMap['company_id'] = $companyId;
+ }
+ $promotes = M('promote', 'tab_')->field(['id', 'account'])->where($promoteMap)->select();
+ $this->assign('promoteName', $promoteName);
+ $this->assign('promotes', $promotes);
+ $this->assign('companies', $companies);
$this->assign('baseGames', $baseGames);
$this->checkListOrCountAuthRestMap($map,[]);
@@ -712,6 +727,7 @@ AND UNIX_TIMESTAMP(
$end = I('end', date('Y-m-d'));
$baseGameIds = I('game_ids', '');
$promoteId = I('promote_id', 0);
+ $companyId = I('company_id', 0);
$dataOrder = I('data_order', '');
$deviceType = I('device_type', '');
$containBindCoins = I('contain_bind_coins', 0);
@@ -729,6 +745,8 @@ AND UNIX_TIMESTAMP(
$promote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $promoteId])->find();
$promoteIds = M('promote', 'tab_')->where(['chain' => ['like', $promote['chain'] . $promote['id'] . '/%']])->getField('id', true);
$promoteIds[] = $promote['id'];
+ } elseif ($companyId > 0) {
+ $promoteIds = M('promote', 'tab_')->where(['company_id' => $companyId])->getField('id', true);
}
$startTime = strtotime($start . ' 00:00:00');
@@ -859,6 +877,16 @@ AND UNIX_TIMESTAMP(
$this->checkListOrCountAuthRestMap($map,[]);
$this->meta_title = 'ARPU统计';
+
+ $companies = M('promote_company', 'tab_')->field(['id', 'company_name'])->select();
+ $promoteMap = ['_string' => '1=1'];
+ if ($companyId) {
+ $promoteMap['company_id'] = $companyId;
+ }
+ $promotes = M('promote', 'tab_')->field(['id', 'account'])->where($promoteMap)->select();
+
+ $this->assign('promotes', $promotes);
+ $this->assign('companies', $companies);
$this->assign('showPromote', session('user_auth')['show_promote']);
$this->assign('baseGames', $baseGames);
$this->assign('records', $rows);
@@ -2057,6 +2085,14 @@ AND UNIX_TIMESTAMP(
}
-
-
+ public function getPromotes()
+ {
+ $companyId = I('company_id', 0);
+ $companyMap = ['_string' => '1=1'];
+ if ($companyId > 0) {
+ $companyMap['company_id'] = $companyId;
+ }
+ $promotes = M('promote', 'tab_')->where($companyMap)->field(['id', 'account'])->select();
+ return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['promotes' => $promotes]]);
+ }
}
diff --git a/Application/Admin/View/GameRebate/records.html b/Application/Admin/View/GameRebate/records.html
index acaa39945..b24ca8bc2 100644
--- a/Application/Admin/View/GameRebate/records.html
+++ b/Application/Admin/View/GameRebate/records.html
@@ -104,6 +104,16 @@
+
@@ -184,6 +194,7 @@
达到档位金额 |
奖励内容 |
+ 订单生成时间 |
发放状态 |
发放时间 |
审核状态 |
@@ -222,6 +233,7 @@
{$data.gift_content} |
+ {$data.create_time} |
{$data.send_status_text}
|
diff --git a/Application/Admin/View/Stat/userarpu.html b/Application/Admin/View/Stat/userarpu.html
index 63901c564..76540a7a9 100644
--- a/Application/Admin/View/Stat/userarpu.html
+++ b/Application/Admin/View/Stat/userarpu.html
@@ -117,13 +117,21 @@
+
+
+
@@ -183,6 +191,7 @@
'end'=>$_GET['end'],
'game_ids'=>$_GET['game_ids'],
'promote_id'=>$_GET['promote_id'],
+ 'company_id'=>$_GET['company_id'],
'device_type'=>$_GET['device_type'],
'export'=>1,
),false)}">导出
@@ -199,6 +208,7 @@ Think.setValue('start',"{$Think.get.start|default=''}");
Think.setValue('end',"{$Think.get.end|default=''}");
Think.setValue('promote_id',{$Think.get.promote_id|default='""'});
Think.setValue('game_ids',{$Think.get.game_ids|default='""'});
+Think.setValue('company_id',{$Think.get.company_id|default='""'});
Think.setValue('device_type',{$Think.get.device_type|default='""'});
Think.setValue('row',{$Think.get.row|default=10});
$(".select_gallery").select2();
@@ -294,6 +304,27 @@ $(function(){
autoclose:1,
});
+ $("#company_id").change(function () {
+ $.ajax({
+ url: "{:U('getPromotes')}",
+ type: "post",
+ data: { company_id: $("#company_id").val() },
+ dataType: 'json',
+ success: function (result ) {
+ if (result.status == 1) {
+ var promotes = result.data.promotes
+ var str = ""
+ for (var i in promotes){
+ str += ""
+ }
+ $("#promote_id").empty()
+ $("#promote_id").append(str)
+ $("#promote_id").select2()
+ }
+ }
+ })
+ })
+
$('#time-end').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
diff --git a/Application/Admin/View/Stat/userretention.html b/Application/Admin/View/Stat/userretention.html
index 39a6e27d1..65999e54e 100644
--- a/Application/Admin/View/Stat/userretention.html
+++ b/Application/Admin/View/Stat/userretention.html
@@ -59,13 +59,21 @@
+
+
+
@@ -126,7 +134,7 @@
{$vo.date} |
{$vo.game_name} |
- {$vo.promote_name} |
+ {$promoteName} |
{$vo.register_count} |
0):?>
@@ -169,6 +177,7 @@
'end' =>I('end',date('Y-m-d',time())),
'game_id'=>I('game_id'),
'promote_id'=>I('promote_id'),
+ 'company_id'=>I('company_id'),
'device_type'=>I('device_type'),
'xlsname'=>'数据分析_留存率分析',)
,false)}">导出
@@ -354,6 +363,27 @@ $(function(){
$(this).closest('.drop-down').find('#i_list_idh').val($(this).attr('value'));
})
});
+
+ $("#company_id").change(function () {
+ $.ajax({
+ url: "{:U('getPromotes')}",
+ type: "post",
+ data: { company_id: $("#company_id").val() },
+ dataType: 'json',
+ success: function (result ) {
+ if (result.status == 1) {
+ var promotes = result.data.promotes
+ var str = ""
+ for (var i in promotes){
+ str += ""
+ }
+ $("#promote_id").empty()
+ $("#promote_id").append(str)
+ $("#promote_id").select2()
+ }
+ }
+ })
+ })
})
diff --git a/Application/Base/Repository/GameRepository.class.php b/Application/Base/Repository/GameRepository.class.php
index 2ae94a494..99889c391 100644
--- a/Application/Base/Repository/GameRepository.class.php
+++ b/Application/Base/Repository/GameRepository.class.php
@@ -98,7 +98,11 @@ class GameRepository
if ($promote) {
$promoteService = new PromoteService();
- $sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
+ if ($promote['model_type'] == 'company') {
+ $sqlStr .= ' and promote_id in (' . $promoteService->subInCompanySql($promote) . ')';
+ } else {
+ $sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
+ }
}
return M('user_play', 'tab_')->where([
@@ -126,7 +130,11 @@ class GameRepository
$sqlStr = 'exists (' . $subSql . ')';
if ($promote) {
$promoteService = new PromoteService();
- $sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
+ if ($promote['model_type'] == 'company') {
+ $sqlStr .= ' and promote_id in (' . $promoteService->subInCompanySql($promote) . ')';
+ } else {
+ $sqlStr .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
+ }
}
return M('user_play', 'tab_')->where([
diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php
index cf9eb1c73..9d2c63173 100644
--- a/Application/Base/Service/PromoteService.class.php
+++ b/Application/Base/Service/PromoteService.class.php
@@ -212,11 +212,8 @@ class PromoteService {
{
$model = new Model();
$model->startTrans();
-
- $coinRecordService = new PromoteCoinRecordService();
- $promoteCoinService = new PromoteCoinService();
- $shiftIds = json_decode($task['shift_ids'], true) ?? [];
+ $shiftIds = $task['shift_ids'] ? (json_decode($task['shift_ids'], true) ?? []) : [];
$toPromote = M('promote', 'tab_')->where(['id' => $task['to_promote_id']])->find();
$fromPromote = M('promote', 'tab_')->where(['id' => $task['from_promote_id']])->find();
@@ -983,6 +980,11 @@ class PromoteService {
return M('promote', 'tab_')->field(['id'])->where($conditions)->select(false);
}
+ public function subInCompanySql($companyId, $withSelf = true)
+ {
+ return M('promote', 'tab_')->field(['id'])->where(['company_id' => $companyId])->select(false);
+ }
+
public function getLevelName($level)
{
return self::$levels[$level] ?? '未知';
diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php
index dc48af7c0..54bb5b682 100644
--- a/Application/Home/Controller/BaseController.class.php
+++ b/Application/Home/Controller/BaseController.class.php
@@ -13,7 +13,7 @@ class BaseController extends HomeController
protected $promotePermissions;
protected $loginPromote = null;
protected $canViewUserRecharge = true;
-
+ protected $canViewMend = true;
protected $permControlUrls = [
'Home/Query/recharge',
@@ -63,6 +63,11 @@ class BaseController extends HomeController
$this->assign("parent_id", $loginer['parent_id']);
$this->assign("grand_id", $loginer['grand_id']);
$this->assign('canViewUserRecharge', $this->canViewUserRecharge);
+
+ if ($loginer['level1_id'] == 8038 && $loginer['level'] > 1) {
+ $this->canViewMend = false;
+ }
+ $this->assign('canViewMend', $this->canViewMend);
$result = M('site_apply', 'tab_')->where("promote_id=$pid")->getField('status');
if ($result['status'] == 1) {
diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php
index 046040c6b..8b9d60fe0 100644
--- a/Application/Home/Controller/DownloadController.class.php
+++ b/Application/Home/Controller/DownloadController.class.php
@@ -4436,7 +4436,7 @@ public function iosDetailExcelInfo($id,$map) {
$now = date('Y-m-d');
$now = strtotime($now);
$nowTimeEnd = $now + 3600 * 24 - 1;
- $spendMap['_string'] = 'today.user_id = uc.user_id and today.game_id = uc.game_id and today.server_id = uc.server_id and today.game_player_id = uc.game_player_id'; // and today.promote_id = uc.promote_id';
+ $spendMap['_string'] = 'today.user_id = uc.user_id and today.game_id = uc.game_id and today.server_id = uc.server_id and today.game_player_id = uc.game_player_id and today.promote_id = uc.promote_id';
$spendMap['today.pay_status'] = 1;
$spendMap['today.pay_time'] = ['between', [$now, $nowTimeEnd]];
@@ -4461,7 +4461,7 @@ public function iosDetailExcelInfo($id,$map) {
// ->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->join('join tab_user as u on u.id = uc.user_id')
->where($map)
- ->group('uc.game_player_id,uc.server_id,uc.game_id,uc.user_id')
+ ->group('uc.game_player_id,uc.server_id,uc.game_id,uc.user_id,uc.promote_id')
->buildSql();
$roles = M()->alias('record')
->table($subQuery)
diff --git a/Application/Home/Controller/MendController.class.php b/Application/Home/Controller/MendController.class.php
index d03fdcecd..074793b6e 100644
--- a/Application/Home/Controller/MendController.class.php
+++ b/Application/Home/Controller/MendController.class.php
@@ -18,6 +18,10 @@ class MendController extends BaseController
public function index()
{
+ if (!$this->canViewMend) {
+ return $this->error('没有权限');
+ }
+
$page = intval(I('p', 1));
$row = intval(I('row', 10));
$params = I('get.');
@@ -79,6 +83,10 @@ class MendController extends BaseController
public function add()
{
+ if (!$this->canViewMend) {
+ return $this->error('没有权限');
+ }
+
$userId = I('user_id', 0);
$user = M('user', 'tab_')->where(['id' => $userId])->find();
if (!$user) {
diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php
index 43bac5a69..1832365d8 100644
--- a/Application/Home/Controller/QueryController.class.php
+++ b/Application/Home/Controller/QueryController.class.php
@@ -1994,7 +1994,7 @@ class QueryController extends BaseController
$fieldS = "sum(s.pay_amount) recharge_cost, count(*) recharge_count, s.user_id, s.user_account, s.promote_id, s.promote_account, s.game_name, s.sdk_version, s.server_name, SUBSTRING_INDEX(GROUP_CONCAT(s.game_player_name order by s.id desc), ',', 1) as game_player_name";
$fieldUser = 'u.register_time, u.login_time';
- $spendMap['_string'] = 'today.user_id = s.user_id and today.game_id = s.game_id and today.server_id = s.server_id and today.game_player_id = s.game_player_id'; // and today.promote_id = s.promote_id';
+ $spendMap['_string'] = 'today.user_id = s.user_id and today.game_id = s.game_id and today.server_id = s.server_id and today.game_player_id = s.game_player_id and today.promote_id = s.promote_id';
$spendMap['today.pay_status'] = 1;
$spendMap['today.pay_time'] = ['between', [$nowTime, $nowTimeEnd]];
@@ -2017,7 +2017,7 @@ class QueryController extends BaseController
->field($field)
->join('join tab_user as u on u.id = s.user_id')
->where($map)
- ->group('s.game_player_id, s.server_id, s.game_id, s.user_id')
+ ->group('s.game_player_id, s.server_id, s.game_id, s.user_id, s.promote_id')
->having($having)
->buildSql();
$query = M()->alias('record')
diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html
index f76fba722..c68629efa 100644
--- a/Application/Home/View/default/Public/promote_base.html
+++ b/Application/Home/View/default/Public/promote_base.html
@@ -89,7 +89,9 @@
IOS下载数统计
用户留存率
游戏分区数据汇总
+
补链记录
+