作者 chencheng

cc3

... ... @@ -324,6 +324,9 @@ class Wechat extends Api
*/
public function notify(){
$app = WehcatModule::getInstance()->initWechatPay();
$xml = file_get_contents("php://input");
$xmljson= json_encode(simplexml_load_string($xml, 'SimplexmlElement', LIBXML_NOCDATA ));//将对象转换个JSON
Common::put_file_log('支付回调记录-微信支付回调信息',$xmljson, 'pay_notify', __CLASS__ . __FUNCTION__ . __LINE__);
$response = $app->handlePaidNotify(function($message, $fail){
// 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单
Common::put_file_log('支付成功-微信支付回调信息',json_encode($message), 'pay_notify', __CLASS__ . __FUNCTION__ . __LINE__);
... ... @@ -331,7 +334,15 @@ class Wechat extends Api
if ($message['return_code'] === 'SUCCESS' && $message['result_code'] === 'SUCCESS') {
$o_w["order_no"] = $out_trade_no;
$order_info = Db::name('verification_order')->where($o_w)->find();
$this->sales_distribution($order_info);
if($order_info['type'] != 2){
//1. 更改状态信息
$up['type'] = 2;
$up['paytime'] = time();
$up['payMode'] = '0';
Db::name('verification_order')->where($o_w)->update($up);
//2. 分销处理
$this->sales_distribution($order_info);
}
} else {
Common::put_file_log('支付失败-微信支付回调信息',json_encode($message), 'pay_notify', __CLASS__ . __FUNCTION__ . __LINE__);
}
... ...