diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index da88a3dde..b8139a14e 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -4,6 +4,7 @@ namespace Admin\Controller; use User\Api\UserApi as UserApi; use Base\Service\PaymentMerchantService; +use Base\Service\MerchantMainService; use Base\Service\PaymentRuleService; use Base\Service\PromoteCompanyService; use Base\Service\GameService; @@ -19,7 +20,8 @@ class PaymentMerchantController extends ThinkController $page = I('p', 1); $row = I('row', 10); $name = I('name', ''); - $mainName = I('main_name', ''); + // $mainName = I('main_name', ''); + $mainId = I('main_id', 0); $adminId = I('admin_id', 0); $channel = I('channel', 0); $account = I('account', ''); @@ -32,8 +34,8 @@ class PaymentMerchantController extends ThinkController if ($name != '') { $conditions['name'] = ['like', '%' . $name . '%']; } - if ($mainName != '') { - $conditions['main_name'] = ['like', '%' . $mainName . '%']; + if ($mainId != 0) { + $conditions['main_id'] = $mainId; } if ($account != '') { $conditions['account'] = ['like', '%' . $account . '%']; @@ -98,6 +100,8 @@ class PaymentMerchantController extends ThinkController $this->assign('ways', PaymentMerchantService::$ways); $this->assign('statusList', PaymentMerchantService::$statusList); $this->assign('channels', PaymentMerchantService::$channels); + $MerchantMainService = new MerchantMainService(); + $this->assign('merchantMain', $MerchantMainService->getSelectList()); $this->display(); } @@ -105,6 +109,8 @@ class PaymentMerchantController extends ThinkController { $this->meta_title = '添加收款商户'; $this->assign('channels', PaymentMerchantService::$channels); + $MerchantMainService = new MerchantMainService(); + $this->assign('merchantMain', $MerchantMainService->getSelectList()); $this->display('form'); } @@ -158,6 +164,8 @@ class PaymentMerchantController extends ThinkController $this->assign('record', $merchant); $this->assign('config', $config); $this->assign('ways', $ways); + $MerchantMainService = new MerchantMainService(); + $this->assign('merchantMain', $MerchantMainService->getSelectList()); $this->display('form'); } @@ -171,7 +179,7 @@ class PaymentMerchantController extends ThinkController $account = I('account', ''); $config = I('config', []); $ways = I('ways', []); - $mainName = I('main_name', ''); + $mainId = I('main_id', 0); if ($name == '') { $this->ajaxReturn([ @@ -179,10 +187,10 @@ class PaymentMerchantController extends ThinkController 'message' => '请输入支付配置名称', ]); } - if ($mainName == '') { + if ($mainId === 0) { $this->ajaxReturn([ 'status' => 0, - 'message' => '请输入商户商户主体', + 'message' => '请选择商户商户主体', ]); } if ($account == '') { @@ -205,6 +213,9 @@ class PaymentMerchantController extends ThinkController $paymentMerchantService = new PaymentMerchantService(); $waysValue = $paymentMerchantService->getWaysValue($ways); + $MerchantMainService = new MerchantMainService(); + $mainName = $MerchantMainService->getNameById($mainId); + $userAuth = session('user_auth'); $data = []; @@ -217,6 +228,7 @@ class PaymentMerchantController extends ThinkController $data['config'] = json_encode($config); $data['update_time'] = time(); $data['main_name'] = $mainName; + $data['main_id'] = $mainId; if ($id == 0) { $data['create_time'] = time(); $data['channel'] = $channel; @@ -233,6 +245,7 @@ class PaymentMerchantController extends ThinkController ]); } else { + $this->changeSpendPartnerType($mainId,$id); $data['identifier'] = $paymentMerchantService->getIdentifierByConfig($config, $merchant['channel']); M('payment_merchant', 'tab_')->where(['id' => $id])->save($data); @@ -252,6 +265,18 @@ class PaymentMerchantController extends ThinkController ]); } + private function changeSpendPartnerType($mainId,$merchantId) + { + $oldMainId = M('payment_merchant', 'tab_')->where(['id' => $merchantId])->getField("main_id"); + if($oldMainId != $mainId){ + //更改支付表 + $save = [ + 'partner_type'=>$mainId + ]; + M("Spend","tab_")->where("merchant_id = '{$merchantId}'")->save($save); + } + } + public function delete() diff --git a/Application/Admin/View/PaymentMerchant/form.html b/Application/Admin/View/PaymentMerchant/form.html index 23f07c87d..07f05a191 100644 --- a/Application/Admin/View/PaymentMerchant/form.html +++ b/Application/Admin/View/PaymentMerchant/form.html @@ -89,10 +89,20 @@ *商户主体: - + + + + + + *商户账号: diff --git a/Application/Admin/View/PaymentMerchant/list.html b/Application/Admin/View/PaymentMerchant/list.html index d7065264d..4ed0f859e 100644 --- a/Application/Admin/View/PaymentMerchant/list.html +++ b/Application/Admin/View/PaymentMerchant/list.html @@ -95,9 +95,19 @@
-
+ +
+
+ +
diff --git a/Application/Base/Service/MerchantMainService.class.php b/Application/Base/Service/MerchantMainService.class.php new file mode 100644 index 000000000..5aa9cb1e1 --- /dev/null +++ b/Application/Base/Service/MerchantMainService.class.php @@ -0,0 +1,16 @@ +getField("id,name",true); + } + public function getNameById($id) + { + return M("MerchantMain","tab_")->where("id = '{$id}'")->getField("name"); + } +} \ No newline at end of file