|  | @@ -81,7 +81,6 @@ class Yspay extends Core
 | 
											
												
													
														|  |  	 */
 |  |  	 */
 | 
											
												
													
														|  |  	public function order($account_id, $project_id, $uid, $username, $product_id, $name, $cash, $openid = false, $type = 1, $order_id = false, $other = false)
 |  |  	public function order($account_id, $project_id, $uid, $username, $product_id, $name, $cash, $openid = false, $type = 1, $order_id = false, $other = false)
 | 
											
												
													
														|  |  	{
 |  |  	{
 | 
											
												
													
														|  | -		$trade_type = $this->getType($type);
 |  | 
 | 
											
												
													
														|  |  		$order_id = $this->createOrder($uid, $username, $account_id, $project_id, $product_id, $name, $cash, $this->config['type'], $order_id);
 |  |  		$order_id = $this->createOrder($uid, $username, $account_id, $project_id, $product_id, $name, $cash, $this->config['type'], $order_id);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  		if (isset($this->config['prefix']) && $this->config['prefix']) {
 |  |  		if (isset($this->config['prefix']) && $this->config['prefix']) {
 | 
											
										
											
												
													
														|  | @@ -126,19 +125,35 @@ class Yspay extends Core
 | 
											
												
													
														|  |  			$request['subOpenId'] = $openid;
 |  |  			$request['subOpenId'] = $openid;
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  		
 |  |  		
 | 
											
												
													
														|  | -		$result = Base::pay($request, $this->config);
 |  | 
 | 
											
												
													
														|  | -		if (isset($result['miniPayRequest'])) {
 |  | 
 | 
											
												
													
														|  | -			$result['request'] = $request;
 |  | 
 | 
											
												
													
														|  | -			$result['payMsg'] = $result['miniPayRequest'];
 |  | 
 | 
											
												
													
														|  | -			unset($result['miniPayRequest']);
 |  | 
 | 
											
												
													
														|  | -			if ($other) {
 |  | 
 | 
											
												
													
														|  | -				$result['other'] = $other;
 |  | 
 | 
											
												
													
														|  | 
 |  | +		if ($type == 2) {
 | 
											
												
													
														|  | 
 |  | +			# 二维码支付
 | 
											
												
													
														|  | 
 |  | +			$result = Base::get_pay_code($request, $this->config);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +			if (isset($result['billQRCode'])) {
 | 
											
												
													
														|  | 
 |  | +				$result['request'] = $request;
 | 
											
												
													
														|  | 
 |  | +				$result['payMsg'] = $result['billQRCode'];
 | 
											
												
													
														|  | 
 |  | +				if ($other) {
 | 
											
												
													
														|  | 
 |  | +					$result['other'] = $other;
 | 
											
												
													
														|  | 
 |  | +				}
 | 
											
												
													
														|  | 
 |  | +				$this->updateOrderParam($order_id, $result);
 | 
											
												
													
														|  | 
 |  | +				return $result['payMsg'];
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  | -			$this->updateOrderParam($order_id, $result);
 |  | 
 | 
											
												
													
														|  | -			return $result['payMsg'];
 |  | 
 | 
											
												
													
														|  |  		} else {
 |  |  		} else {
 | 
											
												
													
														|  | -			return false;
 |  | 
 | 
											
												
													
														|  | 
 |  | +			# 小程序支付
 | 
											
												
													
														|  | 
 |  | +			$result = Base::pay($request, $this->config);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +			if (isset($result['miniPayRequest'])) {
 | 
											
												
													
														|  | 
 |  | +				$result['request'] = $request;
 | 
											
												
													
														|  | 
 |  | +				$result['payMsg'] = $result['miniPayRequest'];
 | 
											
												
													
														|  | 
 |  | +				unset($result['miniPayRequest']);
 | 
											
												
													
														|  | 
 |  | +				if ($other) {
 | 
											
												
													
														|  | 
 |  | +					$result['other'] = $other;
 | 
											
												
													
														|  | 
 |  | +				}
 | 
											
												
													
														|  | 
 |  | +				$this->updateOrderParam($order_id, $result);
 | 
											
												
													
														|  | 
 |  | +				return $result['payMsg'];
 | 
											
												
													
														|  | 
 |  | +			}
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  | 
 |  | +		return false;
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	# 退款
 |  |  	# 退款
 | 
											
										
											
												
													
														|  | @@ -228,10 +243,10 @@ class Yspay extends Core
 | 
											
												
													
														|  |  	 */
 |  |  	 */
 | 
											
												
													
														|  |  	public function qrcode($order, $refer)
 |  |  	public function qrcode($order, $refer)
 | 
											
												
													
														|  |  	{
 |  |  	{
 | 
											
												
													
														|  | -		$notify = new \NativePay();
 |  | 
 | 
											
												
													
														|  | -		$result = $notify->GetPayUrl($order);
 |  | 
 | 
											
												
													
														|  | -		$url = $result['code_url'];
 |  | 
 | 
											
												
													
														|  | -		return $url;
 |  | 
 | 
											
												
													
														|  | 
 |  | +		$result['type'] = 'qrcode';
 | 
											
												
													
														|  | 
 |  | +		$result['url'] = $order;
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		return $result;
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	/**
 |  |  	/**
 | 
											
										
											
												
													
														|  | @@ -247,6 +262,7 @@ class Yspay extends Core
 | 
											
												
													
														|  |  			$result['prepay_id'] = $prepay_id;
 |  |  			$result['prepay_id'] = $prepay_id;
 | 
											
												
													
														|  |  			$result['sign_type'] = $order['signType'];
 |  |  			$result['sign_type'] = $order['signType'];
 | 
											
												
													
														|  |  			$result['sign'] = $order['paySign'];
 |  |  			$result['sign'] = $order['paySign'];
 | 
											
												
													
														|  | 
 |  | +			$result['type'] = 'applet';
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  		return $result;
 |  |  		return $result;
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
										
											
												
													
														|  | @@ -297,29 +313,6 @@ class Yspay extends Core
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  		return $html;
 |  |  		return $html;
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -	private function getType($type)
 |  | 
 | 
											
												
													
														|  | -	{
 |  | 
 | 
											
												
													
														|  | -		switch ($type) {
 |  | 
 | 
											
												
													
														|  | -			case 1:
 |  | 
 | 
											
												
													
														|  | -				$type = 'JSAPI';
 |  | 
 | 
											
												
													
														|  | -				break;
 |  | 
 | 
											
												
													
														|  | -			
 |  | 
 | 
											
												
													
														|  | -			case 2:
 |  | 
 | 
											
												
													
														|  | -				$type = 'NATIVE';
 |  | 
 | 
											
												
													
														|  | -				break;
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -			case 3:
 |  | 
 | 
											
												
													
														|  | -				$type = 'APP';
 |  | 
 | 
											
												
													
														|  | -				break;
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -			case 4:
 |  | 
 | 
											
												
													
														|  | -				$type = 'MWEB';
 |  | 
 | 
											
												
													
														|  | -				break;
 |  | 
 | 
											
												
													
														|  | -		}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -		return $type;
 |  | 
 | 
											
												
													
														|  | -	}
 |  | 
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  class Base
 |  |  class Base
 | 
											
										
											
												
													
														|  | @@ -352,6 +345,9 @@ class Base
 | 
											
												
													
														|  |  	# 订单关闭
 |  |  	# 订单关闭
 | 
											
												
													
														|  |  	static $close_url = 'v1/netpay/close';
 |  |  	static $close_url = 'v1/netpay/close';
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +	# 二维码支付
 | 
											
												
													
														|  | 
 |  | +	static $qrcode_url = 'v1/netpay/bills/get-qrcode';
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	//===================== 支付相关 ==============================
 |  |  	//===================== 支付相关 ==============================
 | 
											
												
													
														|  |  	/**
 |  |  	/**
 | 
											
										
											
												
													
														|  | @@ -365,6 +361,17 @@ class Base
 | 
											
												
													
														|  |  		return $result;
 |  |  		return $result;
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +	/**
 | 
											
												
													
														|  | 
 |  | +	 * 获取支付二维码
 | 
											
												
													
														|  | 
 |  | +	 */
 | 
											
												
													
														|  | 
 |  | +	static public function get_pay_code($param, $config)
 | 
											
												
													
														|  | 
 |  | +	{
 | 
											
												
													
														|  | 
 |  | +		$url = self::$qrcode_url;
 | 
											
												
													
														|  | 
 |  | +		$result = self::get($url, $param, $config);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		return $result;
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  	/**
 |  |  	/**
 | 
											
												
													
														|  |  	 * 支付撤销
 |  |  	 * 支付撤销
 | 
											
												
													
														|  |  	 */
 |  |  	 */
 |