提交 4b62e070 编写于 作者: D devil_gong

细节优化,微信支付方式更名

上级 727b91fa
...@@ -82,12 +82,6 @@ class OrderService ...@@ -82,12 +82,6 @@ class OrderService
return DataReturn('支付方式有误', -1); return DataReturn('支付方式有误', -1);
} }
// 配置信息
if(empty($payment[0]['config']))
{
return DataReturn('支付缺少配置', -1);
}
// 支付入口文件检查 // 支付入口文件检查
$pay_checked = PaymentService::EntranceFileChecked($payment[0]['payment'], 'order'); $pay_checked = PaymentService::EntranceFileChecked($payment[0]['payment'], 'order');
if($pay_checked['code'] != 0) if($pay_checked['code'] != 0)
...@@ -104,6 +98,10 @@ class OrderService ...@@ -104,6 +98,10 @@ class OrderService
$call_back_url = $url.'_respond.php'; $call_back_url = $url.'_respond.php';
} else { } else {
$call_back_url = MyUrl('index/order/respond', ['paymentname'=>$payment[0]['payment']]); $call_back_url = MyUrl('index/order/respond', ['paymentname'=>$payment[0]['payment']]);
if(stripos($call_back_url, '?') !== false)
{
$call_back_url = $url.'_respond.php';
}
} }
// 发起支付 // 发起支付
......
...@@ -194,6 +194,19 @@ class Alipay ...@@ -194,6 +194,19 @@ class Alipay
*/ */
public function Pay($params = []) public function Pay($params = [])
{ {
// 参数
if(empty($params))
{
return DataReturn('参数不能为空', -1);
}
// 配置信息
if(empty($this->config))
{
return DataReturn('支付缺少配置', -1);
}
// 手机/PC
if(IsMobile()) if(IsMobile())
{ {
$ret = $this->PayMobile($params); $ret = $this->PayMobile($params);
......
...@@ -116,6 +116,19 @@ class AlipayMini ...@@ -116,6 +116,19 @@ class AlipayMini
*/ */
public function Pay($params = []) public function Pay($params = [])
{ {
// 参数
if(empty($params))
{
return DataReturn('参数不能为空', -1);
}
// 配置信息
if(empty($this->config))
{
return DataReturn('支付缺少配置', -1);
}
// 支付参数
$parameter = array( $parameter = array(
'app_id' => $this->config['appid'], 'app_id' => $this->config['appid'],
'method' => 'alipay.trade.create', 'method' => 'alipay.trade.create',
......
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
namespace payment; namespace payment;
/** /**
* 微信小程序支付 * 微信支付
* @author Devil * @author Devil
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 1.0.0 * @version 1.0.0
* @date 2018-09-19 * @date 2018-09-19
* @desc description * @desc description
*/ */
class WeixinMini class Weixin
{ {
// 插件配置参数 // 插件配置参数
private $config; private $config;
...@@ -119,11 +119,18 @@ class WeixinMini ...@@ -119,11 +119,18 @@ class WeixinMini
*/ */
public function Pay($params = []) public function Pay($params = [])
{ {
// 参数
if(empty($params)) if(empty($params))
{ {
return DataReturn('参数不能为空', -1); return DataReturn('参数不能为空', -1);
} }
// 配置信息
if(empty($this->config))
{
return DataReturn('支付缺少配置', -1);
}
// 获取支付参数 // 获取支付参数
$ret = $this->GetPayParams($params); $ret = $this->GetPayParams($params);
if($ret['code'] != 0) if($ret['code'] != 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册