master
ELF 4 years ago
parent 8e4ba0e20e
commit 18c3e95f30

@ -401,6 +401,36 @@ body {
} }
}) })
function isFloat(num){
if(!num) {
return false
}
var strPreg = /^\d+(\.\d+)?$/;
if(!strPreg.test(num)) {
return false
}
try{
if(parseFloat(num) != num) {
return false
}
} catch(ex) {
return false
}
return true
}
function isNumber(num){
if(!num) {
return false
}
var strPreg = /^\d+$/
if(!strPreg.test(num)) {
return false
}
return true
}
function addRow() { function addRow() {
var remark = $('#remark-input').val() var remark = $('#remark-input').val()
var amount = $('#remark-amount').val() var amount = $('#remark-amount').val()
@ -410,6 +440,9 @@ body {
if (amount == '') { if (amount == '') {
return layer.msg('请输入资源价值') return layer.msg('请输入资源价值')
} }
if (!isNumber(amount)) {
return layer.msg('资源价值只能为正整数')
}
var html = '<tr class="normal-row" >' + var html = '<tr class="normal-row" >' +
'<td style="width:420px" class="remark"><input name="remark" type="text" style="width:400px" value="' + remark + '"></td>' + '<td style="width:420px" class="remark"><input name="remark" type="text" style="width:400px" value="' + remark + '"></td>' +
'<td class="amount"><input name="amount" type="text" value="' + amount + '"></td>' + '<td class="amount"><input name="amount" type="text" value="' + amount + '"></td>' +
@ -441,6 +474,9 @@ body {
if (num == '') { if (num == '') {
return layer.msg('请输入资源数量') return layer.msg('请输入资源数量')
} }
if (!isNumber(num)) {
return layer.msg('资源数量只能为正整数')
}
var html = '<tr class="normal-row" data-resource-id="' + resourceId + '" data-resource-type-id="' + resourceTypeId + '" >' + var html = '<tr class="normal-row" data-resource-id="' + resourceId + '" data-resource-type-id="' + resourceTypeId + '" >' +
'<td>' + resourceTypeName + '</td>' + '<td>' + resourceTypeName + '</td>' +

@ -290,6 +290,17 @@
$(".select_gallery").select2(); $(".select_gallery").select2();
}); });
function isNumber(num){
if(!num) {
return false
}
var strPreg = /^\d+$/
if(!strPreg.test(num)) {
return false
}
return true
}
$('#add-btn').click(function () { $('#add-btn').click(function () {
var box = $('#add-box') var box = $('#add-box')
@ -310,6 +321,14 @@
var baseGameId = box.find('[name=base_game_id]').val() var baseGameId = box.find('[name=base_game_id]').val()
var baseQuota = box.find('[name=base_quota]').val() var baseQuota = box.find('[name=base_quota]').val()
var rate = box.find('[name=rate]').val() var rate = box.find('[name=rate]').val()
if (!isNumber(baseQuota)) {
return layer.msg('初始额度只能为正整数')
}
if (!isNumber(rate)) {
return layer.msg('奖金池比例只能为正整数')
}
$.ajax({ $.ajax({
url: '{:U("saveGameSetting")}', url: '{:U("saveGameSetting")}',
type: 'post', type: 'post',

@ -307,11 +307,24 @@
zIndex: 250, zIndex: 250,
}) })
}) })
function isNumber(num){
if(!num) {
return false
}
var strPreg = /^\d+$/
if(!strPreg.test(num)) {
return false
}
return true
}
$('.set-quota-btn').click(function () { $('.set-quota-btn').click(function () {
var box = $('#other-quota-box') var box = $('#other-quota-box')
var tr = $(this).parents('tr').eq(0) var tr = $(this).parents('tr').eq(0)
var id = tr.attr('data-id') var id = tr.attr('data-id')
var otherQuota = tr.attr('data-other-quota') var otherQuota = tr.attr('data-other-quota')
if (!isNumber(otherQuota)) {
return layer.msg('额外额度只能为正整数')
}
box.find('[name=id]').val(id) box.find('[name=id]').val(id)
box.find('[name=other_quota]').val(otherQuota) box.find('[name=other_quota]').val(otherQuota)
layer.open({ layer.open({

@ -173,7 +173,7 @@ class TestingResourceController extends BaseController
$testingResourceService = new TestingResourceService(); $testingResourceService = new TestingResourceService();
$testingResourceService->apply($params, $loginPromote); $testingResourceService->apply($params, $loginPromote);
return $this->ajaxReturn(['status' => 1, 'message' => '申请成功,等待审核。']); return $this->ajaxReturn(['status' => 1, 'message' => '申请成功,等待审核。']);
} catch (\Throwable $e) { } catch (\Exception $e) {
return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]); return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]);
} }
} }
@ -186,7 +186,7 @@ class TestingResourceController extends BaseController
$testingResourceService = new TestingResourceService(); $testingResourceService = new TestingResourceService();
$testingResourceService->bindRole($params, $loginPromote); $testingResourceService->bindRole($params, $loginPromote);
return $this->ajaxReturn(['status' => 1, 'message' => '绑定成功']); return $this->ajaxReturn(['status' => 1, 'message' => '绑定成功']);
} catch (\Throwable $th) { } catch (\Exception $e) {
return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]); return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]);
} }
} }

@ -357,6 +357,36 @@
} }
}) })
function isFloat(num){
if(!num) {
return false
}
var strPreg = /^\d+(\.\d+)?$/;
if(!strPreg.test(num)) {
return false
}
try{
if(parseFloat(num) != num) {
return false
}
} catch(ex) {
return false
}
return true
}
function isNumber(num){
if(!num) {
return false
}
var strPreg = /^\d+$/
if(!strPreg.test(num)) {
return false
}
return true
}
function addRow() { function addRow() {
var remark = $('#remark-input').val() var remark = $('#remark-input').val()
var amount = $('#remark-amount').val() var amount = $('#remark-amount').val()
@ -366,6 +396,9 @@
if (amount == '') { if (amount == '') {
return layer.msg('请输入资源价值') return layer.msg('请输入资源价值')
} }
if (!isNumber(amount)) {
return layer.msg('资源价值只能为正整数')
}
var html = '<tr class="normal-row" >' + var html = '<tr class="normal-row" >' +
'<td style="width:420px" class="remark"><input name="remark" type="text" style="width:400px" value="' + remark + '"></td>' + '<td style="width:420px" class="remark"><input name="remark" type="text" style="width:400px" value="' + remark + '"></td>' +
'<td class="amount"><input name="amount" type="text" value="' + amount + '"></td>' + '<td class="amount"><input name="amount" type="text" value="' + amount + '"></td>' +
@ -397,6 +430,9 @@
if (num == '') { if (num == '') {
return layer.msg('请输入资源数量') return layer.msg('请输入资源数量')
} }
if (!isNumber(num)) {
return layer.msg('资源数量只能为正整数')
}
var html = '<tr class="normal-row" data-resource-id="' + resourceId + '" data-resource-type-id="' + resourceTypeId + '" >' + var html = '<tr class="normal-row" data-resource-id="' + resourceId + '" data-resource-type-id="' + resourceTypeId + '" >' +
'<td>' + resourceTypeName + '</td>' + '<td>' + resourceTypeName + '</td>' +

Loading…
Cancel
Save