Merge branch 'hotfix/payment_merch_bug' of wmtx/platform into master

商户规则配置修改
master
万盟天下 4 years ago committed by Gogs
commit e18a61e8bb

@ -414,7 +414,7 @@ class PaymentMerchantController extends ThinkController
$query = M('payment_rule', 'tab_')->where($conditions);
$countQuery = clone $query;
$items = $query->order('id desc')->page($page, $row)->select();
$items = $query->order('start_time desc')->page($page, $row)->select();
$count = $countQuery->count();
$gameTypes = $gameService->getGameTypes(null, 'id,type_name');
@ -509,9 +509,11 @@ class PaymentMerchantController extends ThinkController
'message' => $message
]);
}
$paymentRuleService = new PaymentRuleService();
$records = $paymentRuleService->filterRecords($records);
$ids = [];
$paymentRuleService = new PaymentRuleService();
foreach ($records as $record) {
$startTime = $record['start_time'] == '' ? 0 : strtotime($record['start_time'] . ' 00:00:00');
$endTime = $record['end_time'] == '' ? PaymentRuleService::FOREVER_TIME : strtotime($record['end_time'] . ' 23:59:59');
@ -607,7 +609,7 @@ class PaymentMerchantController extends ThinkController
]);
}
$startTime = $params['start_time'] == '' ? 0 : strtotime($params['start_time'] . ' 00:00:00');
/* $startTime = $params['start_time'] == '' ? 0 : strtotime($params['start_time'] . ' 00:00:00');
$endTime = $params['end_time'] == '' ? PaymentRuleService::FOREVER_TIME : strtotime($params['end_time'] . ' 23:59:59');
if (date('Ymd', $rule['start_time']) <= date('Ymd') && $startTime != $rule['start_time']) {
@ -635,14 +637,14 @@ class PaymentMerchantController extends ThinkController
'status' => 0,
'message' => '最后生效时间在今日之前,不可修改'
]);
}
} */
$item = [
'alipay_merchant_id' => $params['alipay_merchant_id'],
'weixin_merchant_id' => $params['weixin_merchant_id'],
'express_merchant_id' => $params['express_merchant_id'],
'start_time' => $startTime,
'end_time' => $endTime,
// 'start_time' => $startTime,
// 'end_time' => $endTime,
'update_time' => time()
];
@ -675,6 +677,13 @@ class PaymentMerchantController extends ThinkController
]);
}
if ($rule['start_time'] < strtotime(date('Y-m-d 23:59:59', time()))) {
$this->ajaxReturn([
'status' => 0,
'message' => '该记录不可删除,规则开始时间包含今天或今天之前的时间。'
]);
}
M('payment_rule', 'tab_')->where(['id' => $id])->delete();
addOperationLog([
'op_type' => 2,
@ -735,6 +744,9 @@ class PaymentMerchantController extends ThinkController
$isRepat = false;
$paymentRuleService = new PaymentRuleService();
$records = $paymentRuleService->filterRecords($records);
foreach ($records as $record) {
$rules = $paymentRuleService->getTimeRepeatRules($record);
if (count($rules)) {

@ -140,7 +140,7 @@
<td class="l"><i class="mustmark">*</i>游戏:</td>
<td class="r">
<select name="game_id" id="game-select" class="select_gallery" multiple="multiple" style="width: 500px;">
<option value="0">所有游戏</option>
<option value="0">所有游戏</option>
<?php foreach($games as $game):?>
<option value="<?=$game['id']?>"><?=$game['name']?></option>
<?php endforeach;?>

@ -140,7 +140,7 @@
<td class="l"><i class="mustmark">*</i>游戏:</td>
<td class="r">
<select name="game_id" id="game-select" class="select_gallery" style="width: 500px;" disabled>
<option value="0">所有游戏</option>
<option value="0">所有游戏</option>
<?php foreach($games as $game):?>
<option value="<?=$game['id']?>" <?php if($record['game_id']==$game['id']):?>selected<?php endif;?>><?=$game['name']?></option>
<?php endforeach;?>
@ -183,13 +183,13 @@
<tr>
<td class="l">生效时间(开始):</td>
<td class="r">
<input type="text" id="start_time" name="start_time" class="time" value="<?=$record['start_time']?>" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
<input type="text" id="start_time" name="start_time" disabled class="time" value="<?=$record['start_time']?>" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
</td>
</tr>
<tr>
<td class="l">生效时间(结束):</td>
<td class="r">
<input type="text" id="end_time" name="end_time" class="time" value="<?=$record['end_time']?>" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
<input type="text" id="end_time" name="end_time" disabled class="time" value="<?=$record['end_time']?>" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
</td>
</tr>
</tbody>

@ -124,7 +124,6 @@
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PaymentMerchant/rules')}">搜索</a>
<a class="sch-btn" style="width: 100px;" href="{:U('PaymentMerchant/addRule')}">新增配置</a>
<!-- <a class="sch-btn" href="javascript:;" id="batch-delete-btn">删除</a> -->
</div>
<!-- <div class="input-list">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>12,),I('get.')))}">导出</a>
@ -253,27 +252,6 @@
minView:'month',
maxView:'month',
});
$('#batch-delete-btn').on({
click: function() {
var ids = getIds();
$.ajax({
url: '{:U("batchDelete")}',
type: 'post',
dataType: 'json',
data: {ids: ids},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
function getIds() {
var ids = [];
$('.ids:checked').each(function() {
@ -281,45 +259,30 @@
})
return ids;
}
$('.delete-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id');
$.ajax({
url: '{:U("deleteRule")}',
type: 'post',
dataType: 'json',
data: {id: id},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
function deleteRule(id) {
$.ajax({
url: '{:U("deleteRule")}',
type: 'post',
dataType: 'json',
data: {id: id},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
})
}
})
$('.cancel-btn').on({
}
})
}
$('.delete-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id');
$.ajax({
url: '{:U("cancel")}',
type: 'post',
dataType: 'json',
data: {id: id},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
var id = $(this).parents('tr').eq(0).attr('data-id')
layer.confirm('确定要删除该规则 ?请确保删除后时间范围内规则完整!', {icon: 3, title:'提示'}, function(index){
deleteRule(id)
})
}
})

@ -70,7 +70,7 @@ class PaymentRuleService
}
if ($length == 1) {
$first = $repeatRules[0];
if ($startTime <= $first['start_time'] && $endTime >= $last['end_time']) {
if ($startTime <= $first['start_time'] && $endTime >= $first['end_time']) {
M('payment_rule', 'tab_')->where(['id' => $first['id']])->delete();
} elseif ($endTime < $first['end_time'] && $startTime <= $first['start_time']) {
M('payment_rule', 'tab_')->where(['id' => $first['id']])->save(['start_time' => $endTime + 1, 'update_time' => time()]);
@ -109,4 +109,13 @@ class PaymentRuleService
}
}
}
public function filterRecords($records)
{
foreach ($records as $key => $record) {
$records[$key]['company_belong'] = $record['company_id'] > 0 ? -1 : $record['company_belong'];
$records[$key]['game_type_id'] = $record['game_id'] > 0 ? 0 :$record['game_type_id'];
}
return $records;
}
}
Loading…
Cancel
Save