Browse Source

Merge remote-tracking branch 'origin/yijia' into yijia

undefined
loumengning 4 years ago
parent
commit
0da0dcb74f
5 changed files with 19 additions and 10 deletions
  1. +1
    -1
      addons/epay/controller/Api.php
  2. +13
    -5
      addons/epay/library/Service.php
  3. +1
    -1
      addons/unishop/controller/Order.php
  4. +3
    -2
      addons/unishop/controller/Pay.php
  5. +1
    -1
      addons/unishop/uniapp/uni-shop/manifest.json

+ 1
- 1
addons/epay/controller/Api.php View File

@@ -92,7 +92,7 @@ class Api extends Controller
$orderData['method'] = 'mp';
$orderData['openid'] = $openid;
$payData = Service::submitOrder($orderData);
$payData = json_decode($payData, true);
// $payData = json_decode($payData, true);
if (!isset($payData['appId'])) {
$this->error("创建订单失败,请返回重试");
}


+ 13
- 5
addons/epay/library/Service.php View File

@@ -5,6 +5,7 @@ namespace addons\epay\library;
use addons\unishop\model\Config;
use Exception;
use think\Log;
use think\Request;
use think\Response;
use think\Session;
use Yansongda\Pay\Gateways\Alipay\Alipay;
@@ -96,8 +97,11 @@ class Service
Session::delete("openid");
Session::set("wechatorderdata", $params);
$url = addon_url('epay/api/wechat', [], true, true);
header("location:{$url}");
exit;
$result = [
"trade_type"=>"MWEB",
"mweb_url"=>$url
];
return $result;
} elseif ($request->isMobile()) {
$method = 'wap';
}
@@ -126,8 +130,12 @@ class Service
//手机网页支付,跳转
$params['spbill_create_ip'] = $request->ip(0, false);
$html = $pay->driver($type)->gateway('wap')->pay($params);
header("location:{$html}");
exit;
$result = [
"trade_type"=>"MWEB",
"mweb_url"=>$html,
"referer"=>Request::instance()->server('HTTP_REFERER')
];
return $result;
break;
case 'app':
//APP支付,直接返回字符串
@@ -153,7 +161,7 @@ class Service
}
}
//返回字符串
$html = is_array($html) ? json_encode($html) : $html;
// $html = is_array($html) ? json_encode($html) : $html;
return $html;
}



+ 1
- 1
addons/unishop/controller/Order.php View File

@@ -608,7 +608,7 @@ class Order extends Base
"order_id"=>$order['out_trade_no'],
"total_fee"=>$order['total_price'],
"refund_fee"=>$order['total_price'],
"name"=>$order['订单退款'],
"memo"=>'订单退款',
];
PayService::cancel($param,$order["pay_type"]);
$this->success("success",[]);


+ 3
- 2
addons/unishop/controller/Pay.php View File

@@ -99,15 +99,16 @@ class Pay extends Base
$trade_type = 'wap';
}
$params = [
'amount' => bcmul($order['total_price'], 100),
'amount' => $order['total_price'],
'orderid' => $order->out_trade_no,
'type' => "wechat",
'title' => $body,
'notifyurl' => Config::getByName('notify_url')['value'],
'returnurl' => Config::getByName('ali_return_url')['value'],
'trade_type' => $trade_type,

];
return Service::submitOrder($params);
$this->success("", Service::submitOrder($params));
} catch (Exception $e) {
$this->error($e->getMessage());
}


+ 1
- 1
addons/unishop/uniapp/uni-shop/manifest.json View File

@@ -63,7 +63,7 @@
},
"h5" : {
"title" : "宜家自购商城",
"domain" : "qdh.zhizhuchuxing.cn",
"domain" : "nwx.zhizhuchuxing.cn",
"router" : {
"base" : "/h5",
"mode" : "hash"


Loading…
Cancel
Save