|
@@ -39,9 +39,6 @@ class Wechat extends Core
|
|
|
$order_id = $this->createOrder($uid, $username, $account_id, $project_id, $product_id, $name, $cash, $this->config->GetType(), $order_id);
|
|
|
$tools = new \JsApiPay($this->config);
|
|
|
|
|
|
- if ($openid != -1) {
|
|
|
- $openid = $openid ? $openid : $tools->GetOpenid();
|
|
|
- }
|
|
|
$input = new \WxPayUnifiedOrder();
|
|
|
$input->SetBody($name);
|
|
|
$input->SetAttach($name);
|
|
@@ -53,11 +50,16 @@ class Wechat extends Core
|
|
|
$input->SetNotify_url($this->config->GetNotifyUrl());
|
|
|
$input->SetTrade_type($trade_type);
|
|
|
$input->SetProduct_id($product_id);
|
|
|
- if ($openid != -1) {
|
|
|
+ if ($type != 4 && $openid != -1) {
|
|
|
+ $openid = $openid ? $openid : $tools->GetOpenid();
|
|
|
$input->SetOpenid($openid);
|
|
|
}
|
|
|
-
|
|
|
- if ($type == 1 || $type == 3) {
|
|
|
+
|
|
|
+ if ($type == 2) {
|
|
|
+ # 下单信息
|
|
|
+ $this->updateOrderParam($order_id, $input);
|
|
|
+ return $input;
|
|
|
+ } else {
|
|
|
$order = \WxPayApi::unifiedOrder($this->config, $input);
|
|
|
# 下单信息
|
|
|
$order['time'] = '' . time() . '';
|
|
@@ -66,10 +68,6 @@ class Wechat extends Core
|
|
|
unset($order['mch_id']);
|
|
|
$this->updateOrderParam($order_id, $order);
|
|
|
return $order;
|
|
|
- } else {
|
|
|
- # 下单信息
|
|
|
- $this->updateOrderParam($order_id, $input);
|
|
|
- return $input;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -141,6 +139,10 @@ class Wechat extends Core
|
|
|
*/
|
|
|
public function page($order, $refer)
|
|
|
{
|
|
|
+ if (isset($order['mweb_url'])) {
|
|
|
+ $order['mweb_url'] .= '&redirect_url=' . $refer;
|
|
|
+ return Dever::location($order['mweb_url']);
|
|
|
+ }
|
|
|
$refer = urldecode($refer);
|
|
|
$tools = new \JsApiPay($this->config);
|
|
|
$info = $tools->GetJsApiParameters($order);
|
|
@@ -197,6 +199,10 @@ class Wechat extends Core
|
|
|
case 3:
|
|
|
$type = 'APP';
|
|
|
break;
|
|
|
+
|
|
|
+ case 4:
|
|
|
+ $type = 'MWEB';
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
return $type;
|