作者 chencheng

cc3

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