Commit 1123a6d0 by 冷斌

fix bug

parent faced26d
......@@ -10,23 +10,23 @@ class WxPayConfig
/**
* TODO: 修改这里配置为您自己申请的商户信息
* 微信公众号信息配置
*
*
* APPID:绑定支付的APPID(必须配置,开户邮件中可查看)
*
*
* MCHID:商户号(必须配置,开户邮件中可查看)
*
*
* KEY:商户支付密钥,参考开户邮件设置(必须配置,登录商户平台自行设置)
* 设置地址:https://pay.weixin.qq.com/index.php/account/api_cert
*
*
* APPSECRET:公众帐号secert(仅JSAPI支付的时候需要配置, 登录公众平台,进入开发者中心可设置),
* 获取地址:https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=2005451881&lang=zh_CN
* @var string
*/
const APPID = 'wx3645f04b42fe43b3';
const MCHID = '1560085831';
const KEY = 'mengyazhibo201900000000000000000';
const APPSECRET = '4779b480b03c2fdad73073d10abd6b5f';
const APPID = 'wx37327dbb9d7b33f3';
const MCHID = '1587472431';
const KEY = 'hkLfAAmPx6TxsinuyciefzFivk6yE4r4';
const APPSECRET = '7f8291af4e0795ee375f66487a721627';
//=======【证书路径设置】=====================================
/**
* TODO:设置商户证书路径
......@@ -36,7 +36,7 @@ class WxPayConfig
*/
const SSLCERT_PATH = '../cert/apiclient_cert.pem';
const SSLKEY_PATH = '../cert/apiclient_key.pem';
//=======【curl代理设置】===================================
/**
* TODO:这里设置代理机器,只有需要代理的时候才设置,不需要代理,请设置为0.0.0.0和0
......@@ -46,7 +46,7 @@ class WxPayConfig
*/
const CURL_PROXY_HOST = "0.0.0.0";//"10.152.18.220";
const CURL_PROXY_PORT = 0;//8080;
//=======【上报信息配置】===================================
/**
* TODO:接口调用上报等级,默认紧错误上报(注意:上报超时间为【1s】,上报无论成败【永不抛出异常】,
......
......@@ -12,6 +12,19 @@ $log = Log::Init($logHandler, 15);
class PayNotifyCallBack extends WxPayNotify
{
public function share($link, $id, $coin)
{
$userSql = mysqli_query($link,"select * from cmf_users where id='$id' ");
$user = mysqli_fetch_assoc($userSql);
if ($user['pid'] > 0) {
$config = getConfig($link);
$invite_reward = !empty($config['invite_reward']) ? $config['invite_reward'] : 0;
$coin2 = ($coin * $invite_reward) / 100;
$c = (int)$coin2;
mysqli_query($link,"update cmf_users set i_votes=i_votes+{$c} where id={$user['pid']} ");
}
}
//查询订单
public function Queryorder($transaction_id)
{
......@@ -41,14 +54,15 @@ class PayNotifyCallBack extends WxPayNotify
if($row){
$coin=$row['coin']+$row['coin_give'];
$link->query("update cmf_users set coin=coin+{$coin} where id='$row[touid]'");
$link->query("update cmf_users_charge set status='1',trade_no='{$transaction_id}' where id={$row['id']}");
Log::DEBUG("支付成功");
$link->query("update cmf_users_charge set status='1',trade_no='{$transaction_id}' where id={$row['id']}");
share($link, $row['touid'], $coin);
Log::DEBUG("支付成功");
}else{
Log::DEBUG($out_trade_no.' 订单信息不存在');
}
}else{
Log::DEBUG("数据库链接失败");
}
}
}else{
$link = mysql_connect("mysql","zhibo","Rni43v7RpkWUP9FD");
if($link){
......@@ -61,29 +75,29 @@ class PayNotifyCallBack extends WxPayNotify
if($row){
$coin=$row['coin']+$row['coin_give'];
mysql_query("update cmf_users set coin=coin+{$coin} where id='$row[touid]'");
mysql_query("update cmf_users_charge set status='1',trade_no='{$transaction_id}' where id={$row['id']}");
Log::DEBUG("支付成功");
mysql_query("update cmf_users_charge set status='1',trade_no='{$transaction_id}' where id={$row['id']}");
Log::DEBUG("支付成功");
}else{
Log::DEBUG($out_trade_no.' 订单信息不存在');
}
}else{
Log::DEBUG("数据库链接失败");
}
}
}
return true;
}
return false;
}
//重写回调处理函数
public function NotifyProcess($data, &$msg)
{
Log::DEBUG("call back:" . json_encode($data));
$notfiyOutput = array();
if(!array_key_exists("transaction_id", $data)){
$msg = "输入参数不正确";
return false;
......
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