Merge pull request 'feature/testing_apply_top_promote' (#668) from feature/testing_apply_top_promote into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/668
master
廖金灵 2 years ago
commit 3cb4c8ab75

@ -438,6 +438,7 @@ class TestingResourceController extends ThinkController
}
$hasItf = 0;
$isEnableNum = 0;
$servers = [];
$bindingRole = null;
@ -469,6 +470,7 @@ class TestingResourceController extends ThinkController
$gameSetting = $repository->getGameSettingByGameId($role['game_id']);
$hasItf = $gameSetting ? $gameSetting['has_itf'] : 0;
$isEnableNum = $gameSetting ? $gameSetting['is_enable_num'] : 0;
}
$testingResourceService = new TestingResourceService();
@ -476,6 +478,7 @@ class TestingResourceController extends ThinkController
$games = M('game', 'tab_')->field(['id' , 'game_name'])->select();
$this->assign('isEnableNum', $isEnableNum);
$this->assign('hasItf', $hasItf);
$this->assign('games', $games);
$this->assign('servers', $servers);

@ -186,6 +186,7 @@ body {
<div class="clearfix" style="margin-top: 10px;">
<input id="hasItf" type="hidden" value="<?=$hasItf?>" name="has_itf">
<input id="isEnableNum" type="hidden" value="<?=$isEnableNum?>" name="is_enable_num">
<?php if ($hasItf):?>
<div class="form-group fl">
<select id="resource-type-select" name="resource_type_id" style="width:150px" class="select_gallery">
@ -204,8 +205,11 @@ body {
<p id="resource-amount" class="static-input">资源价值: --</p>
</div>
<div class="form-group fl">
<?php if ($isEnableNum):?>
<input id="num-input" type="text" name="num" class="txt normal_txt" placeholder="请输入资源数量" value="">
<?php else:?>
<p class="static-input">资源数量: 1</p>
<!-- <input id="num-input" type="text" name="num" class="txt normal_txt" id="uid" placeholder="请输入资源数量" value=""> -->
<?php endif;?>
</div>
<?php else:?>
<div class="form-group fl">
@ -289,6 +293,7 @@ body {
$(".select_gallery").select2()
var globalGameId = $('#game-select').val()
var hasItf = $('#hasItf').val()
var isEnableNum = $('#isEnableNum').val()
if (globalGameId > 0) {
initTable(globalGameId)
}
@ -465,8 +470,7 @@ body {
var resourceName = $('#resource-select option:selected').html()
var amount = $('#resource-select option:selected').attr('data-amount')
amount = amount == undefined ? '--' : amount
// var num = $('#num-input').val()
var num = 1
var num = isEnableNum == 1 ? $('#num-input').val() : 1
var remark = $('#remark-input').val()
if (resourceTypeId == '') {
@ -481,12 +485,15 @@ body {
if (!isNumber(num)) {
return layer.msg('资源数量只能为正整数')
}
if (num <= 0) {
return layer.msg('资源数量需要大于0')
}
var numReadonly = isEnableNum == 1 ? '' : 'readonly'
var html = '<tr class="normal-row" data-resource-id="' + resourceId + '" data-resource-type-id="' + resourceTypeId + '" >' +
'<td>' + resourceTypeName + '</td>' +
'<td>' + resourceName + '</td>' +
'<td class="amount">' + amount + '</td>' +
'<td class="num"><input name="num" type="text" value="' + num + '" readonly></td>' +
'<td class="num"><input name="num" type="text" value="' + num + '" ' + numReadonly + '></td>' +
'<td class="remark"><input name="remark" type="text" value="' + remark + '"></td>' +
'<td><button class="delete-row" type="button" class="danger-btn">删除</button></td>' +
'</tr>';

@ -488,7 +488,7 @@ class TestingResourceService
/**
* @todo 游戏猫只能每个资源数量只能为1
*/
if ($record['num'] != 1) {
if ($gameSetting['is_enable_num'] == 0 && $record['num'] != 1) {
throw new \Exception('该游戏每次申请单项资源数量只能为1');
}
}

@ -101,6 +101,7 @@ class LeyouClient
$data['type'] = 2;
} else {
$data['goods_id'] = $order['ref_id'];
$data['goods_num'] = $order['num'];
$data['type'] = 1;
}

@ -131,6 +131,7 @@ class TestingResourceController extends BaseController
}
$hasItf = 0;
$isEnableNum = 0;
$servers = [];
$bindingRole = null;
@ -161,11 +162,13 @@ class TestingResourceController extends BaseController
$repository = new TestingResourceRepository();
$gameSetting = $repository->getGameSettingByGameId($role['game_id']);
$hasItf = $gameSetting ? $gameSetting['has_itf'] : 0;
$isEnableNum = $gameSetting ? $gameSetting['is_enable_num'] : 0;
}
$testingResourceService = new TestingResourceService();
$quota = $testingResourceService->getRemainQuota($role, $bindingRole);
$this->assign('hasItf', $hasItf);
$this->assign('isEnableNum', $isEnableNum);
$games = M('game', 'tab_')->field(['id' , 'game_name'])->select();

@ -138,6 +138,7 @@
<?php endif;?>
<div class="clearfix" style="margin-top: 10px;">
<input id="hasItf" type="hidden" value="<?=$hasItf?>" name="has_itf">
<input id="isEnableNum" type="hidden" value="<?=$isEnableNum?>" name="is_enable_num">
<?php if ($hasItf):?>
<div class="form-group fl">
<select id="resource-type-select" name="resource_type_id" style="width:150px" class="select_gallery">
@ -156,8 +157,11 @@
<p id="resource-amount" class="static-input">资源价值: --</p>
</div>
<div class="form-group fl">
<?php if ($isEnableNum):?>
<input id="num-input" type="text" name="num" class="txt normal_txt" placeholder="请输入资源数量" value="">
<?php else:?>
<p class="static-input">资源数量: 1</p>
<!-- <input id="num-input" type="text" name="num" class="txt normal_txt" id="uid" placeholder="请输入资源数量" value=""> -->
<?php endif;?>
</div>
<?php else:?>
<div class="form-group fl">
@ -242,6 +246,7 @@
$(".select_gallery").select2()
var globalGameId = $('#game-select').val()
var hasItf = $('#hasItf').val()
var isEnableNum = $('#isEnableNum').val()
if (globalGameId > 0) {
initTable(globalGameId)
}
@ -418,8 +423,7 @@
var resourceName = $('#resource-select option:selected').html()
var amount = $('#resource-select option:selected').attr('data-amount')
amount = amount == undefined ? '--' : amount
// var num = $('#num-input').val()
var num = 1
var num = isEnableNum == 1 ? $('#num-input').val() : 1
var remark = $('#remark-input').val()
if (resourceTypeId == '') {
@ -434,12 +438,16 @@
if (!isNumber(num)) {
return layer.msg('资源数量只能为正整数')
}
if (num <= 0) {
return layer.msg('资源数量需要大于0')
}
var numReadonly = isEnableNum == 1 ? '' : 'readonly'
var html = '<tr class="normal-row" data-resource-id="' + resourceId + '" data-resource-type-id="' + resourceTypeId + '" >' +
'<td>' + resourceTypeName + '</td>' +
'<td>' + resourceName + '</td>' +
'<td class="amount">' + amount + '</td>' +
'<td class="num"><input name="num" type="text" value="' + num + '" readonly></td>' +
'<td class="num"><input name="num" type="text" value="' + num + '" ' + numReadonly + '></td>' +
'<td class="remark"><input name="remark" type="text" value="' + remark + '"></td>' +
'<td><button class="delete-row" type="button" class="danger-btn">删除</button></td>' +
'</tr>';
@ -465,7 +473,7 @@
})
$('#resource-table').on('blur', 'input[name=amount]', function() {
if($(this).val() == '') {
return layer.msg('请输入资源数量')
return layer.msg('请输入资源价值')
} else {
statQuota()
}

Loading…
Cancel
Save