Ejemplo n.º 1
0
 public function orderWxDeliver($num = "")
 {
     if ($num != "") {
         header('Content-Type:text/html;charset=utf-8');
         $wetallroute = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
         //dump($wetallroute);exit;
         include $wetallroute . "/wxpay/config.php";
         //dump($config);exit;
         include $wetallroute . "/wxpay/lib.php";
         //取支付信息
         $zhifuhaoArr = M('order_merge')->where(array('orderid' => $num))->find();
         $zhifuhao = $zhifuhaoArr['mergeid'];
         $payinfoArr = M('wxpay_history')->where(array('out_trade_no' => $zhifuhao))->find();
         $parameter = array('appid' => $config['appId'], 'openid' => $payinfoArr['openid'], 'transid' => $payinfoArr['transaction_id'], 'out_trade_no' => $payinfoArr['out_trade_no'], 'deliver_timestamp' => mktime(), 'deliver_status' => '1', 'deliver_msg' => 'ok');
         //dump($parameter);exit;
         $wechat = new Wechat();
         //dump($wechat);exit;
         $result = $wechat->delivernotify($config, $parameter);
         //dump($result);exit;
         if ($result['errcode'] == 0 && $result['errmsg'] == 'ok') {
             //成功
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
<?php

/**
 * 发货通知
 * @author www.linauror.com
 * @copyright 2014
 */
include 'config.php';
include 'lib.php';
$wechat = new Wechat();
$parameter = array('appid' => $config['appId'], 'openid' => 'oX99MDgNcgwnz3zFN3DNmo8uwa-w', 'transid' => '111112222233333', 'out_trade_no' => '555666uuu', 'deliver_timestamp' => mktime(), 'deliver_status' => '1', 'deliver_msg' => 'ok');
$result = $wechat->delivernotify($config, $parameter);
if ($result['errcode']) {
    // 判断结果
    echo 'success';
} else {
    print_r($result);
}