From d60330a09338f0a05d8ede0e118a723f1071e388 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 16 Jun 2021 14:58:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=95=86=E6=88=B7=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PaymentMerchantController.class.php | 151 +++------ .../View/PaymentMerchant/effectiveRules.html | 289 ------------------ .../Admin/View/PaymentMerchant/rules.html | 15 +- 3 files changed, 43 insertions(+), 412 deletions(-) delete mode 100644 Application/Admin/View/PaymentMerchant/effectiveRules.html diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index 4a3148173..83a28ef38 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -396,10 +396,15 @@ class PaymentMerchantController extends ThinkController $alipayId = I('alipay_merchant_id', 0); $weixinId = I('weixin_merchant_id', 0); $expressId = I('express_merchant_id', 0); + $timeType = I('time_type', 1); + $export = I('export', 0); - $conditions = []; + $conditions = ["_string"=>"1=1"]; if ($companyBelong != -1) { - $conditions['company_belong'] = $companyBelong; + // $conditions['company_belong'] = $companyBelong; + $promoteCompanyIds = M("promote_company","tab_")->where("company_belong = '{$companyBelong}'")->getField("id",true); + $promoteCompanyIds = implode(",",$promoteCompanyIds); + $conditions['_string'].=" AND ( r.company_belong = {$companyBelong} or company_id in ({$promoteCompanyIds}) )"; } if ($companyId != 0) { $conditions['company_id'] = $companyId; @@ -422,7 +427,7 @@ class PaymentMerchantController extends ThinkController [$start, $end] = $this->getEffectiveTimeRange($startedAt, $endedAt); // var_dump($start, $end);die(); - $timeCondition = ' ((start_time >= ' . $start . ' AND start_time <= ' . $end . ') OR (start_time <= ' . $start . ' AND end_time >= ' . $end + $timeCondition = ' AND ((start_time >= ' . $start . ' AND start_time <= ' . $end . ') OR (start_time <= ' . $start . ' AND end_time >= ' . $end . ') OR (end_time >= ' . $start . ' AND end_time <= ' . $end . '))'; if (isset($conditions['_string'])) { $conditions['_string'] .= $timeCondition; @@ -430,16 +435,25 @@ class PaymentMerchantController extends ThinkController $conditions['_string'] = $timeCondition; } + if($timeType == 2){ + $now = strtotime(date("Y-m-d") . ' 00:00:00'); + $conditions['_string'] .= ' AND ( start_time <= ' . $now . " AND end_time >= {$now} )"; + } $paymentRuleService = new PaymentRuleService(); $gameService = new GameService(); $paymentMerchantService = new PaymentMerchantService(); $companyService = new PromoteCompanyService(); - $query = M('payment_rule', 'tab_')->where($conditions); + $query = M('payment_rule', 'tab_')->alias("r")->field("r.*,pc.company_belong pc_company_belong")->where($conditions)->join("tab_promote_company as pc on pc.id = r.company_id","left"); + $countQuery = clone $query; - - $items = $query->order('start_time desc')->page($page, $row)->select(); + if($export == 1){ + $items = $query->order('start_time desc')->select(); + }else{ + $items = $query->order('start_time desc')->page($page, $row)->select(); + } + $count = $countQuery->count(); $gameTypes = $gameService->getGameTypes(null, 'id,type_name'); @@ -457,7 +471,7 @@ class PaymentMerchantController extends ThinkController foreach ($items as $item) { $records[] = [ 'id' => $item['id'], - 'company_type_name' => $companyTypes[$item['company_belong']] ?? '--', + 'company_type_name' => $companyTypes[$item['company_belong']] ?? ($companyTypes[$item['pc_company_belong']] ?? '--') , 'company_name' => isset($companies[$item['company_id']]) ? $companies[$item['company_id']]['company_name'] : '--', 'game_name' => isset($games[$item['game_id']]) ? $games[$item['game_id']]['name'] : '--', 'game_type_name' => isset($gameTypes[$item['game_type_id']]) ? $gameTypes[$item['game_type_id']]['type_name'] : '--', @@ -470,6 +484,21 @@ class PaymentMerchantController extends ThinkController 'effective_time_display' => $paymentRuleService->getEffectiveTimeDisplay($item) ]; } + if($export == 1){ + data2csv($records,'支付商户配置',array( + "company_type_name"=>"公司类型", + "company_name"=>"推广公司", + "game_type_name"=>"游戏类型", + "game_name"=>"游戏产品", + "alipay_merchant_name"=>"支付宝支付配置", + "alipay_merchant_account"=>"商户账号", + "weixin_merchant_name"=>"微信支付配置", + "weixin_merchant_account"=>"商户账号", + 'express_merchant_name' => '快捷支付配置', + 'express_merchant_account' =>'商户账号', + 'effective_time_display'=>'生效时间' + )); + } $page = set_pagination($count, $row); if($page) { @@ -803,112 +832,4 @@ class PaymentMerchantController extends ThinkController ] ]); } - public function effectiveRules() - { - $page = I('p', 1); - $row = I('row', 10); - $companyBelong = I('company_belong', -1); - $companyId = I('company_id', 0); - $gameTypeId = I('game_type_id', 0); - $gameId = I('game_id', 0); - $startedAt = I('started_at', ''); - $endedAt = I('ended_at', ''); - $alipayId = I('alipay_merchant_id', 0); - $weixinId = I('weixin_merchant_id', 0); - $expressId = I('express_merchant_id', 0); - - $conditions = []; - if ($companyBelong != -1) { - $conditions['company_belong'] = $companyBelong; - } - if ($companyId != 0) { - $conditions['company_id'] = $companyId; - } - if ($gameTypeId != 0) { - $conditions['game_type_id'] = $gameTypeId; - } - if ($gameId != 0) { - $conditions['game_id'] = $gameId; - } - if ($alipayId != 0) { - $conditions['alipay_merchant_id'] = $alipayId; - } - if ($weixinId != 0) { - $conditions['weixin_merchant_id'] = $weixinId; - } - if ($expressId != 0) { - $conditions['express_merchant_id'] = $expressId; - } - - [$start, $end] = $this->getEffectiveTimeRange($startedAt, $endedAt); - // var_dump($start, $end);die(); - $timeCondition = ' ((start_time >= ' . $start . ' AND start_time <= ' . $end . ') OR (start_time <= ' . $start . ' AND end_time >= ' . $end - . ') OR (end_time >= ' . $start . ' AND end_time <= ' . $end . '))'; - if (isset($conditions['_string'])) { - $conditions['_string'] .= $timeCondition; - } else { - $conditions['_string'] = $timeCondition; - } - - - $paymentRuleService = new PaymentRuleService(); - $gameService = new GameService(); - $paymentMerchantService = new PaymentMerchantService(); - $companyService = new PromoteCompanyService(); - - $query = M('payment_rule', 'tab_')->where($conditions); - $countQuery = clone $query; - - $items = $query->order('start_time desc')->page($page, $row)->select(); - $count = $countQuery->count(); - - $gameTypes = $gameService->getGameTypes(null, 'id,type_name'); - $games = $gameService->getBaseGames(null, 'id,name'); - $companies = $companyService->getCompanies(null, 'id,company_name'); - $companyTypes = PromoteCompanyService::$belongs; - $merchantIds = array_merge( - array_column($items, 'alipay_merchant_id'), - array_column($items, 'weixin_merchant_id'), - array_column($items, 'express_merchant_id') - ); - $merchants = $paymentMerchantService->getMerchantsByIds($merchantIds, 'id,channel,name,account'); - - $records = []; - foreach ($items as $item) { - $records[] = [ - 'id' => $item['id'], - 'company_type_name' => $companyTypes[$item['company_belong']] ?? '--', - 'company_name' => isset($companies[$item['company_id']]) ? $companies[$item['company_id']]['company_name'] : '--', - 'game_name' => isset($games[$item['game_id']]) ? $games[$item['game_id']]['name'] : '--', - 'game_type_name' => isset($gameTypes[$item['game_type_id']]) ? $gameTypes[$item['game_type_id']]['type_name'] : '--', - 'alipay_merchant_name' => isset($merchants[$item['alipay_merchant_id']]) ? $merchants[$item['alipay_merchant_id']]['name'] : '系统默认商户', - 'alipay_merchant_account' => isset($merchants[$item['alipay_merchant_id']]) ? $merchants[$item['alipay_merchant_id']]['account'] : '系统默认商户', - 'weixin_merchant_name' => isset($merchants[$item['weixin_merchant_id']]) ? $merchants[$item['weixin_merchant_id']]['name'] : '系统默认商户', - 'weixin_merchant_account' => isset($merchants[$item['weixin_merchant_id']]) ? $merchants[$item['weixin_merchant_id']]['account'] : '系统默认商户', - 'express_merchant_name' => isset($merchants[$item['express_merchant_id']]) ? $merchants[$item['express_merchant_id']]['name'] : '系统默认商户', - 'express_merchant_account' => isset($merchants[$item['express_merchant_id']]) ? $merchants[$item['express_merchant_id']]['account'] : '系统默认商户', - 'effective_time_display' => $paymentRuleService->getEffectiveTimeDisplay($item) - ]; - } - - $page = set_pagination($count, $row); - if($page) { - $this->assign('_page', $page); - } - - $aliMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_ALIPAY); - $weixinMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_WEIXIN); - $expressMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_EXPRESS); - - $this->assign('aliMerchants', $aliMerchants); - $this->assign('weixinMerchants', $weixinMerchants); - $this->assign('expressMerchants', $expressMerchants); - - $this->assign('records', $records); - $this->assign('games', $games); - $this->assign('gameTypes', $gameTypes); - $this->assign('companyTypes', $companyTypes); - $this->assign('companies', $companies); - $this->display(); - } } diff --git a/Application/Admin/View/PaymentMerchant/effectiveRules.html b/Application/Admin/View/PaymentMerchant/effectiveRules.html deleted file mode 100644 index c5bc6c945..000000000 --- a/Application/Admin/View/PaymentMerchant/effectiveRules.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - - - - - - - - - -
- -
-
- -
-
- -
- -
- - -
- -
- -
-
- -
-
- -
-
- 搜索 -
- -
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
公司类型推广公司游戏类型游戏产品支付宝支付配置商户账号微信支付配置商户账号快捷支付配置商户账号生效时间
aOh! 暂时还没有内容!
{$data.company_type_name}{$data.company_name}{$data.game_type_name}{$data.game_name}{$data.alipay_merchant_name}{$data.alipay_merchant_account}{$data.weixin_merchant_name}{$data.weixin_merchant_account}{$data.express_merchant_name}{$data.express_merchant_account}{$data.effective_time_display}
-
-
-
- 导出 - {$_page|default=''} -
- - -
- - - - if(C('COLOR_STYLE')=='blue_color') echo ''; - - - - - - - - - \ No newline at end of file diff --git a/Application/Admin/View/PaymentMerchant/rules.html b/Application/Admin/View/PaymentMerchant/rules.html index 41a5c4d5c..235de46ca 100644 --- a/Application/Admin/View/PaymentMerchant/rules.html +++ b/Application/Admin/View/PaymentMerchant/rules.html @@ -48,10 +48,6 @@
@@ -100,6 +96,12 @@
+
+ +