master
ELF 4 years ago
parent fa90dc0bc8
commit 66bffbff99

@ -26,9 +26,9 @@ class GameApiController extends Think {
'sdk_version' => 1, 'sdk_version' => 1,
]; ];
$order = [ $order = [
'ref_amount' => 10, 'ref_amount' => 100,
'ref_id' => '8', 'ref_id' => '10',
'remark' => 'ELF测试资源发放', 'remark' => 'ELF测试资源发放1',
'order_no' => date('YmdHis') . rand(1000, 9999) . '_1', 'order_no' => date('YmdHis') . rand(1000, 9999) . '_1',
]; ];
$service = new TestingResourceService(); $service = new TestingResourceService();

@ -77,9 +77,10 @@ class TestingResourceController extends BaseController
$users = []; $users = [];
$bindings = []; $bindings = [];
$bindingRoles = []; $bindingRoles = [];
$applyRecords = [];
if (count($roles) > 0) { if (count($roles) > 0) {
$users = M('user', 'tab_')->field(['id', 'phone'])->where(['id' => ['in', $userIds]])->select(); $users = M('user', 'tab_')->field(['id', 'phone', 'lock_status'])->where(['id' => ['in', $userIds]])->select();
$uesrs = index_by_column('id', $users); $users = index_by_column('id', $users);
$bindingRows = M('testing_binding', 'tab_')->where(['_string' => implode(' or ', $bindingOrWhere)])->select(); $bindingRows = M('testing_binding', 'tab_')->where(['_string' => implode(' or ', $bindingOrWhere)])->select();
$bindingRoleIds = []; $bindingRoleIds = [];
foreach ($bindingRows as $bindingRow) { foreach ($bindingRows as $bindingRow) {
@ -93,6 +94,56 @@ class TestingResourceController extends BaseController
->select(); ->select();
$bindingRoles = index_by_column('game_role_id', $bindingRoles); $bindingRoles = index_by_column('game_role_id', $bindingRoles);
} }
$verifyItems = M('testing_resource_batch', 'tab_')
->field('sum(apply_amount) amount, game_id, role_id')
->where([
'verify_status' => 0,
'_string' => implode(' or ', $bindingOrWhere)
])
->group('game_id,role_id')->select();
$verifyRecords = [];
foreach ($verifyItems as $item) {
$verifyRecords[$this->getGameRoleId($item['game_id'], $item['role_id'])] = $item['amount'] ;
}
$provideItems = M('testing_resource_batch', 'tab_')
->field('sum(provide_amount) amount, game_id, role_id')
->where([
'verify_status' => 1,
'_string' => implode(' or ', $bindingOrWhere)
])
->group('game_id,role_id')->select();
$provideRecords = [];
foreach ($provideItems as $item) {
$provideRecords[$this->getGameRoleId($item['game_id'], $item['role_id'])] = $item['amount'] ;
}
$todayProvideItems = M('testing_resource_batch', 'tab_')
->field('sum(provide_amount) amount, game_id, role_id')
->where([
'verify_status' => 1,
'_string' => implode(' or ', $bindingOrWhere),
'provide_time' => ['egt', strtotime(date('Y-m-d 00:00:00'))],
'provide_time' => ['elt', strtotime(date('Y-m-d 23:59:59'))],
])
->group('game_id,role_id')->select();
$todayProvideRecords = [];
foreach ($todayProvideItems as $item) {
$todayProvideRecords[$this->getGameRoleId($item['game_id'], $item['role_id'])] = $item['amount'] ;
}
$applyItems = M('testing_resource_batch', 'tab_')
->field('sum(apply_amount) amount, game_id, role_id')
->where([
'_string' => implode(' or ', $bindingOrWhere),
])
->group('game_id,role_id')->select();
$applyRecords = [];
foreach ($applyItems as $item) {
$applyRecords[$this->getGameRoleId($item['game_id'], $item['role_id'])] = $item['amount'] ;
}
} }
$spendItems = []; $spendItems = [];
if (count($bindingRoles) > 0) { if (count($bindingRoles) > 0) {
@ -132,11 +183,11 @@ class TestingResourceController extends BaseController
'base_quota' => $binding ? $binding['base_quota'] : 0, 'base_quota' => $binding ? $binding['base_quota'] : 0,
'other_quota' => $binding ? $binding['other_quota'] : 0, 'other_quota' => $binding ? $binding['other_quota'] : 0,
'quota' => $bindingRole && isset($spendItems[$bindingRole['game_role_id']]) ? $spendItems[$bindingRole['game_role_id']] : 0, 'quota' => $bindingRole && isset($spendItems[$bindingRole['game_role_id']]) ? $spendItems[$bindingRole['game_role_id']] : 0,
'verify_amount' => 0, 'verify_amount' => $verifyRecords[$role['game_role_id']] ?? 0,
'provide_amount' => 0, 'provide_amount' => $provideRecords[$role['game_role_id']] ?? 0,
'today_amount' => 0, 'today_amount' => $todayProvideRecords[$role['game_role_id']] ?? 0,
'apply_amount' => 0, 'apply_amount' => $applyRecords[$role['game_role_id']] ?? 0,
'status' => '可用', 'status' => $user && $user['lock_status'] == 1 ? '正常' : '锁定',
'create_time' => date('Y-m-d H:i:s', $role['create_time']) 'create_time' => date('Y-m-d H:i:s', $role['create_time'])
]; ];
} }
@ -469,7 +520,7 @@ class TestingResourceController extends BaseController
} }
$bindingRole = M('user_play_info', 'tab_') $bindingRole = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id', 'promote_id']) ->field(['id', 'role_id', 'user_id', 'promote_id', 'game_id'])
->where(['game_id' => $gameId, 'role_id' => $binding['bind_role_id']]) ->where(['game_id' => $gameId, 'role_id' => $binding['bind_role_id']])
->find(); ->find();
if (is_null($bindingRole)) { if (is_null($bindingRole)) {

@ -81,6 +81,10 @@
display: inline-block; display: inline-block;
margin-left: 10px; margin-left: 10px;
} }
.info-row button.bind-btn {
background: #409eff;
color: #fff;
}
</style> </style>
<div class="page-search normal_list promoteCoin-record-search" style="padding: 20px;"> <div class="page-search normal_list promoteCoin-record-search" style="padding: 20px;">
<div class="trunk-content article"> <div class="trunk-content article">
@ -124,7 +128,7 @@
<?php if($bindingRole):?> <?php if($bindingRole):?>
<button type="button">绑定角色: <?= $bindingRole['role_name']?></button> <button type="button">绑定角色: <?= $bindingRole['role_name']?></button>
<?php else:?> <?php else:?>
<button id="bind-btn" type="button">绑定玩家角色</button> <button id="bind-btn" class="bind-btn" type="button">绑定玩家角色</button>
<?php endif;?> <?php endif;?>
<div class="" style="display:inline-block; margin-left: 10px;"> <div class="" style="display:inline-block; margin-left: 10px;">
当前可用额度:<span id="quota" data-quota="<?=$quota?>"><?=$quota?></span> 待审核额度:<span id="verify-quota">0</span> 当前可用额度:<span id="quota" data-quota="<?=$quota?>"><?=$quota?></span> 待审核额度:<span id="verify-quota">0</span>
@ -354,6 +358,7 @@
var tr = $(this).parents('tr').eq(0) var tr = $(this).parents('tr').eq(0)
rowCount -- rowCount --
tr.remove() tr.remove()
statQuota()
}) })
$('#resource-table').on('blur', 'input[name=num]', function() { $('#resource-table').on('blur', 'input[name=num]', function() {
if($(this).val() == '') { if($(this).val() == '') {

Loading…
Cancel
Save