From 65c5a221fc61457447c55e1501e99c1be92db1e9 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 21 Oct 2020 20:53:59 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Base/Service/PaymentRuleService.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Base/Service/PaymentRuleService.class.php b/Application/Base/Service/PaymentRuleService.class.php index 5b1596275..e6412c5dd 100644 --- a/Application/Base/Service/PaymentRuleService.class.php +++ b/Application/Base/Service/PaymentRuleService.class.php @@ -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()]); From fe55de4aaf28db39cd9713ad56d49bac06d8f8ac Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 21 Oct 2020 20:57:03 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/PaymentMerchantController.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index 5e89bcb4c..8ad732dad 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -675,6 +675,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, From dc5e032817316c35c6e585d094b4d848689265dd Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 22 Oct 2020 10:05:29 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/PaymentMerchantController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index 8ad732dad..0dfad5d2e 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -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'); From e25f30d13c4a0937d73b01fed20073c3e750d365 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 22 Oct 2020 11:53:50 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/PaymentMerchantController.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index 0dfad5d2e..a34b3029a 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -509,6 +509,11 @@ class PaymentMerchantController extends ThinkController 'message' => $message ]); } + + 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']; + } $ids = []; $paymentRuleService = new PaymentRuleService(); From 3a4fb5122230996506edbfe4766133d2b65e6273 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 22 Oct 2020 12:07:53 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=95=86=E6=88=B7=E8=A7=84=E5=88=99bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PaymentMerchantController.class.php | 10 +++++----- Application/Base/Service/PaymentRuleService.class.php | 9 +++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index a34b3029a..4d7996559 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -510,13 +510,10 @@ class PaymentMerchantController extends ThinkController ]); } - 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']; - } + $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'); @@ -747,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)) { diff --git a/Application/Base/Service/PaymentRuleService.class.php b/Application/Base/Service/PaymentRuleService.class.php index e6412c5dd..b320d1a5d 100644 --- a/Application/Base/Service/PaymentRuleService.class.php +++ b/Application/Base/Service/PaymentRuleService.class.php @@ -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; + } } \ No newline at end of file From 62d2eaef720d68b810d19dc2cbd2753cb9534693 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 22 Oct 2020 13:49:51 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=95=86=E6=88=B7?= =?UTF-8?q?=E8=A7=84=E5=88=99=E9=85=8D=E7=BD=AE=E5=88=A0=E9=99=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PaymentMerchantController.class.php | 13 +++++++++---- .../Admin/View/PaymentMerchant/ruleEditForm.html | 4 ++-- Application/Admin/View/PaymentMerchant/rules.html | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index 4d7996559..e55b1d99e 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -609,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']) { @@ -637,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() ]; @@ -667,6 +667,11 @@ class PaymentMerchantController extends ThinkController public function deleteRule() { + $this->ajaxReturn([ + 'status' => 0, + 'message' => '暂不支持删除' + ]); + $id = I('id', 0); $rule = M('payment_rule', 'tab_')->where(['id' => $id])->find(); diff --git a/Application/Admin/View/PaymentMerchant/ruleEditForm.html b/Application/Admin/View/PaymentMerchant/ruleEditForm.html index 3e2e21b84..eec8f5106 100644 --- a/Application/Admin/View/PaymentMerchant/ruleEditForm.html +++ b/Application/Admin/View/PaymentMerchant/ruleEditForm.html @@ -183,13 +183,13 @@ 生效时间(开始): - + 生效时间(结束): - + diff --git a/Application/Admin/View/PaymentMerchant/rules.html b/Application/Admin/View/PaymentMerchant/rules.html index ec786b695..7c1493f1c 100644 --- a/Application/Admin/View/PaymentMerchant/rules.html +++ b/Application/Admin/View/PaymentMerchant/rules.html @@ -175,7 +175,7 @@
编辑 - 删除 +
From ffad0d78c50c7fcc36f20435549bfcaf47b138f5 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 22 Oct 2020 14:10:19 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PaymentMerchantController.class.php | 5 -- .../Admin/View/PaymentMerchant/rules.html | 83 +++++-------------- 2 files changed, 23 insertions(+), 65 deletions(-) diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index e55b1d99e..da88a3dde 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -667,11 +667,6 @@ class PaymentMerchantController extends ThinkController public function deleteRule() { - $this->ajaxReturn([ - 'status' => 0, - 'message' => '暂不支持删除' - ]); - $id = I('id', 0); $rule = M('payment_rule', 'tab_')->where(['id' => $id])->find(); diff --git a/Application/Admin/View/PaymentMerchant/rules.html b/Application/Admin/View/PaymentMerchant/rules.html index 7c1493f1c..ade22a150 100644 --- a/Application/Admin/View/PaymentMerchant/rules.html +++ b/Application/Admin/View/PaymentMerchant/rules.html @@ -124,7 +124,6 @@
搜索 新增配置 -
+ 删除 @@ -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) }) } }) From 47ff398bf4dc9fd4e1a8efaf0ea94e3a8cc7ef04 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 22 Oct 2020 14:13:06 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/View/PaymentMerchant/ruleAddForm.html | 2 +- Application/Admin/View/PaymentMerchant/ruleEditForm.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Application/Admin/View/PaymentMerchant/ruleAddForm.html b/Application/Admin/View/PaymentMerchant/ruleAddForm.html index ec5b199f8..410c50af0 100644 --- a/Application/Admin/View/PaymentMerchant/ruleAddForm.html +++ b/Application/Admin/View/PaymentMerchant/ruleAddForm.html @@ -140,7 +140,7 @@ *游戏: - +