Commit 1123a6d0 by 冷斌

fix bug

parent faced26d
...@@ -22,10 +22,10 @@ class WxPayConfig ...@@ -22,10 +22,10 @@ class WxPayConfig
* 获取地址:https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=2005451881&lang=zh_CN * 获取地址:https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=2005451881&lang=zh_CN
* @var string * @var string
*/ */
const APPID = 'wx3645f04b42fe43b3'; const APPID = 'wx37327dbb9d7b33f3';
const MCHID = '1560085831'; const MCHID = '1587472431';
const KEY = 'mengyazhibo201900000000000000000'; const KEY = 'hkLfAAmPx6TxsinuyciefzFivk6yE4r4';
const APPSECRET = '4779b480b03c2fdad73073d10abd6b5f'; const APPSECRET = '7f8291af4e0795ee375f66487a721627';
//=======【证书路径设置】===================================== //=======【证书路径设置】=====================================
/** /**
......
...@@ -12,6 +12,19 @@ $log = Log::Init($logHandler, 15); ...@@ -12,6 +12,19 @@ $log = Log::Init($logHandler, 15);
class PayNotifyCallBack extends WxPayNotify 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) public function Queryorder($transaction_id)
{ {
...@@ -42,6 +55,7 @@ class PayNotifyCallBack extends WxPayNotify ...@@ -42,6 +55,7 @@ class PayNotifyCallBack extends WxPayNotify
$coin=$row['coin']+$row['coin_give']; $coin=$row['coin']+$row['coin_give'];
$link->query("update cmf_users set coin=coin+{$coin} where id='$row[touid]'"); $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']}"); $link->query("update cmf_users_charge set status='1',trade_no='{$transaction_id}' where id={$row['id']}");
share($link, $row['touid'], $coin);
Log::DEBUG("支付成功"); Log::DEBUG("支付成功");
}else{ }else{
Log::DEBUG($out_trade_no.' 订单信息不存在'); Log::DEBUG($out_trade_no.' 订单信息不存在');
......
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