diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php
index c17d531f2..654a0b42d 100644
--- a/Application/Admin/Controller/PromoteController.class.php
+++ b/Application/Admin/Controller/PromoteController.class.php
@@ -97,7 +97,7 @@ unset($_REQUEST['parent_id']);
parent::order_lists(self::model_name,$p,$map);
}
- private function siteApplyList($request,$p){
+ private function siteApplyList($p){
if(isset($_REQUEST['promote_id'])){
$map['promote_id']=$_REQUEST['promote_id'];
unset($_REQUEST['promote_id']);
diff --git a/Application/Base/Repository/PromoteRepository.class.php b/Application/Base/Repository/PromoteRepository.class.php
index 9f2f55f50..b21ee2073 100644
--- a/Application/Base/Repository/PromoteRepository.class.php
+++ b/Application/Base/Repository/PromoteRepository.class.php
@@ -8,7 +8,8 @@ class PromoteRepository {
}
- private function assembleZero($allKeys, $records, $zeroValue) {
+ private function assembleZero($allKeys, $records, $zeroValue)
+ {
$noExistKeys = array_diff($allKeys, array_keys($records));
foreach ($noExistKeys as $key) {
$records[$key] = $zeroValue;
diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php
index e07dba79c..179249605 100644
--- a/Application/Base/Service/PromoteService.class.php
+++ b/Application/Base/Service/PromoteService.class.php
@@ -762,7 +762,7 @@ class PromoteService {
public function getLevelName($level)
{
- return self::levels[$level] ?? '未知';
+ return self::$levels[$level] ?? '未知';
}
public function addPromote($params, $parent = null)
diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php
index 8296697fe..67a5c6191 100644
--- a/Application/Home/Controller/FinanceController.class.php
+++ b/Application/Home/Controller/FinanceController.class.php
@@ -13,5 +13,75 @@ use Base\Repository\UserRepository;
*/
class FinanceController extends BaseController
{
-
+ public function settlementDtl()
+ {
+ $model = M('spend', 'tab_');
+ $page = intval(I('get.p', 1));
+ $page = $page ? $page : 1; //默认显示第一页数据arraypage
+ $row = intval(I('get.row', 10));
+ $payOrderNumber = I('pay_order_number', '');
+ $nowTime = date('Y-m-d');
+ $initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
+ $initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
+ $initEndTime = $nowTime;
+ $initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
+ $begTime = strtotime($initBegTime);
+ $endTime = strtotime($initEndTime);
+ $loginPromote = $this->getLoginPromote();
+
+ $parameter['p'] = $page;
+ $parameter['row'] = $row;
+ $parameter['pay_order_number'] = $payOrderNumber;
+ $parameter['begtime'] = $initBegTime;
+ $parameter['endtime'] = $initEndTime;
+
+ $map['chain'] = ['like', $loginPromote['chain'] . $loginPromote['id'] . '/%'];
+ $ids = M('promote', 'tab_')->where($map)->getField('id', true);
+ $ids[] = $loginPromote['id'];
+ $ids = implode(',', $ids);
+// var_dump($ids);
+// die;
+
+ $map = [];
+ $map['promote_id'] = ['in', $ids];
+ if (!empty($payOrderNumber)) {
+ $map['pay_order_number'] = $payOrderNumber;
+ }
+ if (!empty($begTime) && empty($endTime)) {
+ $map['pay_time'] = ['egt', $begTime];
+ } elseif (empty($begTime) && !empty($endTime)) {
+ $map['pay_time'] = ['elt', $endTime + 86399];
+ } elseif (!empty($begTime) && !empty($endTime)) {
+ $map['pay_time'] = ['between', [$begTime, $endTime + 86399]];
+ }
+
+ $data = $model->field('pay_order_number,game_name,user_account,promote_account,pay_amount,pay_way,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,convert(pay_amount*if(selle_ratio >= 0,selle_ratio,0),decimal(10,2)) as income,pay_time,selle_status')
+ ->where($map)
+ ->order('id desc')
+ ->page($page, $row)
+ ->select();
+ $count = $model->where($map)->count();
+
+ foreach ($data as &$list) {
+ switch ($list['selle_status']) {
+ case 0:
+ $list['selle_status'] = '未提现';
+ break;
+ default:
+ $list['selle_status'] = '';
+ break;
+ }
+ $list['pay_time'] = date('Y-m-d H:i:s', $list['pay_time']);
+ }
+
+ $page = set_pagination($count, $row, $parameter);
+
+ $this->assign('listData', $data);
+ $this->assign('count', $count);
+ $this->assign('initBegTime', $initBegTime);
+ $this->assign('initEndTime', $initEndTime);
+ $this->assign('_page', $page);
+ $this->assign('meta_title', '结算明细');
+ $this->display();
+ }
}
\ No newline at end of file
diff --git a/Application/Home/Controller/PromoteCoinController.class.php b/Application/Home/Controller/PromoteCoinController.class.php
index 8b0b048e3..e81487c71 100644
--- a/Application/Home/Controller/PromoteCoinController.class.php
+++ b/Application/Home/Controller/PromoteCoinController.class.php
@@ -588,13 +588,9 @@ class PromoteCoinController extends BaseController
if ($promoteCoin['source_type'] == 2) {
return '玩家转账';
} else {
- if ($promote['parent_id'] == 1) {
- return '会长转账';
- } elseif ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) {
- return '组长转账';
- } elseif ($promote['grand_id'] > 0) {
- return '推广员转账';
- }
+ $promoteService = new PromoteService();
+ $levelName = $promoteService->getLevelName($promote['level']);
+ return $levelName . '转账';
}
}
@@ -760,9 +756,10 @@ class PromoteCoinController extends BaseController
{
$account = I('account', '');
$mobile = I('mobile', '');
- $id = session('promote_auth.pid');
- $promoteIds = D('Promote')->field('id')->where('parent_id=' . $id . ' or grand_id=' . $id)->select();
- $promoteIds = array_merge(array_column($promoteIds, 'id'), [$id]);
+ $promote = $this->getLoginPromote();
+ $map = ['chain' => ['like', $promote['chain'] . $promote['id'] . '/%']];
+ $promoteIds = D('Promote')->field('id')->where($map)->getField('id', true);
+ $promoteIds[] = $id;
$rows = D('UserPlay')->field(['id', 'user_id'])->where(['promote_id' => ['in', $promoteIds]])->select();
$map = [];
diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php
index 07da8188e..3d851aa28 100644
--- a/Application/Home/Controller/QueryController.class.php
+++ b/Application/Home/Controller/QueryController.class.php
@@ -7,6 +7,7 @@ use User\Api\PromoteApi;
use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository;
use Base\Repository\UserRepository;
+use Base\Service\PromoteService;
/**
* 前台首页控制器
@@ -705,21 +706,13 @@ class QueryController extends BaseController
$sdkVersion = I('sdk_version', 0);
$gameId = I('game_id', 0);
$serverId = I('server_id', 0);
- $promoteId = I('promote_id', 0);
- $subPromoteId = I('sub_promote_id', 0);
- $promote = $this->getLoginPromote();
- $searchPromote = $promote;
- if ($promoteId > 0) {
- $searchPromote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
- }
- if ($subPromoteId > 0) {
- $searchPromote = M('promote', 'tab_')->where(['id' => $subPromoteId])->find();
- }
- $map = [
+ $levelPromote = $this->getLevelPromote();
+ $searchPromote = $this->getQueryPromote($levelPromote);
+
+ $map[] = [
'_logic' => 'or',
'id' => $searchPromote['id'],
- 'parent_id' => $searchPromote['id'],
- 'grand_id' => $searchPromote['id'],
+ 'chain' => ['like', $searchPromote['chain'] . $searchPromote['id'] . '/%']
];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
@@ -795,11 +788,10 @@ class QueryController extends BaseController
public function gameArpu()
{
$promote = $this->getLoginPromote();
- $map = [
+ $map[] = [
'_logic' => 'or',
'id' => $promote['id'],
- 'parent_id' => $promote['id'],
- 'grand_id' => $promote['id'],
+ 'chain' => ['like', $promote['chain'] . $promote['id'] . '/%']
];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
@@ -1649,42 +1641,6 @@ class QueryController extends BaseController
$this->display('view_role');
}
- public function users()
- {
- $promote = $this->getLoginPromote();
- $promoteId = $promote['id'];
- $map = [
- '_logic' => 'or',
- 'id' => $promoteId,
- 'parent_id' => $promoteId,
- 'grand_id' => $promoteId,
- ];
- $ids = M('promote', 'tab_')->where($map)->getField('id', true);
-
- $promotes = [];
- $groupPromotes = [];
- if ($promote['parent_id'] == 0) {
- $groupPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promoteId])->select();
- $promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['grand_id' => $promoteId])->select();
- }
- if ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) {
- $promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promoteId])->select();
- }
-
- $fields = [
- 'id', 'account', 'promote_account', 'promote_id', 'device_number', 'register_time', 'register_ip', 'login_time', 'login_ip', 'device_type'
- ];
- $query = M('user', 'tab_')->field($fields)->where(['promote_id' => ['in', $ids]]);
- list($records, $pagination, $count) = $this->paginate($query);
-
- $this->assign('promotes', $promotes);
- $this->assign('groupPromotes', $groupPromotes);
- $this->assign('records', $records);
- $this->assign('pagination', $pagination);
- $this->assign('count', $count);
- $this->display();
- }
-
private function getLevelPromote()
{
$levelPromote = [];
@@ -1933,17 +1889,6 @@ class QueryController extends BaseController
return $promotes;
}
- private function getNormalPromotes($promote)
- {
- $promotes = [];
- if ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) {
- $promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promote['id']])->select();
- } elseif ($promote['parent_id'] == 0) {
- $promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['grand_id' => $promote['id']])->select();
- }
- return $promotes;
- }
-
public function getGameServers()
{
$gameId = I('game_id', 0);
@@ -2018,29 +1963,36 @@ class QueryController extends BaseController
$parentId = I('parent_id', 0);
$promoteId = I('promote_id', 0);
$status = I('status', 0);
+ $searchLevel = 0;
+ $searchLevelName = '';
+ $currentDisplay = '';
+ $prevParentId = 0;
+ $promoteService = new PromoteService();
$loginPromote = $this->getLoginPromote();
- $promote = null;
- $searchPromoteType = 0;
+ $parent = null;
if ($parentId > 0) {
- $promote = M('promote', 'tab_')->where(['id' => $parentId])->find();
- $searchPromoteType = 2;
+ $parent = M('promote', 'tab_')->where(['id' => $parentId])->find();
+ $currentDisplay = $promoteService->getLevelName($parent['level']) . '推广';
+ $prevParentId = $parent['parent_id'] == $loginPromote['parent_id'] ? 0 : $parent['parent_id'];
} else {
- $promote = $loginPromote;
- $searchPromoteType = 1;
+ $parent = $loginPromote;
+ $currentDisplay = '自己';
}
+ $searchLevel = $parent['level'] + 1;
+ $searchLevelName = $promoteService->getLevelName($searchLevel);
- $games = $this->getGamesByPromote($promote);
+ $games = $this->getGamesByPromote($parent);
- $subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $promote['id']])->select();
+ $subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where(['parent_id' => $parent['id']])->select();
- $map = ['parent_id' => $promote['id']];
+ $map = ['parent_id' => $parent['id']];
if ($promoteId > 0) {
$map['id'] = $promoteId;
}
- $query = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where($map);
+ $query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level'])->where($map);
list($promotes, $pagination, $count) = $this->paginate($query);
$ids = array_column($promotes, 'id');
@@ -2099,9 +2051,10 @@ class QueryController extends BaseController
$selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$promote['id']], $selfParams);
$records[] = [
- 'id' => $promote['id'],
- 'account' => $promote['account'],
- 'real_name' => $promote['real_name'],
+ 'id' => $parent['id'],
+ 'account' => $parent['account'],
+ 'real_name' => $parent['real_name'],
+ 'level' => $parent['level'],
'create_role_count' => $selfCreateRoleCountList[$promote['id']],
'create_role_user_count' => $selfCreateRoleUserCountList[$promote['id']],
'new_create_role_user_count' => $selfNewCreateRoleUserCountList[$promote['id']],
@@ -2114,16 +2067,16 @@ class QueryController extends BaseController
'recharge_by_ban_coin' => $selfRechargeAmountList[$promote['id']]['ban_coin'],
'recharge_by_coin' => $selfRechargeAmountList[$promote['id']]['coin'],
'recharge_by_cash' => $selfRechargeAmountList[$promote['id']]['cash'],
- 'search_promote_type' => $searchPromoteType,
+ 'current_display' => $currentDisplay,
];
}
-
foreach ($promotes as $promote) {
$id = $promote['id'];
$records[] = [
'id' => $id,
'account' => $promote['account'],
'real_name' => $promote['real_name'],
+ 'level' => $promote['level'],
'create_role_count' => $createRoleCountList[$id],
'create_role_user_count' => $createRoleUserCountList[$id],
'new_create_role_user_count' => $newCreateRoleUserCountList[$id],
@@ -2136,23 +2089,14 @@ class QueryController extends BaseController
'recharge_by_ban_coin' => $rechargeAmountList[$id]['ban_coin'],
'recharge_by_coin' => $rechargeAmountList[$id]['coin'],
'recharge_by_cash' => $rechargeAmountList[$id]['cash'],
- 'search_promote_type' => 0,
+ 'current_display' => '',
];
}
- $level = 0;
- if ($parentId > 0) {
- $level = 2;
- } elseif ($loginPromote['parent_id'] == 0) {
- $level = 1;
- } elseif ($loginPromote['parent_id'] > 0 && $loginPromote['grand_id'] == 0) {
- $level = 2;
- } elseif ($loginPromote['parent_id'] > 0 && $loginPromote['grand_id'] > 0) {
- $level = 3;
- }
-
+ $this->assign('prevParentId', $prevParentId);
+ $this->assign('searchLevelName', $searchLevelName);
$this->assign('games', $games);
- $this->assign('level', $level);
+ $this->assign('parent', $parent);
$this->assign('subPromotes', $subPromotes);
$this->assign('records', $records);
$this->assign('pagination', $pagination);
diff --git a/Application/Home/View/default/Finance/settlementDtl.html b/Application/Home/View/default/Finance/settlementDtl.html
new file mode 100644
index 000000000..b202784fe
--- /dev/null
+++ b/Application/Home/View/default/Finance/settlementDtl.html
@@ -0,0 +1,227 @@
+ 暂无数据
+
+
+
+ 游戏订单号
+ 游戏
+ 玩家账号
+ 推广员账号
+ 订单总额
+ 直充
+ 内充
+ 分成比例(直充|内充)
+ 收益
+ 充值时间
+ 订单状态
+
+
+
+
+
+
+
+ {$vo.pay_order_number}
+ {$vo.game_name}
+ {$vo.user_account}
+ {$vo.promote_account}
+ {$vo.pay_amount}
+ 0
+ {$vo.pay_amount}
+ {$vo.pay_amount}
+ 0
+ {$vo.selle_ratio}%|{$vo.selle_ratio}%
+ {$vo.income}
+ {$vo.pay_time}
+ {$vo.selle_status}
+