source/index/recharge_wxpay_app.ctrl.php

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
class recharge_wxpay_appControl extends skymvc{
	
	public function __construct(){
		parent::__construct();
	}
	
	public function onDefault(){
		
	}
	public function getWeixin(){
			$wid=get_post('wid','i');
			if($wid){
			$where=" id=".$wid;
			}else{
			$where=" status=1 ";
			}
			$wx=M("open_wxnative")->selectRow(array("where"=>$where,"order"=>"id DESC"));
			return $wx;
	}
	
	public function onPayUrl(){
		$orderno=get('orderno','h');
		$INWXAPP=false;		
		require_once ROOT_PATH."api/wxpay/lib/WxPay.Config.php";
		$wx=$this->getWeixin();
		if(empty($wx)){
			exit("微信支付未配置");
		} 	
		WxPayConfig::init($wx);
		require_once  ROOT_PATH.'/api/wxpay/lib/WxPay.Api.php';
		require_once  ROOT_PATH."/api/wxpay/lib/WxPay.Data.php";
		// 获取支付金额
		$order=M("recharge")->selectRow(array("where"=>" orderno='".$orderno."' "));
		$subject=$body=$order["orderinfo"];
		$total=$order["money"]*100;
		$unifiedOrder = new WxPayUnifiedOrder();
		$unifiedOrder->SetBody($subject);//商品或支付单简要描述
		$unifiedOrder->SetOut_trade_no($orderno);
		$unifiedOrder->SetTotal_fee($total);
		$unifiedOrder->SetTrade_type("APP");
		$unifiedOrder->SetNotify_url(HTTP_HOST."/index.php/recharge_wxpay_app/notify/wid-{$wx['id']}/");
		$result = WxPayApi::unifiedOrder($unifiedOrder);
		if (is_array($result)) {
			header('Access-Control-Allow-Origin: *');
			header('Content-type: text/plain');
			$time_stamp = time();
			$pack	= 'Sign=WXPay';
			//输出参数列表
			$prePayParams =array();
			$prePayParams['appid']		=$result['appid'];
			$prePayParams['partnerid']	=$result['mch_id'];
			$prePayParams['prepayid']	=$result['prepay_id'];
			$prePayParams['noncestr']	=$result['nonce_str'];
			$prePayParams['package']	=$pack;
			$prePayParams['timestamp']	=$time_stamp;
			$prePayParams['sign']=WxPayResults::InitFromArray($prePayParams,true)->getSign();
			//echo json_encode($prePayParams);
			$data = WxPayResults::InitFromArray($prePayParams,true)->GetValues();
			 
后面还有 69 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。