Commit 24c9fce0 by 冷斌

fix bug

parent 13d168ad
......@@ -807,6 +807,45 @@ class PayAction extends CommonAction
}
}
protected function share($pay_pass_num)
{
$recharge = M('zy_recharge')->where(array('pay_pass_num' => $pay_pass_num))->find();
$user = M('el_user')->where(array('uid' => $recharge['uid']))->find();
if ($user['binding_uid'] <= 0) {
return ;
}
$num = M('el_user')->where(array('binding_uid' => $recharge['binding_uid']))->count();
$level = [
// 0 => 0.1,
// 50 => 0.2,
// 180 => 0.3
0 => 0.1,
1 => 0.2,
2 => 0.3,
];
$r = 0;
foreach ($level as $time => $rate) {
if ($num >= $time) {
$r = $rate;
}
}
//$money = $recharge['money'] * $r;
$money = 100 * $r;
$zy_split_balance = M('zy_split_balance')->where(array('uid' => $recharge['invite_id']))->find();
$nn = $zy_split_balance['balance'] + $money;
M('zy_split_balance')->where(array('uid' => $recharge['invite_id']))->save(['balance' => $nn]);
M('zy_split_balance_flow')->add([
'uid' => $recharge['invite_id'],
'type' => 5,
'num' => $money,
'balance' => $money,
'rel_id' => 1,
'rel_type'=> 'zy_classes_order',
'note' => $recharge['note'],
'ctime' => time(),
]);
}
/**
* @name 微信回调
*/
......@@ -843,6 +882,7 @@ class PayAction extends CommonAction
if ($sign > 0){
D('ZyRecharge','classroom')->setNormalPaySuccess($response['out_trade_no'], $response['transaction_id'],$response['attach']);
}
$this->share($response['out_trade_no']);
}
}
......
......@@ -533,7 +533,8 @@ class HomeAction extends UserAction
// $this->assign('data', $video_share);
// $data['data'] = $this->fetch('share_list');
$num = M('zy_recharge')->where(array('invite_id' => $this->mid, 'status' => 1))->count();
// $num = M('zy_recharge')->where(array('invite_id' => $this->mid, 'status' => 1))->count();
$num = M('el_user')->where(array('binding_uid' => $this->mid))->count();
$level = [
0 => 0.1,
50 => 0.2,
......
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