Commit eab98316 by 冷斌

`试卷`

parent edc8480f
...@@ -108,7 +108,36 @@ class ZyRechargeModel extends Model ...@@ -108,7 +108,36 @@ class ZyRechargeModel extends Model
if ($attach) { if ($attach) {
$data['note_wxpay'] = $attach; $data['note_wxpay'] = $attach;
} }
//推广奖励
if ($recharge['invite_id'] > 0) {
$count = M('zy_recharge')->where(array('invite_id' => $recharge['invite_id']))->count();
$num = $count - 1;
$level = [
0 => 0.1,
50 => 0.2,
180 => 0.3
];
$r = 0;
foreach ($level as $time => $rate) {
if ($num >= $time) {
$r = $rate;
}
}
$money = $recharge['money'] * $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(),
]);
}
//修改购买记录状态 //修改购买记录状态
$rer = M('zy_recharge')->where(array('pay_pass_num' => $pay_pass_num))->save($data); $rer = M('zy_recharge')->where(array('pay_pass_num' => $pay_pass_num))->save($data);
if ($rer) { if ($rer) {
......
...@@ -1744,6 +1744,7 @@ class PayVideoAction extends CommonAction ...@@ -1744,6 +1744,7 @@ class PayVideoAction extends CommonAction
//使用后台提示模版 //使用后台提示模版
$this->assign('isAdmin', 1); $this->assign('isAdmin', 1);
$check_type = t($_POST['check_type']); $check_type = t($_POST['check_type']);
$invite_id = t($_POST['invite_id']) ?: 0;
//必须要先登录才能进行操作 //必须要先登录才能进行操作
$this->mid = $this->mid ?: intval($_POST['mid']); $this->mid = $this->mid ?: intval($_POST['mid']);
...@@ -1911,6 +1912,7 @@ class PayVideoAction extends CommonAction ...@@ -1911,6 +1912,7 @@ class PayVideoAction extends CommonAction
'note' => "{$this->site['site_keyword']}在线教育-购买{$title}", 'note' => "{$this->site['site_keyword']}在线教育-购买{$title}",
'pay_type' => $_POST['pay'], 'pay_type' => $_POST['pay'],
'pay_pass_num' => $pay_pass_num, 'pay_pass_num' => $pay_pass_num,
'invite_id' => $invite_id,
)); ));
if (!$id) { if (!$id) {
......
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