diff --git a/Application/Admin/Controller/TransferMerchantController.class.php b/Application/Admin/Controller/TransferMerchantController.class.php new file mode 100644 index 000000000..b06a58498 --- /dev/null +++ b/Application/Admin/Controller/TransferMerchantController.class.php @@ -0,0 +1,105 @@ +TransferMerchant = D("TransferMerchant"); + parent::__construct(); + } + public function lists() + { + $this->assign('statementPaymentInfo', $this->TransferMerchant->getStatementPaymentInfo()); + $this->assign('underPaymentInfo', $this->TransferMerchant->getUnderPaymentInfo()); + $this->display(); + } + + public function edit() + { + $ways = I('ways', 0); + if ($ways == 0) { + $this->error('参数错误'); + } + $info = []; + if($ways == 1){ + $info = $this->TransferMerchant->getStatementPaymentInfo(); + }elseif($ways == 2){ + $info = $this->TransferMerchant->getUnderPaymentInfo(); + }else { + $this->error('参数错误'); + } + + $allaccount = $this->TransferMerchant->getField("id,account,name,main_name,is_free,config"); + foreach ($allaccount as $key => &$val) { + $config = json_decode($val["config"],true); + foreach ($config as $k => $v) { + $val[$k] = $v; + } + unset($val["config"]); + $val['is_free_str'] = $this->TransferMerchant::IS_FREE_STR[$val['is_free']]; + } + + $way_str = $this->TransferMerchant::WAY_STR[$ways]; + $this->meta_title = $way_str."设置"; + $this->assign('allaccount', $allaccount); + $this->assign('ways',$ways); + $this->assign('info',$info); + $this->assign('way_str', $way_str); + + $this->display('form'); + } + + + + public function save() + { + $id = I('id', 0); + $ways = I('ways',0); + if(empty($id) || empty($ways) || !in_array($ways,[1,2])){ + $this->ajaxReturn([ + 'status' => 0, + 'message' => '参数错误' + ]); + } + + if($ways == 1){ + $info = $this->TransferMerchant->getStatementPaymentInfo(); + } + if($ways == 2){ + $info = $this->TransferMerchant->getUnderPaymentInfo(); + } + + if($info['id'] != $id){ + $idinfo = $this->TransferMerchant->field("id,ways")->where("id = {$id}")->find(); + $idsave = [ + 'id'=>$id, + 'ways'=>$idinfo['ways']-0+$ways, + 'update_time'=>time() + ]; + $this->TransferMerchant->save($idsave); + //修改之前的 + $infosave = [ + 'id'=>$info['id'], + 'ways'=>$info['ways']-$ways, + 'update_time'=>time() + ]; + $this->TransferMerchant->save($infosave); + } + + $this->ajaxReturn([ + 'status' => 1, + 'message' => '保存成功' + ]); + } + + +} diff --git a/Application/Admin/Model/TransferMerchantModel.class.php b/Application/Admin/Model/TransferMerchantModel.class.php new file mode 100644 index 000000000..92a3c71bc --- /dev/null +++ b/Application/Admin/Model/TransferMerchantModel.class.php @@ -0,0 +1,62 @@ +"未启用", + "1"=>"线上对账打款", + "2"=>"线下打款", + "3"=>"通用一个账号" + ]; + const IS_FREE_STR = [ + "1"=>"官方自营接口(提现免手续费)", + "2"=>"官方接口" + ]; + const StatementPaymentWhere ="ways = 1 or ways = 3"; + const UnderPaymentWhere ="ways = 2 or ways = 3"; + public function getStatementPaymentInfo() + { + $res = $this->where(self::StatementPaymentWhere)->find(); + if($res){ + return $this->setInfoStr($res); + } + return false; + } + public function getUnderPaymentInfo() + { + $res = $this->where(self::UnderPaymentWhere)->find(); + if($res){ + return $this->setInfoStr($res); + } + return false; + } + public function setInfoStr($item) + { + $item["is_free_str"] = self::IS_FREE_STR[$item["is_free"]]; + return $item; + } + + public function getStatementPaymentConfig() + { + $res = $this->where(self::StatementPaymentWhere)->field("config")->find(); + if($res){ + return json_decode($res['config'],true); + } + return false; + } + + public function getUnderPaymentConfig() + { + $res = $this->where(self::UnderPaymentWhere)->field("config")->find(); + if($res){ + return json_decode($res['config'],true); + } + return false; + } + +} \ No newline at end of file diff --git a/Application/Admin/View/TransferMerchant/form.html b/Application/Admin/View/TransferMerchant/form.html new file mode 100644 index 000000000..3a40f775e --- /dev/null +++ b/Application/Admin/View/TransferMerchant/form.html @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
功能模块: + +
*账号: + +
商户主体: + +
支付账户名称: + +
接口类型: + +
APPID: + + +
alipayUserId: + + +
私钥: + +
+
+
+ +
+ +
+ + + 返回 + +
+
+
+ +
+ + + + \ No newline at end of file diff --git a/Application/Admin/View/TransferMerchant/lists.html b/Application/Admin/View/TransferMerchant/lists.html new file mode 100644 index 000000000..f378c94ed --- /dev/null +++ b/Application/Admin/View/TransferMerchant/lists.html @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
功能模块账号商户主体支付账号名称接口类型操作
线上对账打款--------{$statementPaymentInfo.account}{$statementPaymentInfo.main_name}{$statementPaymentInfo.name}{$statementPaymentInfo.is_free_str} + 编辑 +
线下打款--------{$underPaymentInfo.account}{$underPaymentInfo.main_name}{$underPaymentInfo.name}{$underPaymentInfo.is_free_str} + 编辑 +
+
+
+
+ + + + + \ No newline at end of file diff --git a/Application/Payment/Controller/ExcelPaymentController.class.php b/Application/Payment/Controller/ExcelPaymentController.class.php index ecf88ab41..13aea353f 100644 --- a/Application/Payment/Controller/ExcelPaymentController.class.php +++ b/Application/Payment/Controller/ExcelPaymentController.class.php @@ -346,12 +346,13 @@ class ExcelPaymentController extends BaseController } $count = M("ExcelStatementInfo","tab_")->field("sum(statement_money) statement_money")->where("id in ({$ids})")->find(); + $paymentInfo = D("Admin/TransferMerchant")->getUnderPaymentInfo(); $this->getAccountMoney(); - // dd($CompanyInfo); $this->assign("CompanyInfo",$CompanyInfo); $this->assign("mobile",$this->admininfo['mobile']); $this->assign("count",$count); + $this->assign("paymentInfo",$paymentInfo); $this->display(); // $this->display(); @@ -359,17 +360,21 @@ class ExcelPaymentController extends BaseController } public function getAccountMoney(){ Vendor("Alipay2020/Fund"); + $isCanPayment = true; if(empty(C("ALI_PAYMENT"))){ + $isCanPayment = false; $money = "测试站无法查看"; }else{ - $fund = new \Fund(C("ALI_PAYMENT")); + $fund = new \Fund(D("Admin/TransferMerchant")->getUnderPaymentConfig()); $money = $fund->account(); if($money !== -1){ $money = $money['amount']; }else{ + $isCanPayment = false; $money = "--"; } } + $this->assign("isCanPayment",$isCanPayment); $this->assign("money",$money); } //以下打款流程 @@ -392,7 +397,7 @@ class ExcelPaymentController extends BaseController } Vendor("Alipay2020/Fund"); - $fund = new \Fund(C("ALI_PAYMENT")); + $fund = new \Fund(D("Admin/TransferMerchant")->getUnderPaymentConfig()); $dbres = M("ExcelStatementInfo", "tab_")->where("id='{$id}'")->find(); $company_info = json_decode($dbres['company_info'], true); diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index 05b1d5812..a38362616 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -1261,31 +1261,37 @@ class PaymentController extends BaseController } $count = M("pay_statement_info","tab_")->field("sum(final_statement_money) statement_money")->where("id in ({$ids})")->find(); + $paymentInfo = D("Admin/TransferMerchant")->getUnderPaymentInfo(); $this->getAccountMoney(); // dd($CompanyInfo); $this->assign("CompanyInfo",$CompanyInfo); $this->assign("mobile",$this->admininfo['mobile']); $this->assign("count",$count); + $this->assign("paymentInfo",$paymentInfo); $this->display(); // $this->display(); } public function getAccountMoney(){ + Vendor("Alipay2020/Fund"); + $isCanPayment = true; if(empty(C("ALI_PAYMENT"))){ + $isCanPayment = false; $money = "测试站无法查看"; }else{ - $fund = new \Fund(C("ALI_PAYMENT")); + $fund = new \Fund(D("Admin/TransferMerchant")->getStatementPaymentConfig()); $money = $fund->account(); if($money !== -1){ $money = $money['amount']; }else{ + $isCanPayment = false; $money = "--"; } } - + $this->assign("isCanPayment",$isCanPayment); $this->assign("money",$money); } //以下打款流程 @@ -1308,7 +1314,7 @@ class PaymentController extends BaseController $this->ajaxReturn(["success"=>"配置错误,无法打款","data"=>["status"=>0]]); } Vendor("Alipay2020/Fund"); - $fund = new \Fund(C("ALI_PAYMENT")); + $fund = new \Fund(D("Admin/TransferMerchant")->getStatementPaymentConfig()); $dbres = M("pay_statement_info", "tab_")->where("id='{$id}'")->find(); $company_statement = M("company_statement_info", "tab_")->field("pay_check")->where(['id'=>$dbres['statement_info_id']])->find(); diff --git a/Application/Payment/View/ExcelPayment/showPayment.html b/Application/Payment/View/ExcelPayment/showPayment.html index 43c69a74d..ba09f164e 100644 --- a/Application/Payment/View/ExcelPayment/showPayment.html +++ b/Application/Payment/View/ExcelPayment/showPayment.html @@ -165,18 +165,30 @@ - -
- -
获取验证码
-
接收验证码手机:{$mobile}
-
- -
-
- 确认打款 + +
+
+ 支付宝账号:{$paymentInfo['account']}     接口类型:{$paymentInfo['is_free_str']}
+ + +
+ +
获取验证码
+
接收验证码手机:{$mobile}
+
+ + + +
+ 打款接口错误,无法打款 +
+
+ +