From fa2efa04319ea9e9b2708ed622497ac5ac7c9186 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 12 Nov 2019 11:03:04 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0->?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E7=AE=A1=E7=90=86->=E6=88=91=E7=9A=84?= =?UTF-8?q?=E6=B8=B8=E6=88=8F--=E6=A3=80=E7=B4=A2=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/View/default/Apply/my_game.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index 4784068f3..de9480ad5 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -7,6 +7,11 @@ + From db249a776e5db694e7eb119ccdcaab40d8bab9f2 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 12 Nov 2019 15:21:39 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0->?= =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E7=AE=A1=E7=90=86->=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E8=AE=B0=E5=BD=95->=E6=8F=90=E7=8E=B0=E6=98=8E=E7=BB=86--?= =?UTF-8?q?=E6=A3=80=E7=B4=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/View/default/Finance/withdrawDtl.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Application/Home/View/default/Finance/withdrawDtl.html b/Application/Home/View/default/Finance/withdrawDtl.html index 52af935fe..334ecd7e0 100644 --- a/Application/Home/View/default/Finance/withdrawDtl.html +++ b/Application/Home/View/default/Finance/withdrawDtl.html @@ -96,9 +96,8 @@ diff --git a/Application/Home/View/default/Query/recharge.html b/Application/Home/View/default/Query/recharge.html index 9b394fa45..aa278dd2e 100644 --- a/Application/Home/View/default/Query/recharge.html +++ b/Application/Home/View/default/Query/recharge.html @@ -118,11 +118,11 @@
- +
- +
diff --git a/Application/Home/View/default/Query/register.html b/Application/Home/View/default/Query/register.html index 9e0e408ff..29899994a 100644 --- a/Application/Home/View/default/Query/register.html +++ b/Application/Home/View/default/Query/register.html @@ -64,11 +64,11 @@
- +
- +
From 44954031bf520a9759ec45a3d51116c506bdeb2b Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Tue, 12 Nov 2019 17:45:40 +0800 Subject: [PATCH 5/7] upt --- Application/Admin/Controller/MemberController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index fe33c0cf9..887d3f4f3 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -64,7 +64,7 @@ class MemberController extends ThinkController if (isset($_REQUEST['user_id'])) { empty($hav) || $hav .= ' AND '; - $hav .= "tab_user.id = {$_REQUEST['user_id']}"; + $hav .= "tab_user.id = '{$_REQUEST['user_id']}'"; $maps['tab_user.id'] = $_REQUEST['user_id']; unset($_REQUEST['user_id']); } From 1a0175e583db3732f3641b18290972f445e900aa Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 12 Nov 2019 18:03:18 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Service/AgentService.class.php | 23 + .../PromoteCoinRecordService.class.php | 141 ++++- .../PromoteCoinTransferLogService.class.php | 55 ++ .../Base/Service/PromoteService.class.php | 176 +++---- .../Controller/Notify3Controller.class.php | 15 +- .../PromoteCoinController.class.php | 487 +++++++----------- .../View/default/PromoteCoin/coinDetail.html | 83 +++ .../View/default/PromoteCoin/coinDetails.html | 281 ++++++++++ .../View/default/PromoteCoin/coinRecord.html | 2 +- .../Home/View/default/PromoteCoin/detail.html | 6 +- .../Home/View/default/PromoteCoin/myCoin.html | 2 +- .../Home/View/default/PromoteCoin/shift.html | 5 +- .../default/PromoteCoin/transferLogs.html | 159 ++++++ .../View/default/Public/promote_base.html | 2 +- Data/update.sql | 23 +- 15 files changed, 1041 insertions(+), 419 deletions(-) create mode 100644 Application/Base/Service/AgentService.class.php create mode 100644 Application/Base/Service/PromoteCoinTransferLogService.class.php create mode 100644 Application/Home/View/default/PromoteCoin/coinDetail.html create mode 100644 Application/Home/View/default/PromoteCoin/coinDetails.html create mode 100644 Application/Home/View/default/PromoteCoin/transferLogs.html diff --git a/Application/Base/Service/AgentService.class.php b/Application/Base/Service/AgentService.class.php new file mode 100644 index 000000000..2269fe896 --- /dev/null +++ b/Application/Base/Service/AgentService.class.php @@ -0,0 +1,23 @@ +create($params); + if(!$data){ + return $this->getError(); + } + $status = M('agent', 'tab_')->add($data); + if ($status) { + $id = M()->getLastInsID(); + return $id; + } else { + return 0; + } + } + +} \ No newline at end of file diff --git a/Application/Base/Service/PromoteCoinRecordService.class.php b/Application/Base/Service/PromoteCoinRecordService.class.php index 764a1abea..c8b896354 100644 --- a/Application/Base/Service/PromoteCoinRecordService.class.php +++ b/Application/Base/Service/PromoteCoinRecordService.class.php @@ -6,13 +6,67 @@ use Base\Model\ApplyModel; class PromoteCoinRecordService { - private $model; + public static $types = [ + 1 => '收入', + 2 => '支出', + ]; + + public static $targetTypes = [ + 1 => '推广员', + 2 => '玩家', + 3 => '管理员', + ]; + + public static $subTypes = [ + 1 => '平台充值', + 2 => '线下转账', + 3 => '推广转账', + 4 => '玩家转账', + 5 => '后台扣除', + 6 => '迁移回收', + 7 => '迁移扣除', + 8 => '后台发放', + ]; public function __construct() { } + public function getTypeText($type) + { + return self::$types[$type] ?? '未知'; + } + + public function getSubTypeText($subType) + { + return self::$subTypes[$subType] ?? '未知'; + } + + public function getTargetTypeText($targetType, $targetLevel) + { + if ($targetType == 1) { + return PromoteService::$levels[$targetLevel] ?? '未知'; + } else { + return self::$targetTypes[$targetType] ?? '未知'; + } + } + + public function getTargetTypeLevels() + { + $items = []; + foreach (self::$targetTypes as $key => $name) { + if ($key == 1) { + foreach (PromoteService::$levels as $level => $levelName) { + $items[$key . '_' . $level] = $levelName . '[推广]'; + } + } else { + $items[$key] = $name; + } + } + return $items; + } + public function addRecord($params) { $data = $this->createRecord($params); return M('PromoteCoinRecord', 'tab_')->add($data); @@ -25,14 +79,99 @@ class PromoteCoinRecordService { 'type' => $params['type'], 'sub_type' => $params['sub_type'], 'ref_id' => $params['ref_id'], + 'promote_id' => $params['promote_id'], 'target_id' => $params['target_id'], 'target_type' => $params['target_type'], + 'target_level' => $params['target_level'] ?? 0, 'coin' => $params['coin'], 'balance_coin' => $params['balance_coin'], + 'game_id' => $params['game_id'] ?? 0, 'create_time' => isset($params['create_time']) ? $params['create_time'] : time(), 'description' => $params['description'], 'remark' => isset($params['remark']) ? $params['remark'] : '', ]; return $data; } + + public function getRef($record) + { + $ref = null; + if ($record['sub_type'] == 1) { + $ref = M('coin_pay_order', 'tab_')->where(['id' => $record['id']])->find(); + } else if ($record['sub_type'] == 2) { + $ref = M('coin_pay_order', 'tab_')->where(['id' => $record['id']])->find(); + } else if ($record['sub_type'] == 3) { + $ref = M('promote_coin_transfer_log', 'tab_')->where(['id' => $record['id']])->find(); + } else if ($record['sub_type'] == 4) { + $ref = M('promote_coin_transfer_log', 'tab_')->where(['id' => $record['id']])->find(); + } else if ($record['sub_type'] == 5) { + // + } else if ($record['sub_type'] == 6) { + // + } else if ($record['sub_type'] == 7) { + // + } else if ($record['sub_type'] == 8) { + // + } + return $ref; + } + + public function getRefDetail($record) + { + $ref = $this->getRef($record); + if (!$ref) { + return null; + } + + $refTitle = ''; + $items = []; + if (in_array($record['sub_type'], [1, 2])) { + $refTitle = '充值订单信息'; + $payWays = [1 => '支付宝', 2 => '微信', 3 => '银联转账']; + $payTypes = [1 => '线上充值', 2 => '线下充值']; + $items = [ + ['name' => '充值订单号', 'value' => $ref['order_number']], + ['name' => '付款时间', 'value' => date('Y-m-d H:i:s', $ref['pay_time'])], + ['name' => '充值类型', 'value' => $payWays[$ref['pay_type']]], + ['name' => '支付方式', 'value' => $payWays[$ref['pay_way']]], + ['name' => '支付金额', 'value' => $ref['pay_amount']], + ['name' => '平台币数量', 'value' => $ref['coin_num']], + ]; + } elseif ($record['sub_type'] == 3) { + $promote = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => $ref['target_id']])->find(); + $preWord = $record['type'] == 1 ? '来源' : '目标'; + $refTitle = '推广员转账信息'; + $items = [ + ['name' => '转账订单号', 'value' => $ref['sn']], + ['name' => '转账时间', 'value' => date('Y-m-d H:i:s', $ref['create_time'])], + ['name' => '平台币数量', 'value' => $ref['num']], + ['name' => '适用游戏', 'value' => $game ? $game['game_name'] : '所有游戏'], + ['name' => '转账描述', 'value' => $ref['description']], + ['name' => '转账备注', 'value' => $ref['remark']], + ['name' => $preWord . '推广账号', 'value' => $promote['account']], + ['name' => $preWord . '推广账号类型', 'value' => PromoteService::$levels[$ref['target_level']]], + ]; + } elseif ($record['sub_type'] == 4) { + $refTitle = '玩家转账信息'; + $game = null; + if ($ref['game_id'] > 0) { + $game = M('game', 'tab_')->field(['id', 'game_name'])->where(['id' => $ref['game_id']])->find(); + } + $user = M('user', 'tab_')->field(['id', 'account'])->where(['id' => $ref['target_id']])->find(); + $items = [ + ['name' => '转账订单号', 'value' => $ref['sn']], + ['name' => '转账时间', 'value' => date('Y-m-d H:i:s', $ref['create_time'])], + ['name' => '平台币数量', 'value' => $ref['num']], + ['name' => '适用游戏', 'value' => $game ? $game['game_name'] : '所有游戏'], + ['name' => '转账描述', 'value' => $ref['description']], + ['name' => '转账备注', 'value' => $ref['remark']], + ['name' => '玩家账号', 'value' => $user['account']], + ]; + } + + return [ + 'refTitle' => $refTitle, + 'items' => $items, + ]; + } } \ No newline at end of file diff --git a/Application/Base/Service/PromoteCoinTransferLogService.class.php b/Application/Base/Service/PromoteCoinTransferLogService.class.php new file mode 100644 index 000000000..56bebe134 --- /dev/null +++ b/Application/Base/Service/PromoteCoinTransferLogService.class.php @@ -0,0 +1,55 @@ + '推广员', + 2 => '玩家', + 3 => '管理员', + ]; + + public function addRecord($params) + { + $data = $this->createRecord($params); + $status = M('promote_coin_transfer_log', 'tab_')->add($data); + if ($status) { + $id = M()->getLastInsID(); + return $id; + } else { + return 0; + } + } + + public function getTargetTypeText($targetType, $targetLevel) + { + if ($targetType == 1) { + return PromoteService::$levels[$targetLevel] ?? '未知'; + } else { + return self::$targetTypes[$targetType] ?? '未知'; + } + } + + public function createRecord($params) + { + $sn = ''; + if (isset($params['sn'])) { + $sn = $params['sn']; + } else { + $sn = date('YmdHis').strtoupper(substr(md5(json_encode($params) . 'PromoteCoinTransferLog' . rand(0, 99999)), 8, 16)); + } + $data = []; + $data['sn'] = $sn; + $data['promote_id'] = $params['promote_id']; + $data['target_type'] = $params['target_type']; + $data['target_level'] = $params['target_level']; + $data['target_id'] = $params['target_id']; + $data['game_id'] = $params['game_id']; + $data['num'] = $params['num']; + $data['status'] = 1; + $data['create_time'] = time(); + $data['remark'] = isset($params['remark']) ? $params['remark'] : ''; + $data['description'] = isset($params['description']) ? $params['description'] : ''; + return $data; + } +} \ No newline at end of file diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index 05e1372d6..d17261c36 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -229,9 +229,10 @@ class PromoteService { if (count($shiftIds) > 0) { $map['id'] = ['in', $shiftIds]; } - $subPromotes = M('promote', 'tab_')->field(['id', 'balance_coin'])->where($map)->select(); - $ids = array_column($subPromotes, 'id'); - $ids[] = $promote['id']; + $subPromotes = M('promote', 'tab_')->field(['id', 'balance_coin', 'level'])->where($map)->select(); + $subPromotes = index_by_column('id', $subPromotes); + $ids = array_keys($subPromotes); + // $ids[] = $promote['id']; $promoteCoins = []; $balances = M('PromoteBalanceCoin', 'tab_')->where(['promote_id' => ['in', $ids]])->select(); @@ -244,50 +245,32 @@ class PromoteService { if ($balance['num'] == 0) { continue; } - $sourceId = 0; - if ($task['balance_coin_mode'] == 1 && $balance['game_id'] == 0) { - $sourceId = $topPromote['id']; - } - $item = [ - 'game_id' => $balance['game_id'], - 'banlan_type' => $balance['game_id'] > 0 ? 2 : 1, - 'num' => $balance['num'], - 'promote_id' => $balance['promote_id'], - 'source_id' => $sourceId, - 'type' => 2, - 'op_id' => $task['create_promote_id'] - ]; - $refId = $promoteCoinService->addRecord($item); $records[] = $coinRecordService->createRecord([ 'type' => 2, - 'sub_type' => $balance['game_id'] > 0 ? 5 : 7, - 'ref_id' => $refId, - 'target_id' => $balance['promote_id'], + 'sub_type' => 7, + 'ref_id' => 0, + 'promote_id' => $balance['promote_id'], + 'target_id' => $topPromote['id'], + 'target_level' => $topPromote['level'], 'target_type' => 1, + 'game_id' => $balance['game_id'], 'coin' => $balance['num'], 'balance_coin' => 0, 'description' => $balance['game_id'] > 0 ? '绑定币回收' : '迁移扣除', ]); if ($task['balance_coin_mode'] == 1 && $balance['game_id'] == 0) { - $item = [ - 'game_id' => 0, - 'banlan_type' => 1, - 'num' => $balance['num'], - 'promote_id' => $topPromote['id'], - 'source_id' => $balance['promote_id'], - 'type' => 1, - 'op_id' => $task['create_promote_id'], - ]; - $refId = $promoteCoinService->addRecord($item); $topBalanceCoin += $balance['num']; $topBalancePlus += $balance['num']; $records[] = $coinRecordService->createRecord([ 'type' => 1, 'sub_type' => 6, - 'ref_id' => $refId, - 'target_id' => $topPromote['id'], + 'ref_id' => 0, + 'promote_id' => $topPromote['id'], + 'target_id' => $balance['promote_id'], 'target_type' => 1, + 'target_level' => $subPromotes[$balance['promote_id']]['level'], + 'game_id' => $balance['game_id'], 'coin' => $balance['num'], 'balance_coin' => $topBalanceCoin, 'description' => '迁移回收', @@ -415,17 +398,17 @@ class PromoteService { { $model = new Model(); $model->startTrans(); - $promoteId = $params['promote_id']; + $promoteId = $params['from_promote_id']; $userId = $params['user_id']; $remark = $params['remark']; $num = $params['num']; $gameId = $params['game_id']; $isUseBind = $params['is_use_bind']; - $promote = D('promote')->where(['id' => $promoteId])->find(); - $user = D('User')->where(['id' => $userId])->find(); - $userPlay = D('UserPlay')->where(['user_id' => $userId])->find(); - $game = M('Game', 'tab_')->where(['id' => $gameId])->find(); + $promote = M('promote', 'tab_')->where(['id' => $promoteId])->find(); + $user = M('user', 'tab_')->where(['id' => $userId])->find(); + $userPlay = M('user_play', 'tab_')->where(['user_id' => $userId])->find(); + $game = M('game', 'tab_')->where(['id' => $gameId])->find(); $fromBalanceCoin = 0; if ($isUseBind) { $fromBalanceCoin = $this->getBalanceCoin($promoteId, $gameId); @@ -460,18 +443,17 @@ class PromoteService { $fromParams = []; $fromParams['game_id'] = $gameId; - $fromParams['banlan_type'] = $isUseBind ? 2 : 1; $fromParams['num'] = $num; $fromParams['promote_id'] = $promoteId; - $fromParams['source_id'] = $userId; - $fromParams['type'] = 2; - $fromParams['source_type'] = 2; + $fromParams['target_id'] = $userId; + $fromParams['target_type'] = 2; $fromParams['remark'] = $remark; $fromParams['description'] = $isUseBind ? '绑定币转账' : '通用币转账'; - $agentRefId = D('Agent')->addRecord($agentParams); - $promoteCoinService = new PromoteCoinService(); - $formRefId = $promoteCoinService->addRecord($fromParams); + $agentService = new AgentService(); + $transferLogService = new PromoteCoinTransferLogService(); + $agentRefId = $agentService->addRecord($agentParams); + $formRefId = $transferLogService->addRecord($fromParams); if ($formRefId == 0 || $agentRefId == 0) { $model->rollback(); @@ -485,30 +467,19 @@ class PromoteService { $fromRecord = [ 'type' => 2, 'sub_type' => 4, + 'promote_id' => $promoteId, 'ref_id' => $formRefId, - 'target_id' => $promoteId, - 'target_type' => 1, - 'coin' => $num, - 'balance_coin' => $fromBalanceCoin - $num, - 'description' => $isUseBind ? '绑定币转账' : '通用币转账', - 'remark' => $remark, - ]; - $promoteCoinRecordService->addRecord($fromRecord); - - $toRecord = [ - 'type' => 1, - 'sub_type' => 3, - 'ref_id' => $agentRefId, 'target_id' => $userId, 'target_type' => 2, + 'game_id' => $gameId, 'coin' => $num, - 'balance_coin' => $userPlay['bind_balance'] + $num, + 'balance_coin' => $fromBalanceCoin - $num, 'description' => $isUseBind ? '绑定币转账' : '通用币转账', 'remark' => $remark, ]; - $promoteCoinRecordService->addRecord($toRecord); + $promoteCoinRecordService->addRecord($fromRecord); - $incStatus = M('UserPlay', 'tab_')->where(['game_id' => $gameId, 'user_id' => $userId])->setInc('bind_balance', $num); + $incStatus = M('user_play', 'tab_')->where(['game_id' => $gameId, 'user_id' => $userId])->setInc('bind_balance', $num); $decStatus = $this->decCoin($promoteId, $num, $isUseBind ? $gameId : 0); if (!$incStatus || !$decStatus) { $model->rollback(); @@ -525,17 +496,17 @@ class PromoteService { ]; } - public function shiftCoin($params) + public function shiftPromoteCoin($params) { - $toPromoteId = $params['to_promote_id']; + $toPromoteId = $params['promote_id']; $fromPromoteId = $params['from_promote_id']; $remark = $params['remark']; $num = $params['num']; - $gameId = $params['game_id']; + $gameId = $params['game_id'] ?? 0; $isUseBind = $params['is_use_bind']; - $toPromote = D('promote')->where(['id' => $toPromoteId])->find(); - $fromPromote = D('promote')->where(['id' => $fromPromoteId])->find(); + $toPromote = M('promote', 'tab_')->where(['id' => $toPromoteId])->find(); + $fromPromote = M('promote', 'tab_')->where(['id' => $fromPromoteId])->find(); $toBalanceCoin = $this->getBalanceCoin($toPromoteId, $gameId); $fromBalanceCoin = 0; if ($isUseBind) { @@ -553,30 +524,20 @@ class PromoteService { $model = new Model(); $model->startTrans(); - $params = []; $params['game_id'] = $gameId; - $params['banlan_type'] = $gameId > 0 ? 2 : 1; + $params['promote_id'] = $fromPromoteId; $params['num'] = $num; - $params['source_type'] = 1; + $params['target_type'] = 1; + $params['target_id'] = $toPromoteId; + $params['target_level'] = $toPromote['level']; $params['remark'] = $remark; $params['description'] = $isUseBind ? '绑定币转账' : '通用币转账'; - $fromParams = $params; - $fromParams['promote_id'] = $fromPromoteId; - $fromParams['source_id'] = $toPromoteId; - $fromParams['type'] = 2; - - $toParams = $params; - $toParams['promote_id'] = $toPromoteId; - $toParams['source_id'] = $fromPromoteId; - $toParams['type'] = 1; - - $promoteCoinService = new PromoteCoinService(); - $formRefId = $promoteCoinService->addRecord($fromParams); - $toRefId = $promoteCoinService->addRecord($toParams); + $transferLogService = new PromoteCoinTransferLogService(); + $refId = $transferLogService->addRecord($params); - if ($formRefId == 0 || $toRefId == 0) { + if ($refId == 0) { $model->rollback(); return [ 'msg' => '系统异常', @@ -587,10 +548,13 @@ class PromoteService { $promoteCoinRecordService = new PromoteCoinRecordService(); $fromRecord = [ 'type' => 2, - 'sub_type' => 4, - 'ref_id' => $formRefId, - 'target_id' => $fromPromoteId, + 'sub_type' => 3, + 'ref_id' => $refId, + 'promote_id' => $fromPromoteId, + 'target_id' => $toPromoteId, 'target_type' => 1, + 'target_level' => $toPromote['level'], + 'game_id' => $gameId, 'coin' => $num, 'balance_coin' => $fromBalanceCoin - $num, 'description' => '平台币转账', @@ -601,9 +565,12 @@ class PromoteService { $toRecord = [ 'type' => 1, 'sub_type' => 3, - 'ref_id' => $toRefId, - 'target_id' => $toPromoteId, + 'ref_id' => $refId, + 'promote_id' => $toPromoteId, + 'target_id' => $fromPromote['id'], 'target_type' => 1, + 'target_level' => $fromPromote['level'], + 'game_id' => $gameId, 'coin' => $num, 'balance_coin' => $toBalanceCoin + $num, 'description' => '平台币转账', @@ -694,6 +661,7 @@ class PromoteService { { $balanceCoin = $this->getBalanceCoin($promoteId, $gameId); + $promote = M('promote', 'tab_')->where(['id' => $promoteId])->find(); $model = new Model(); $model->startTrans(); @@ -702,7 +670,7 @@ class PromoteService { $log['game_id'] = $gameId; $log['banlan_type'] = $gameId > 0 ? 2 : 1; $log['num'] = $num; - $log['promote_id'] = $promoteId; + $log['promote_id'] = $promote['id']; $log['source_id'] = 0; $log['type'] = 2; $log['op_id'] = $adminId; @@ -715,16 +683,19 @@ class PromoteService { 'type' => 2, 'sub_type' => 5, 'ref_id' => $refId, - 'target_id' => $promoteId, - 'target_type' => 1, + 'promote_id' => $promote['id'], + 'target_id' => $adminId, + 'target_type' => 3, + 'target_level' => $promote['level'], + 'game_id' => $gameId, 'coin' => $num, 'balance_coin' => $balanceCoin - $num, - 'description' => '后台回收', + 'description' => '后台回收平台币', 'remark' => '', ]; $promoteCoinRecordService->addRecord($record); - $status = $this->decCoin($promoteId, $num, $gameId); + $status = $this->decCoin($promote['id'], $num, $gameId); if ($refId && $status) { $model->commit(); return true; @@ -739,6 +710,8 @@ class PromoteService { public function adminIncCoin($promoteId, $num, $adminId, $gameId = 0) { $balanceCoin = $this->getBalanceCoin($promoteId, $gameId); + $promote = M('promote', 'tab_')->where(['id' => $promoteId])->find(); + $model = new Model(); $model->startTrans(); @@ -746,28 +719,31 @@ class PromoteService { $log['game_id'] = $gameId; $log['banlan_type'] = $gameId > 0 ? 2 : 1; $log['num'] = $num; - $log['promote_id'] = $promoteId; + $log['promote_id'] = $promote['id']; $log['source_id'] = 0; $log['type'] = 1; $log['op_id'] = $adminId; $promoteCoinService = new PromoteCoinService(); $refId = $promoteCoinService->addRecord($log); + $status = $this->incCoin($promote['id'], $num, $gameId); - $status = $this->incCoin($promoteId, $num, $gameId); - - $promoteCoinRecordService = new PromoteCoinRecordService(); $record = [ 'type' => 1, - 'sub_type' => 2, + 'sub_type' => 8, 'ref_id' => $refId, - 'target_id' => $promoteId, - 'target_type' => 1, + 'promote_id' => $promote['id'], + 'target_id' => $adminId, + 'target_type' => 3, + 'target_level' => $promote['level'], 'coin' => $num, + 'game_id' => $gameId, 'balance_coin' => $balanceCoin + $num, - 'description' => '后台发放', + 'description' => '后台发放平台币', 'remark' => '', ]; + + $promoteCoinRecordService = new PromoteCoinRecordService(); $promoteCoinRecordService->addRecord($record); if ($refId && $status) { diff --git a/Application/Callback/Controller/Notify3Controller.class.php b/Application/Callback/Controller/Notify3Controller.class.php index 45ea502c4..6c3c0e9e6 100644 --- a/Application/Callback/Controller/Notify3Controller.class.php +++ b/Application/Callback/Controller/Notify3Controller.class.php @@ -188,18 +188,21 @@ class Notify3Controller extends BaseController } // 添加流水 - public function coin_record_add($order,$balance){ + public function coin_record_add($order, $balance){ + $promote = M('promote', 'tab_')->field(['id', 'level'])->where(['id' => $order['promote_id']])->find(); $data['sn']=date('Ymd') . date('His') . sp_random_num(6); - $data['type']=1; - $data['sub_type'] =1; - $data['target_id'] = $order['promote_id']; + $data['type'] = 1; + $data['sub_type'] = 1; + $data['target_id'] = $promote['id']; + $data['target_level'] = $promote['level']; $data['target_type'] = 1; $data['ref_id'] = $order['id']; + $data['game_id'] = 0; $data['coin'] = $order['real_amount']; $data['balance_coin'] = $balance['num']+$order['coin_num']; $data['remark'] = $order['remark']; - $data['create_time']=time(); - $data['description']='线上充值'; + $data['create_time'] = time(); + $data['description'] = '线上充值'; M('promote_coin_record', 'tab_')->data($data)->add(); } diff --git a/Application/Home/Controller/PromoteCoinController.class.php b/Application/Home/Controller/PromoteCoinController.class.php index e81487c71..e35099eb0 100644 --- a/Application/Home/Controller/PromoteCoinController.class.php +++ b/Application/Home/Controller/PromoteCoinController.class.php @@ -5,6 +5,8 @@ namespace Home\Controller; use OT\DataDictionary; use User\Api\PromoteApi; use Base\Service\PromoteService; +use Base\Service\PromoteCoinRecordService; +use Base\Service\PromoteCoinTransferLogService; /** * 前台首页控制器 @@ -38,7 +40,9 @@ class PromoteCoinController extends BaseController public function myCoin($p = 0) { - $map['promote_id'] = PID; + $loginPromote = $this->getLoginPromote(); + $map = []; + $map['promote_id'] = $loginPromote['id']; empty(I('game_id')) || $map['game_id'] = I('game_id'); empty(I('status')) || $map['status'] = I('status'); @@ -88,179 +92,105 @@ class PromoteCoinController extends BaseController $this->assign('_page', $page); } + $this->meta_title = '我的平台币'; $this->assign('data', $data); $this->assign('count', $count); - $this->meta_title = '我的平台币'; $this->display(); } - public function coinRecord($p = 0) + public function coinDetails() { - $map['tab_promote_coin_record.target_id'] = PID; - empty(I('type')) || $map['tab_promote_coin_record.type'] = I('type'); - empty(I('sub_type')) || $map['tab_promote_coin_record.sub_type'] = I('sub_type'); - - if (!empty(I('start_time')) && empty(I('end_time'))) { - $map['tab_promote_coin_record.create_time'] = ['egt', strtotime(I('start_time'))]; - } elseif (empty(I('start_time')) && !empty(I('end_time'))) { - $map['tab_promote_coin_record.create_time'] = ['elt', strtotime(I('end_time')) + 86399]; - } elseif (!empty(I('start_time')) && !empty(I('end_time'))) { - $map['tab_promote_coin_record.create_time'] = ['between', [strtotime(I('start_time')), strtotime(I('end_time')) + 86399]]; - } - - $page = intval($p); - $page = $page ? $page : 1; //默认显示第一页数据 - - if (isset($_REQUEST['row'])) { - $row = $_REQUEST['row']; - } else { - $row = 10; - } - - $having = ''; - $where['_string'] = '1 = 1'; - if (empty(I('get.game_id'))) { - $where['_logic'] = 'or'; - $join = 'left join tab_promote_coin on tab_promote_coin_record.ref_id = tab_promote_coin.id and tab_promote_coin_record.sub_type > 2 and tab_promote_coin.banlan_type = 1'; - $having = '(coin_id > 0 or pay_id > 0)'; - } else { - $where['tab_promote_coin_record.sub_type'] = ['gt', 2]; - $join = 'inner join tab_promote_coin on tab_promote_coin_record.ref_id = tab_promote_coin.id and tab_promote_coin.banlan_type = 2 and tab_promote_coin.game_id = ' . I('get.game_id'); + $type = I('type', 0); + $subType = I('sub_type', 0); + $targetType = I('target_type', ''); + $startTime = I('start_time', ''); + $endTime = I('end_time', ''); + $gameId = I('game_id', 0); + $loginPromote = $this->getLoginPromote(); + + $conditions = []; + $conditions['game_id'] = $gameId; + $conditions['promote_id'] = $loginPromote['id']; + if ($type != 0) { + $conditions['type'] = $type; + } + if ($subType != 0) { + $conditions['sub_type'] = $subType; + } + if ($targetType != '') { + $targetTypeRow = explode('_', $targetType); + $conditions['target_type'] = $targetTypeRow[0]; + if (count($targetTypeRow) == 2) { + $conditions['target_level'] = $targetTypeRow[1]; + } } - - if (!empty(I('handle_type'))) { - switch (I('handle_type')) { - case 1: - $where['tab_promote_coin.source_type'] = 1; - $join .= ' inner join tab_promote on tab_promote_coin.source_id = tab_promote.id and tab_promote.parent_id = 0'; - break; - case 2: - $where['tab_promote_coin.source_type'] = 1; - $join .= ' inner join tab_promote on tab_promote_coin.source_id = tab_promote.id and tab_promote.parent_id > 0 and tab_promote.grand_id = 0'; - break; - case 3: - $where['tab_promote_coin.source_type'] = 1; - $join .= ' inner join tab_promote on tab_promote_coin.source_id = tab_promote.id and tab_promote.grand_id > 0'; - break; - case 4: - $where['tab_promote_coin.source_type'] = 2; - break; + if ($startTime != '' || $endTime != '') { + if ($startTime != '') { + $conditions['create_time'] = ['egt', strtotime($startTime. ' 00:00:00')]; + } + if ($endTime != '') { + $conditions['create_time'] = ['elt', strtotime($endTime. ' 23:59:59')]; } } - $join .= ' left join tab_coin_pay_order on tab_promote_coin_record.ref_id = tab_coin_pay_order.id and tab_promote_coin_record.sub_type in (1,2)'; - $map['_complex'] = $where; - - $data = M('PromoteCoinRecord', 'tab_') - ->field('tab_promote_coin_record.*,tab_promote_coin.id as coin_id,tab_promote_coin.source_type,tab_promote_coin.source_id,tab_coin_pay_order.id as pay_id') - ->join($join) - ->where($map) - ->having($having) - ->order('id desc') - ->page($page, $row) - // ->fetchSql(true) - ->select(); - - $count = M('PromoteCoinRecord', 'tab_') - ->field('tab_promote_coin.id as coin_id,tab_coin_pay_order.id as pay_id') - ->join($join) - ->where($map) - ->having($having) - ->select(); - $count = count($count); - - //分页 - $parameter['p'] = I('get.p', 1); - $parameter['row'] = I('get.row'); - empty(I('game_id')) || $parameter['game_id'] = I('get.game_id'); - empty(I('type')) || $parameter['type'] = I('type'); - empty(I('sub_type')) || $parameter['sub_type'] = I('sub_type'); - empty(I('source_type')) || $parameter['source_type'] = I('source_type'); - empty(I('start_time')) || $parameter['start_time'] = I('start_time'); - empty(I('end_time')) || $parameter['end_time'] = I('end_time'); + $service = new PromoteCoinRecordService(); + $query = M('promote_coin_record', 'tab_')->where($conditions); - $page = set_pagination($count, $row, $parameter); - if ($page) { - $this->assign('_page', $page); - } + list($items, $pagination, $count) = $this->paginate($query); - if (!empty($data)) { - foreach ($data as $key => $list) { - if ($list['sub_type'] > 2) { - $promote = D('Promote')->where(array('id' => $list['source_id']))->find(); - $data[$key]['handle_type'] = $this->getHandleType($list, $promote); - } else { - $data[$key]['handle_type'] = '未知'; - } - } + $records = []; + foreach ($items as $item) { + $records[] = [ + 'id' => $item['id'], + 'sn' => $item['sn'], + 'type_text' => $service->getTypeText($item['type']), + 'sub_type_text' => $service->getSubTypeText($item['sub_type']), + 'target_type_text' => $service->getTargetTypeText($item['target_type'], $item['target_level']), + 'coin' => $item['coin'], + 'balance_coin' => $item['balance_coin'], + 'remark' => $item['remark'], + 'description' => $item['description'], + 'create_time' => date('Y-m-d H:i:s', $item['create_time']), + ]; } + $this->meta_title = '交易明细'; - $this->assign('data', $data); + $this->assign('subTypes', PromoteCoinRecordService::$subTypes); + $this->assign('types', PromoteCoinRecordService::$types); + $this->assign('targetTypeLevels', $service->getTargetTypeLevels()); + $this->assign('records', $records); $this->assign('count', $count); - $this->assign('gameId', I('get.game_id')); - $this->assign('setDate', date("Y-m-d")); - $this->meta_title = '交易明细'; + $this->assign('gameId', $gameId); + $this->assign('pagination', $pagination); $this->display(); } - public function coinRecordDesc() + public function coinDetail() { - if (empty(I('id'))) { - $this->error('网络异常'); - } - - $map['promote_id'] = PID; - $map['id'] = I('id'); - - $data['record'] = M('PromoteCoinRecord', 'tab_') - ->where($map) - ->find(); - $data['desc'] = []; - - if (!empty($data['record'])) { - switch ($data['record']['sub_type']) { - case 1: - case 2: - $tableName = 'CoinPayOrder'; - break; - default: - $tableName = 'PromoteCoin'; - break; - } - - $data['desc'] = M($tableName, 'tab_') - ->where(array('id' => $data['record']['ref_id'])) - ->find(); - - if ($data['record']['sub_type'] > 2) { - switch ($data['desc']['source_type']) { - case 1: - $data['payee'] = D('Promote') - ->field('*,mobile_phone as phone') - ->where(array('id' => $data['desc']['source_id'])) - ->find(); - break; - case 2: - $data['payee'] = D('User')->where(array('id' => $data['desc']['source_id']))->find(); - break; - default: - $data['payee'] = []; - break; - } - } - } - - if (!empty($data['record'])) { - if ($data['record']['sub_type'] > 2) { - $promote = D('Promote')->where(array('id' => $data['desc']['source_id']))->find(); - $data['record']['handle_type'] = $this->getHandleType($data['desc'], $promote); - } else { - $data['record']['handle_type'] = '未知'; - } - } - - $this->assign('data', $data); $this->meta_title = '查看明细'; + $id = I('id', 0); + $service = new PromoteCoinRecordService(); + $loginPromote = $this->getLoginPromote(); + $item = M('promote_coin_record', 'tab_')->where(['promote_id' => $loginPromote['id'], 'id' => $id])->find(); + $refOrderName = ''; + $ref = $service->getRef($item); + $refDetail = $service->getRefDetail($item, $ref); + $record = [ + 'id' => $item['id'], + 'sn' => $item['sn'], + 'type_text' => $service->getTypeText($item['type']), + 'sub_type_text' => $service->getSubTypeText($item['sub_type']), + 'target_type_text' => $service->getTargetTypeText($item['target_type'], $item['target_level']), + 'coin_type' => $item['game_id'] > 0 ? '绑定币' : '通用币', + 'coin' => $item['coin'], + 'balance_coin' => $item['balance_coin'], + 'remark' => $item['remark'], + 'description' => $item['description'], + 'create_time' => date('Y-m-d H:i:s', $item['create_time']), + ]; + + $this->assign('record', $record); + $this->assign('refDetail', $refDetail); $this->display(); } @@ -326,12 +256,19 @@ class PromoteCoinController extends BaseController /** * 转移平台币 */ - public function shift($p = 0) + public function shift() { - $data = D('Promote')->find(PID); + $loginPromote = $this->getLoginPromote(); if (IS_POST) { - + $num = I('num'); + $password = I('password'); + $shiftUserType = I('shift_user_type', 0); + $targetId = I('target_id', 0); + $gameId = I('game_id', 0); + $remark = I('remark', ''); + $coinType = I('coin_type', 1); + if (!is_numeric($num)) { $this->ajaxReturn(['status' => 0, 'msg' => '发送数量必须是数字']); } @@ -340,42 +277,31 @@ class PromoteCoinController extends BaseController $this->ajaxReturn(['status' => 0, 'msg' => '发送数量不正确']); } - $password = I('password'); - if ($data['second_pwd'] !== $this->think_ucenter_md5($password, UC_AUTH_KEY)) { + $promoteService = new PromoteService(); + if ($loginPromote['second_pwd'] !== $promoteService->password($password, UC_AUTH_KEY)) { $this->ajaxReturn(['status' => 0, 'msg' => '安全密码错误']); } - - $shiftUserType = I('shift_user_type', 0); if ($shiftUserType == 0) { $this->ajaxReturn(['status' => 0, 'msg' => '请选择帐号类型']); } - - $gameId = I('game_id', 0); - if ($shiftUserType == 3 && $gameId == 0) { + if ($shiftUserType == 4 && $gameId == 0) { $this->ajaxReturn(['status' => 0, 'msg' => '请选择游戏']); } - $promoteService = new PromoteService(); + $params = [ + 'from_promote_id' => $loginPromote['id'], + 'num' => $num, + 'remark' => $remark, + 'game_id' => $gameId, + 'is_use_bind' => $coinType == 1 ? false : true, + ]; + $result = []; - if ($shiftUserType == 1 || $shiftUserType == 2) { - $params = [ - 'from_promote_id' => session('promote_auth.pid'), - 'to_promote_id' => I('promote_id'), - 'num' => $num, - 'remark' => I('remark', ''), - 'game_id' => I('game_id', 0), - 'is_use_bind' => I('coin_type', 1) == 1 ? false : true, - ]; - $result = $promoteService->shiftCoin($params); - } elseif ($shiftUserType == 3) { - $params = [ - 'promote_id' => session('promote_auth.pid'), - 'user_id' => I('promote_id'), - 'num' => $num, - 'remark' => I('remark', ''), - 'game_id' => I('game_id', 0), - 'is_use_bind' => I('coin_type', 1) == 1 ? false : true, - ]; + if ($shiftUserType == 1 || $shiftUserType == 2 || $shiftUserType == 3) { + $params['promote_id'] = $targetId; + $result = $promoteService->shiftPromoteCoin($params); + } elseif ($shiftUserType == 4) { + $params['user_id'] = $targetId; $result = $promoteService->shiftUserCoin($params); } @@ -385,10 +311,6 @@ class PromoteCoinController extends BaseController $this->ajaxReturn(['status' => -1, 'msg' => $result['msg']]); } } else { - $this->assign('data', $data);//用户信息被覆盖,转移位置获取正确数据 - $child = M('Promote', 'tab_')->field('account,balance_coin')->where(['parent_id' => PID])->select(); - $this->assign('childData', $child); - $this->assign('childcount', count($child)); $this->meta_title = "平台币转移"; $this->display(); } @@ -430,136 +352,102 @@ class PromoteCoinController extends BaseController $this->ajaxReturn($res); } - /** - * 转移平台币记录 - */ - public function record() + public function transferLogs() { - $map['source_id'] = empty(I('promote_id')) ? ['neq', '0'] : I('promote_id'); - $map['type'] = 2; - $map['promote_id'] = PID; - $end_time = strtotime(I('time_end')); - $start_time = strtotime(I('time_start')); - if (!empty($end_time) && !empty($start_time)) { - $map['create_time'] = ['between', [$start_time, $end_time + 86400 - 1]]; - } elseif (!empty($start_time)) { - $map['create_time'] = array('gt', $start_time); - } elseif (!empty($end_time)) { - $map['create_time'] = array('lt', $end_time + 86400 - 1); - } - $account = I('account'); - $sn = I('sn'); - if ($sn) { - $map['sn'] = ['like', '%' . $sn . '%']; - } - if ($account) { - $searchUsers = M('User', 'tab_')->field('id')->where(['account' => ['like', '%' . $account . '%']])->select(); - $searchPromotes = M('Promote', 'tab_')->field('id')->where(['account' => ['like', '%' . $account . '%']])->select(); - if (empty($searchUsers) && empty($searchPromotes)) { - $map['_string'] = '1<>1'; - } - if (empty($searchUsers) && !empty($searchPromotes)) { - $map['source_id'] = ['in', array_column($searchPromotes, 'id')]; - } - if (!empty($searchUsers) && empty($searchPromotes)) { - $map['source_id'] = ['in', array_column($searchUsers, 'id')]; + $this->meta_title = "平台币转移记录"; + + $gameId = I('game_id', -1); + $account = I('account', ''); + $sn = I('sn', ''); + $startTime = I('time_end', ''); + $endTime = I('time_start', ''); + + $conditions = []; + if ($startTime != '' || $endTime != '') { + if ($startTime != '') { + $conditions['create_time'] = ['egt', strtotime($startTime. ' 00:00:00')]; } - if (!empty($searchUsers) && !empty($searchPromotes)) { - $map['_string'] = '(source_id in (' . implode(',', array_column($searchUsers, 'id')) . ') or' - . '(source_id in (' . implode(',', array_column($searchPromotes, 'id')) . '))'; + if ($endTime != '') { + $conditions['create_time'] = ['elt', strtotime($endTime. ' 23:59:59')]; } } - $searchHandleType = I('handle_type', 0); - if ($searchHandleType) { - if ($searchHandleType == 2) { - $map['source_type'] = 2; - } else { + $query = M('promote_coin_transfer_log', 'tab_')->where($conditions); + list($logs, $pagination, $count) = $this->paginate($query); + $service = new PromoteCoinTransferLogService(); + + $gameIds = []; + $promoteIds = []; + $uesrIds = []; + foreach ($logs as $log) { + $gameIds[] = $log['game_id']; + if ($log['target_type'] == 1) { + $promoteIds[] = $log['target_id']; + } + if ($log['target_type'] == 2) { + $uesrIds[] = $log['target_id']; } } - $searchGameId = I('game_id', -1); - if ($searchGameId != -1) { - $map['game_id'] = $searchGameId; + $games = []; + $promotes = []; + $users = []; + if (count($gameIds) > 0) { + $games = M('game', 'tab_')->field(['id', 'game_name'])->where(['id' => ['in', $gameIds]])->select(); } - - $this->meta_title = "平台币转移记录"; - - $query = M('PromoteCoin', 'tab_')->where($map)->order('create_time desc'); - list($items, $pagination, $count) = $this->paginate($query); - - $gameIds = array_unique(array_column($items, 'game_id')); - $games = $this->getColumnsByIds(M('Game', 'tab_'), $gameIds, 'game_name', ['indexBy' => 'id']); - - $sourcePromoteIds = []; - $sourceUserIds = []; - foreach ($items as $item) { - if ($item['source_type'] == 1) { - $sourcePromoteIds[] = $item['source_id']; - } elseif ($item['source_type'] == 2) { - $sourceUserIds[] = $item['source_id']; - } + if (count($promoteIds) > 0) { + $promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', $promoteIds]])->select(); } - - $sourceUsers = $this->getRecordsByIds(M('User', 'tab_'), $sourceUserIds, ['indexBy' => 'id']); - $sourcePromotes = $this->getRecordsByIds(M('Promote', 'tab_'), $sourcePromoteIds, ['indexBy' => 'id']); - + if (count($uesrIds) > 0) { + $users = M('user', 'tab_')->field(['id', 'account'])->where(['id' => ['in', $uesrIds]])->select(); + } + $users = index_by_column('id', $users); + $promotes = index_by_column('id', $promotes); + $games = index_by_column('id', $games); $records = []; - foreach ($items as $item) { - $sourceName = ''; - $promote = null; - if ($item['source_type'] == 2) { - $sourceName = $sourceUsers[$item['source_id']]['account']; - } elseif ($item['source_type'] == 1) { - $promote = $sourcePromotes[$item['source_id']]; - $sourceName = $sourcePromotes[$item['source_id']]['account']; + foreach ($logs as $log) { + $targetAccount = ''; + if ($log['target_type'] == 1) { + $targetAccount = isset($promotes[$log['target_id']]) ? $promotes[$log['target_id']]['account'] : '未知推广账号'; + } + if ($log['target_type'] == 2) { + $targetAccount = isset($promotes[$log['target_id']]) ? $promotes[$log['target_id']]['account'] : '未知玩家'; } - $handleType = $this->getHandleType($item, $promote); $records[] = [ - 'id' => $item['id'], - 'sn' => $item['sn'], - 'account' => $item['id'], - 'game_name' => isset($games[$item['game_id']]) ? $games[$item['game_id']] : '所有游戏', - 'create_time' => date('Y-m-d H:i:s', $item['create_time']), - 'description' => $item['description'], - 'num' => $item['num'], - 'source_name' => $sourceName, - 'handle_type' => $handleType, - 'status' => $item['status'] == 1 ? '成功' : '失败', + 'id' => $log['id'], + 'sn' => $log['sn'], + 'target_account' => $targetAccount, + 'game_name' => isset($games[$log['game_id']]) ? $games[$log['game_id']]['game_name'] : '所有游戏', + 'target_type_text' => $service->getTargetTypeText($log['target_type'], $log['target_level']), + 'num' => $log['num'], + 'description' => $log['description'], + 'status_text' => '成功', + 'create_time' => date('Y-m-d H:i:s', $log['create_time']) ]; } - - $rows = M('PromoteCoin', 'tab_')->field(['game_id'])->where(['type' => 2, 'promote_id' => PID])->group('game_id')->select(); - - $gameIds = array_column($rows, 'game_id'); - $games = []; - if (count($gameIds) > 0) { - $games = M('Game', 'tab_')->field(['id', 'game_name'])->where(['id' => ['in', $gameIds]])->select(); - } - - $this->assign('games', $games); - $this->assign('records', $records); $this->assign('pagination', $pagination); $this->assign('count', $count); + $this->assign('records', $records); $this->display(); } public function detail() { $id = I('id', 0); - $record = M('PromoteCoin', 'tab_')->where(['id' => $id])->find(); - $sourceName = ''; + $record = M('promote_coin_transfer_log', 'tab_')->where(['id' => $id])->find(); + $targetName = ''; $sourceAccount = ''; $sourcePromote = null; - if ($record['source_type'] == 2) { - $sourceUser = M('User', 'tab_')->where(['id' => $record['source_id']])->find(); - $sourceName = $sourceUser['real_name']; - $sourceAccount = $sourceUser['account']; - } elseif ($record['source_type'] == 1) { - $sourcePromote = M('Promote', 'tab_')->where(['id' => $record['source_id']])->find(); - $sourceName = $sourcePromote['real_name']; - $sourceAccount = $sourcePromote['account']; - } - $handleType = $this->getHandleType($record, $sourcePromote); + if ($record['target_type'] == 2) { + $targetUser = M('user', 'tab_')->where(['id' => $record['target_id']])->find(); + $targetName = $targetUser['real_name']; + $targetAccount = $targetUser['account']; + } elseif ($record['target_type'] == 1) { + $targetPromote = M('promote', 'tab_')->where(['id' => $record['target_id']])->find(); + $targetName = $targetPromote['real_name']; + $targetAccount = $targetPromote['account']; + } + $service = new PromoteCoinTransferLogService(); + $targetTypeText = $service->getTargetTypeText($record['target_type'], $record['target_level']); $gameName = '所有游戏'; if ($record['game_id'] > 0) { $game = M('Game', 'tab_')->field('game_name')->where(['id' => $record['game_id']])->find(); @@ -571,9 +459,9 @@ class PromoteCoinController extends BaseController 'sn' => $record['sn'], 'game_name' => $gameName, 'create_time' => date('Y-m-d H:i:s', $record['create_time']), - 'source_name' => $sourceName, - 'source_account' => $sourceAccount, - 'handle_type' => $handleType, + 'target_name' => $targetName, + 'target_account' => $targetAccount, + 'target_type_text' => $targetTypeText, 'description' => $record['description'], 'remark' => $record['remark'], 'status' => $record['status'] == 1 ? '成功' : '失败', @@ -793,11 +681,6 @@ class PromoteCoinController extends BaseController $this->display('promote_users'); } - public function think_ucenter_md5($str, $key = 'ThinkUCenter') - { - return '' === $str ? '' : md5(sha1($str) . $key); - } - public function promoteGames() { $promoteId = I('promote_id', 0); diff --git a/Application/Home/View/default/PromoteCoin/coinDetail.html b/Application/Home/View/default/PromoteCoin/coinDetail.html new file mode 100644 index 000000000..856ff3e2b --- /dev/null +++ b/Application/Home/View/default/PromoteCoin/coinDetail.html @@ -0,0 +1,83 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Application/Home/View/default/PromoteCoin/coinDetails.html b/Application/Home/View/default/PromoteCoin/coinDetails.html new file mode 100644 index 000000000..5da236f25 --- /dev/null +++ b/Application/Home/View/default/PromoteCoin/coinDetails.html @@ -0,0 +1,281 @@ + + + + + + + + + + + + + +
+
+ 返回 +
+
+
+
当前位置:平台币管理>我的平台币>交易明细
+
+ 交易明细 +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
流水号操作类型操作方式对手账号类型平台币数量平台币余额交易说明交易时间操作
+ +

暂无数据

+
{$record.sn}{$record.type_text}{$record.sub_type_text}{$record.target_type_text}{$record.coin}{$record.balance_coin}{$record.description}{$record.create_time} + 查看明细 +
+
+
+ {$pagination} +
+
+
+
+
+ + + + + + + + + diff --git a/Application/Home/View/default/PromoteCoin/coinRecord.html b/Application/Home/View/default/PromoteCoin/coinRecord.html index ecd5f6863..e2ff10611 100644 --- a/Application/Home/View/default/PromoteCoin/coinRecord.html +++ b/Application/Home/View/default/PromoteCoin/coinRecord.html @@ -136,7 +136,7 @@
- + +
+
+ + +
+
+ + +
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
订单号收款方帐号适用游戏目标帐号类型转账数量交易说明交易时间交易状态操作

暂无数据

{$vo.sn}{$vo.target_account}{$vo.game_name}{$vo.target_type_text}{$vo.num}{$vo.description}{$vo.create_time}{$vo.status_text}查看详情
+ +
+ + 导出 + + {$pagination} +
+
+ + + +
+ + + + + + \ No newline at end of file diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index 97d8cf52b..3a6e743f6 100644 --- a/Application/Home/View/default/Public/promote_base.html +++ b/Application/Home/View/default/Public/promote_base.html @@ -119,7 +119,7 @@