Commit da7cdfd3 by 冷斌

fix bug

parent 7ea5861e
...@@ -12,16 +12,23 @@ $log = Log::Init($logHandler, 15); ...@@ -12,16 +12,23 @@ $log = Log::Init($logHandler, 15);
class PayNotifyCallBack extends WxPayNotify class PayNotifyCallBack extends WxPayNotify
{ {
public function getConfig($link)
{
$result = $link->query("select option_value from cmf_options where option_name='configpri' ");
$row = $result->fetch_assoc();
return json_decode($row['option_value'], true);
}
public function share($link, $id, $coin) public function share($link, $id, $coin)
{ {
$userSql = mysqli_query($link,"select * from cmf_users where id='$id' "); $userSql = $link->query("select * from cmf_users where id='$id' ");
$user = mysqli_fetch_assoc($userSql); $user = $userSql->fetch_assoc();
if ($user['pid'] > 0) { if ($user['pid'] > 0) {
$config = getConfig($link); $config = $this->getConfig($link);
$invite_reward = !empty($config['invite_reward']) ? $config['invite_reward'] : 0; $invite_reward = !empty($config['invite_reward']) ? $config['invite_reward'] : 0;
$coin2 = ($coin * $invite_reward) / 100; $coin2 = ($coin * $invite_reward) / 100;
$c = (int)$coin2; $c = (int)$coin2;
mysqli_query($link,"update cmf_users set i_votes=i_votes+{$c} where id={$user['pid']} "); $link->query("update cmf_users set i_votes=i_votes+{$c} where id={$user['pid']} ");
} }
} }
......
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