查看“Notify wx.php”的源代码
←
Notify wx.php
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
<?php /** * Created by PhpStorm. * User: Administrator * Date: 2016/1/27 * Time: 21:56 */ define('IN_API', true); define('CURSCRIPT', 'api'); define('DISABLEXSSCHECK', true); require_once '../../../source/class/class_core.php'; $discuz = C::app(); $discuz->init(); $_G['siteurl'] = str_replace('source/plugin/xigua_re/', '',$_G['siteurl'] ); require_once 'common.php'; //ini_set('display_errors', 1); //error_reporting(E_ALL ^ E_NOTICE); //$re = WxPayApi::promotion('201602022028434331035', 'ohvWAwxEy3M9CvZB5J4HFDuOk8Nc', 100, 'test'); //$re['return_msg'] = diconv($re['return_msg'],'UTF-8', CHARSET); //$re['err_code_des'] = diconv($re['err_code_des'],'UTF-8', CHARSET); //var_dump($re); //if($re['return_code'] == 'SUCCESS'){ //}else{ // //} $notifydata = re_notifycheck(); if($notifydata['validator']) { $order_id = $notifydata['order_no']; $postprice = $notifydata['price']; $order = C::t('#xigua_re#xgre_order')->fetch_by_order_id($order_id); if( $order && $order['paystatus'] == table_xgre_order::PAYWAIT && $order['sendstatus'] == table_xgre_order::SENDWAIT ) { $shui = intval(round($postprice*($config['bili']/100))); $getprice = $postprice - $shui; C::t('#xigua_re#xgre_order')->finish_order_pay($order_id, $getprice, $notifydata['fromopenid']); C::t('#xigua_re#xgre_user')->update_notsettled($getprice, $order['touid']); if($getprice>= 100 && $order['toopenid'] && $getprice>= ($config['min_t']*100)){ $re = WxPayApi::promotion($order['order_id'], $order['toopenid'], $getprice, diconv(lang('plugin/xigua_re','datixian'), CHARSET, 'UTF-8')); if(is_array($re['return_msg'])){ $re['return_msg'] = var_export($re['return_msg'], TRUE); } $re['return_msg'] = diconv($re['return_msg'],'UTF-8', CHARSET); $re['err_code_des'] = diconv($re['err_code_des'],'UTF-8', CHARSET); $re['err_code_des'] = str_replace(lang('plugin/xigua_re','reeorcode'), lang('plugin/xigua_re','lianxi'), $re['err_code_des']); $re['return_msg'] = str_replace(lang('plugin/xigua_re','reeorcode'), lang('plugin/xigua_re','lianxi'), $re['return_msg']); if($re['result_code'] == 'SUCCESS'){ C::t('#xigua_re#xgre_user')->update_settled($getprice, $order['touid']); } C::t('#xigua_re#xgre_tixian')->log( $getprice, $order['toopenid'], $order['touid'], $re['result_code'], $re['err_code_des'], $re['return_msg'] ); } // notification_add($order['uid'], 'credit', 'addfunds', array( // 'order_id' => $order['order_id'], // 'price' => $order['price'], // 'value' => $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['title'].' '.$order['amount'].' '.$_G['setting']['extcredits'][$_G['setting']['creditstrans']]['unit'] // ), 1); if($order['fromuid']){ $fromusername = DB::result_first('SELECT username FROM %t WHERE uid=%d', array('common_member', $order['fromuid'])); } $from = $order['fromwx'] ? '<img style="width:20px;height:20px;vertical-align:middle" src="'.$order['fromwximg'].'"/> '.$order['fromwx'] : ($fromusername ?$fromusername: ($order['fromopenid'] ? $order['fromopenid'] : lang('plugin/xigua_re','niming'))); notification_add( $order['touid'], 'system', lang('plugin/xigua_re', 'noticel'), array( 'from' => $from, 'linkword' => $config['linkword'], 'url' => 'home.php?mod=spacecp&ac=plugin&id=xigua_re:setting', ), 1 ); } } function re_notifycheck() { global $_G; $msg = ''; $notify = WxPayApi::notify($msg); if(empty($notify)){ $return = array( 'return_code'=>'FAIL', 'return_msg'=>$msg, ); WxPayApi::replyNotify(arr2xml($return)); exit; } //checksign $sign = $notify['sign']; unset($notify['sign']); ksort($notify); $string = reToUrlParams($notify); $string = $string . "&key=".WxPayConfig::KEY; $string = md5($string); $result = strtoupper($string); if($result != $sign){ $return = array( 'return_code'=>'FAIL', 'return_msg'=> 'sign error!', ); WxPayApi::replyNotify(arr2xml($return)); exit; } if($notify['result_code'] == 'SUCCESS') { return array( 'validator' => isset($notify['result_code']) && $notify['result_code'] == 'SUCCESS' ? 1 : 0, 'order_no' => $notify['out_trade_no'], 'trade_no' => isset($notify['transaction_id']) ? $notify['transaction_id'] : '', 'price' => $notify['total_fee'], 'appid' => $notify['appid'], 'notify' => arr2xml(array('return_code'=>'SUCCESS')), 'location' => false, 'fromopenid' => $notify['openid'], ); } } function arr2xml($data){ $xml = "<xml>"; foreach ($data as $key=>$val) { if (is_numeric($val)){ $xml.="<".$key.">".$val."</".$key.">"; }else{ $xml.="<".$key."><![CDATA[".$val."]]></".$key.">"; } } $xml.="</xml>"; return $xml;
返回至
Notify wx.php
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
社区主页
新闻动态
最近更改
随机页面
帮助
华师附中老三届
站群链接
社友网(sn)
产品百科(cpwiki)
产品与服务(sn)
社区支持农业(sn)
工具
链入页面
相关更改
特殊页面
页面信息