From 20664f3ff67347603f4ffc868e4b3a3d5987e467 Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Mon, 14 Nov 2022 00:19:56 +0800 Subject: [PATCH 1/2] =?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 | 104 +++++++ .../View/PaymentMerchant/masterForm.html | 162 ++++++++++ .../View/PaymentMerchant/masterRules.html | 285 ++++++++++++++++++ .../Base/Service/PaymentRuleService.class.php | 22 ++ 4 files changed, 573 insertions(+) create mode 100644 Application/Admin/View/PaymentMerchant/masterForm.html create mode 100644 Application/Admin/View/PaymentMerchant/masterRules.html diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index be98bf85f..0e4ec3abf 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -8,6 +8,7 @@ use Base\Service\MerchantMainService; use Base\Service\PaymentRuleService; use Base\Service\PromoteCompanyService; use Base\Service\GameService; +use Exception; use Think\Model; /** @@ -857,4 +858,107 @@ class PaymentMerchantController extends ThinkController ] ]); } + + public function editMaster() + { + $id = I('id', 0); + + $rule = null; + if ($id > 0) { + $rule = M('game_master_merchant_rule', 'tab_')->where(['id' => $id])->find(); + if (empty($rule)) { + $this->error('记录不存在'); + } + } + + $gameService = new GameService(); + $games = $gameService->getBaseGames(); + + $this->assign('games', $games); + $this->assign('rule', $rule); + $this->display('masterForm'); + } + + public function saveMasterRule() + { + try { + $params = I('post.'); + $service = new PaymentRuleService(); + $service->saveGameMasterMerchantRule($params); + + $this->ajaxReturn([ + 'status' => 1, + 'message' => '成功', + ]); + + } catch (Exception $e) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => $e->getMessage(), + ]); + } + } + + public function deleteMasterRule() + { + $id = I('post.id', 0); + M('game_master_merchant_rule', 'tab_')->where(['id' => $id])->delete(); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '删除成功', + ]); + } + + public function masterRules() + { + $page = I('p', 1); + $row = I('row', 10); + $baseGameId = I('base_game_id', 0); + $startedAt = I('started_at', '1970-01-01'); + $endedAt = I('ended_at', '9999-01-01'); + + $conditions = []; + if ($baseGameId != 0) { + $conditions['base_game_id'] = $baseGameId; + } + + $conditions['update_time'] = ['between', [strtotime($startedAt . ' 00:00:00'), strtotime($endedAt . ' 23:59:59')]]; + + $query = M('game_master_merchant_rule', 'tab_')->where($conditions); + $countQuery = clone $query; + + $items = $query->order('id desc')->page($page, $row)->select(); + $count = $countQuery->count(); + + $admins = M('ucenter_member', 'sys_')->field(['id', 'username'])->select(); + $admins = index_by_column('id', $admins); + + $records = []; + foreach ($items as $item) { + $records[] = [ + 'id' => $item['id'], + 'base_game_id' => $item['base_game_id'], + 'base_game_name' => $item['base_game_name'], + 'is_first_pay' => $item['is_first_pay'], + 'max_times' => $item['max_times'], + 'max_pay_amount' => $item['max_pay_amount'], + 'admin_username' => $admins[$item['admin_id']]['username'], + 'update_time' => date('Y-m-d H:i:s', $item['update_time']), + ]; + } + + + $page = set_pagination($count, $row); + if($page) { + $this->assign('_page', $page); + } + + $gameService = new GameService(); + $games = $gameService->getBaseGames(); + + $this->assign('games', $games); + $this->assign('records', $records); + $this->assign('admins', $admins); + $this->display(); + } } diff --git a/Application/Admin/View/PaymentMerchant/masterForm.html b/Application/Admin/View/PaymentMerchant/masterForm.html new file mode 100644 index 000000000..85ada2395 --- /dev/null +++ b/Application/Admin/View/PaymentMerchant/masterForm.html @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + +
*游戏: + +
*首充限制: + + + checked value="0"> 关闭 + +
*充值次数限制: + +
*充值次数限制: + " style="width: 150px"> +
+
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/Application/Admin/View/PaymentMerchant/masterRules.html b/Application/Admin/View/PaymentMerchant/masterRules.html new file mode 100644 index 000000000..8aff54ac2 --- /dev/null +++ b/Application/Admin/View/PaymentMerchant/masterRules.html @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+ +
+
+ + - +
+ + +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
游戏名称首充限制充值次数限制充值金额限制操作时间操作
aOh! 暂时还没有内容!
{$data.base_game_name}{$data.is_first_pay}{$data.max_times}{$data.max_pay_amount}{$data.update_time} +
+ 编辑 + 删除 +
+
+
+
+
+ + + + {$_page|default=''} +
+ + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + + + + \ No newline at end of file diff --git a/Application/Base/Service/PaymentRuleService.class.php b/Application/Base/Service/PaymentRuleService.class.php index b320d1a5d..f0294a2e4 100644 --- a/Application/Base/Service/PaymentRuleService.class.php +++ b/Application/Base/Service/PaymentRuleService.class.php @@ -2,6 +2,7 @@ namespace Base\Service; use Base\Facade\Request; +use Exception; class PaymentRuleService { @@ -118,4 +119,25 @@ class PaymentRuleService } return $records; } + + public function saveGameMasterMerchantRule($params) + { + if (empty($params['base_game_id'])) { + throw new Exception('请选择游戏'); + } + $data = [ + 'base_game_id' => $params['base_game_id'], + 'is_first_pay' => $params['is_first_pay'] ?: 0, + 'max_times' => $params['max_times'] ?: 0, + 'max_pay_amount' => $params['max_pay_amount'] ?: 0, + 'update_time' => time(), + ]; + + if (!empty($params['id'])) { + M('game_master_merchant_rule', 'tab_')->where(['id' => $params['id']])->save($data); + } else { + $data['create_time'] = time(); + M('game_master_merchant_rule', 'tab_')->add($data); + } + } } \ No newline at end of file From 20fd228cb315dd77fde38119d43f9d023c693c8c Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Tue, 15 Nov 2022 22:00:48 +0800 Subject: [PATCH 2/2] =?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/masterForm.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/View/PaymentMerchant/masterForm.html b/Application/Admin/View/PaymentMerchant/masterForm.html index 85ada2395..5a82744a6 100644 --- a/Application/Admin/View/PaymentMerchant/masterForm.html +++ b/Application/Admin/View/PaymentMerchant/masterForm.html @@ -117,7 +117,7 @@ - *充值次数限制: + *充值金额限制: " style="width: 150px">