diff --git a/Application/Home/Controller/TestingResourceController.class.php b/Application/Home/Controller/TestingResourceController.class.php index b61e70b12..acd709c92 100644 --- a/Application/Home/Controller/TestingResourceController.class.php +++ b/Application/Home/Controller/TestingResourceController.class.php @@ -135,6 +135,8 @@ class TestingResourceController extends BaseController ]; } + $this->assign('games', $this->getGames()); + $this->assign('servers', $this->getServersByGameId($gameId)); $this->assign('count', $count); $this->assign('pagination', $pagination); $this->assign('records', $records); @@ -193,10 +195,10 @@ class TestingResourceController extends BaseController public function batches() { - $verifyTimeStart = I('verify_time_start', ''); - $verifyTimeEnd = I('verify_time_end', ''); + $provideTimeStart = I('provide_time_start', ''); + $provideTimeEnd = I('provide_time_end', ''); $verifyStatus = I('verify_status', -1); - $status = I('status', -1); + $provideStatus = I('provide_status', -1); $account = I('account'); $loginPromote = $this->getLoginPromote(); @@ -209,17 +211,17 @@ class TestingResourceController extends BaseController $conditions = [ '_string' => 'exists (' . $subSql . ')' ]; - if ($verifyTimeStart) { - $conditions['verify_time'] = ['egt', strtotime($verifyTimeStart . ' 00:00:00')]; + if ($provideTimeStart) { + $conditions['provide_time'] = ['egt', strtotime($provideTimeStart . ' 00:00:00')]; } - if ($verifyTimeEnd) { - $conditions['verify_time'] = ['elt', strtotime($verifyTimeEnd . ' 23:59:59')]; + if ($provideTimeEnd) { + $conditions['provide_time'] = ['elt', strtotime($provideTimeEnd . ' 23:59:59')]; } if ($verifyStatus != -1) { $conditions['verify_status'] = $verifyStatus; } - if ($status != -1) { - $conditions['status'] = $status; + if ($provideStatus != -1) { + $conditions['provide_status'] = $provideStatus; } if ($account) { $user = M('user', 'tab_')->field(['id'])->where('account like ' . $account . '%')->find(); @@ -259,6 +261,18 @@ class TestingResourceController extends BaseController } } + $provideStatusList = [ + '0' => '待发放', + '1' => '已发放', + '2' => '拒绝', + '3' => '异常', + ]; + $verifyStatusList = [ + '0' => '未审核', + '1' => '审核通过', + '2' => '审核拒绝', + ]; + $records = []; foreach ($batches as $batch) { $roleKey = $this->getGameRoleId($batch['game_id'], $batch['role_id']); @@ -280,15 +294,19 @@ class TestingResourceController extends BaseController 'history_provide_amount' => 0.00, 'apply_amount' => $batch['apply_amount'], 'provide_amount' => $batch['provide_amount'], - 'verify_status_text' => $batch['verify_status'], - 'verify_time' => date('Y-m-d H:i:s', $batch['verify_time']), - 'status_text' => $batch['status'], - 'provide_status_text' => $batch['provide_status'], - 'provide_time' => date('Y-m-d H:i:s', $batch['provide_time']), + 'verify_status' => $batch['verify_status'], + 'verify_status_text' => $verifyStatusList[$batch['verify_status']], + 'verify_time' => $batch['verify_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['verify_time']), + 'provide_status' => $batch['provide_status'], + 'provide_status_text' => $provideStatusList[$batch['provide_status']], + 'provide_time' => $batch['provide_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['provide_time']), 'content' => $content, ]; } + $this->assign('provideStatusList', $provideStatusList); + $this->assign('servers', $this->getServersByGameId($gameId)); + $this->assign('games', $this->getGames()); $this->assign('count', $count); $this->assign('pagination', $pagination); $this->assign('records', $records); @@ -297,14 +315,53 @@ class TestingResourceController extends BaseController public function orders() { - $batchId = I('batch_id', 0); + $id = I('id', 0); + + $batch = M('testing_resource_batch', 'tab_')->where(['id' => $id])->find(); + + $role = M('user_play_info', 'tab_') + ->field(['id', 'game_name', 'server_name', 'role_name', 'game_role_id', 'user_account']) + ->where(['game_id' => $batch['game_id'], 'role_id' => $batch['role_id']]) + ->find(); + + $applyPromote = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => $batch['apply_promote_id']])->find(); + $promote = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => $role['apply_promote_id']])->find(); - $query = M('testing_resource_order', 'tab_')->where(['batch_id' => $batchId])->order('create_time desc')->select(); + $query = M('testing_resource_order', 'tab_')->where(['batch_id' => $id])->order('id desc'); list($orders, $pagination, $count) = $this->paginate($query); - /** - * @todo - */ + $provideStatusList = [ + '0' => '待发放', + '1' => '已发放', + '2' => '拒绝', + '3' => '异常', + ]; + $verifyStatusList = [ + '0' => '未审核', + '1' => '审核通过', + '2' => '审核拒绝', + ]; + foreach ($orders as $order) { + $records[] = [ + 'id' => $order['id'], + 'create_time' => $batch['create_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['create_time']), + 'game_name' => $role['game_name'], + 'user_account' => $role['user_account'], + 'server_name' => $role['server_name'], + 'role_name' => $role['role_name'], + 'apply_promote_account' => $applyPromote ? $applyPromote['account'] : '', + 'promote_account' => $promote['account'], + 'ref_name' => $order['ref_name'], + 'ref_amount' => $order['ref_amount'], + 'num' => $order['num'], + 'amount' => $order['num'] * $order['ref_amount'], + 'remark' => $order['remark'], + 'verify_status' => $batch['provide_status'], + 'verify_status_text' => $verifyStatusList[$batch['verify_status']], + 'provide_status' => $batch['provide_status'], + 'provide_status_text' => $provideStatusList[$batch['provide_status']], + ]; + } $this->assign('count', $count); $this->assign('pagination', $pagination); @@ -474,6 +531,7 @@ class TestingResourceController extends BaseController 'order_no' => $orderNo, 'ref_id' => $record['resource_id'], 'ref_name' => $record['resource_name'], + 'ref_amount' => $record['value'], 'num' => $record['num'], 'amount' => $record['num'] * $record['value'], 'remark' => $record['remark'], @@ -561,16 +619,32 @@ class TestingResourceController extends BaseController return $this->ajaxReturn(['status' => 1, 'message' => '绑定成功']); } - public function getServers() + private function getGames() { - $gameId = I('game_id', 0); + $map = [ + 'id' => ['in', [229, 230]] + ]; + return M('game', 'tab_')->field('id,game_name')->where($map)->select(); + } + + private function getServersByGameId($gameId = 0) + { + if ($gameId == 0) { + return []; + } $map = []; $map['game_id'] = $gameId; - $servers = M('server', 'tab_') + return M('server', 'tab_') ->field('id,server_name,server_id') ->where($map) ->order('server_id asc') - ->select(); + ->select(); + } + + public function getServers() + { + $gameId = I('game_id', 0); + $servers = $this->getServersByGameId($gameId); return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['servers' => $servers]]); } @@ -658,9 +732,4 @@ class TestingResourceController extends BaseController } return $resources; } - - private function getRemainAmount($user) - { - - } } \ No newline at end of file diff --git a/Application/Home/View/default/TestingResource/apply.html b/Application/Home/View/default/TestingResource/apply.html index 3820eb0ce..f41475531 100644 --- a/Application/Home/View/default/TestingResource/apply.html +++ b/Application/Home/View/default/TestingResource/apply.html @@ -547,13 +547,9 @@ dataType: 'json', success: function(result){ if (result.status == 1) { - var servers = result.data.servers - var html = ""; - for (var i in servers) { - html += "" - } - $("#server-select").html(html); - $("#server-select").select2(); + layer.msg(result.message, function(){ + parent.window.location.href = parent.window.location.href + }) } else { layer.msg(result.message) } diff --git a/Application/Home/View/default/TestingResource/batches.html b/Application/Home/View/default/TestingResource/batches.html index f72bf852d..32889d618 100644 --- a/Application/Home/View/default/TestingResource/batches.html +++ b/Application/Home/View/default/TestingResource/batches.html @@ -40,51 +40,56 @@
+
+ +
- +
- +
- +
-
- -
- -
- + + + + - +
- - - - + + +
- - - @@ -102,7 +107,7 @@ 测试账号 手机号 所属推广员 - 申请人 + 申请人 发放总金额 申请金额 发放金额 @@ -192,6 +197,22 @@ $().ready(function(){ formatDate:'Y-m-d', timepicker:false }); + + $('.view-detail').on({ + click:function () { + var url = "{:U('TestingResource/orders', '', '')}" + var id = $(this).parents('tr').eq(0).attr('data-id') + url += '/id/' + id + layer.open({ + title: '查看申请订单', + type: 2, + content: [url , 'no'], + area: ['1200px', '400px'], + zIndex: 250, + scrollbar: false, + }) + } + }) });