Commit 12af4e82 by 冷斌

update

parent 7e8c937f
......@@ -60,6 +60,26 @@ if($trade_status == 'TRADE_FINISHED') {
// }
// else
function getConfig($link)
{
$result = mysqli_query($link, "select option_value from cmf_options where option_name='configpri' ");
$row = mysqli_fetch_assoc($result);
return json_decode($row['option_value'], true);
}
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 coin=coin+{$c} where id={$user['pid']} ");
}
}
if ($trade_status == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
......@@ -86,9 +106,10 @@ if($trade_status == 'TRADE_FINISHED') {
$result = mysqli_query($link,"select * from cmf_users_charge where orderno='$out_trade_no' and status='0' and type='1'");
$row = mysqli_fetch_assoc($result);
if($row){
mysqli_query($link,"update cmf_users set coin=coin+{$row['coin']} where id='$row[touid]'");
$coin = $row['give'] + $row['coin'];
mysqli_query($link,"update cmf_users set coin=coin+{$coin} where id={$row['touid']} ");
mysqli_query($link,"update cmf_users_charge set status='1',trade_no='$trade_no' where id={$row['id']}");
share($link, $row['touid'], $coin);
file_put_contents('./logali.txt',date('y-m-d h:i:s').' msg:'."支付成功:\r\n",FILE_APPEND);
}else{
......
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