Commit a96c3377 authored by liuyuzhen's avatar liuyuzhen

支付

parent 54e60e51
......@@ -45,6 +45,7 @@ class PayConst {
const wxAppNotifyUrl = '/pay/wxAppNotify.php';
const wxAppNotifyUrlService = '/pay/wxAppNotifyService.php';
const aliAppNotifyUrl = '/pay/aliAppNotify.php';
const wxLiteNotifyUrl = '/pay/wxLiteNotify.php';
const qPayNotifyUrl = '/pay/qPayNotify.php';
......
......@@ -21,6 +21,7 @@ class TencentPay {
protected $s_appid ='';
protected $s_key = '';
protected $s_mch_id ='';
protected $s_notify_url = '';
protected $prepay_id ='';
protected $tradeType = '';
public $data;//接收到的数据,类型为关联数组
......@@ -79,7 +80,7 @@ class TencentPay {
$this->parameters['sub_openid'] = $orderInfo['openid'];
}
$this->parameters['spbill_create_ip']=\Our\Common::getClientIp();
$this->parameters['notify_url']=$this->notify_url;
$this->parameters['notify_url']=$this->s_notify_url;
$this->parameters['trade_type']= $this->tradeType;
\Our\Log::getInstance()->write(json_encode($this->parameters),'/data/log/apptest');
//$this->parameters['openid']=$_SESSION['openid'];
......@@ -337,10 +338,13 @@ class TencentPay {
/**
* 获取notify信息
*/
public function getNotifyInfo() {
public function getNotifyInfo($serviceFlag=false) {
$xml = file_get_contents("php://input");
\Our\Log::getInstance()->write(json_encode($xml),'/data/log/apptest');
$this->saveData($xml);
if($serviceFlag){
$this->key= $this->s_key;
}
$verify = false;
if($this->checkSign() == FALSE){
$this->setReturnParameter("return_msg","签名失败");//返回信息
......
......@@ -25,6 +25,7 @@ class WxPay extends \Payment\TencentPay
$this->s_mch_id = \Our\PayConst::wxSPayMchId;
$this->s_key = \Our\PayConst::wxSPayKey;
$this->s_appid = \Our\PayConst::wxSPayAppId;
$this->s_notify_url = \Our\Common::getBaseUrl().\Our\PayConst::wxAppNotifyUrlService;
}
public function doPay($orderInfo)
......
......@@ -40,7 +40,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
/**
* app微信支付回调
*/
public function updateOrderToPayed($channel = \Our\NameConst::wxAppChannel){
public function updateOrderToPayed($channel = \Our\NameConst::wxAppChannel,$serviceFlag=false){
if($channel == \Our\NameConst::wxLiteChannel){
$wxpay = \Payment\WxLitePay::getInstance();
$param['pay_type'] = \Our\ApiConst::wxLitePayType;
......@@ -51,7 +51,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
$wxpay = \Payment\WxPay::getInstance();
$param['pay_type'] = \Our\ApiConst::wxAppPayType;
}
$callbackInfo = $wxpay->getNotifyInfo();
$callbackInfo = $wxpay->getNotifyInfo($serviceFlag);
\Our\Log::getInstance()->write(json_encode($callbackInfo),'/data/log/apptest');
if($callbackInfo) {
//验证成功
......
<?php
/**
* APP微信支付回调
* User: liuyuzhen
* Date: 2018/7/3
* Time: 15:23
* Description:
*/
include 'security.php';
date_default_timezone_set("Asia/Shanghai");
mb_internal_encoding("UTF-8");
define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../../'));
error_reporting(E_ALL);
define("APP_ENV",ini_get('yaf.environ'));
define("TIMESTAMP",time());
$app = new \Yaf\Application(APPLICATION_PATH . "/conf/application.ini");
$app->bootstrap();
$paymentService = \Business\Order\PaymentServiceModel::getInstance();
$paymentService->updateOrderToPayed(\Our\NameConst::wxAppChannel,true);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment