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) {
......
...@@ -167,7 +167,7 @@ class PayVideoAction extends CommonAction ...@@ -167,7 +167,7 @@ class PayVideoAction extends CommonAction
$this->assign("is_asb", $is_asb); $this->assign("is_asb", $is_asb);
$this->assign('event_id', jiami($event['event_id'])); $this->assign('event_id', jiami($event['event_id']));
} else { } else {
// $is_event为0时显示优惠券:活动不显示优惠券 拼团课单独购买显示优惠券 // $is_event为0时显示优惠券:活动不显示优惠券 拼团课单独购买显示优惠券
$is_event = $event ? ($event['event_type'] == 3 ? 0 : intval($event['event_id'])) : 0; $is_event = $event ? ($event['event_type'] == 3 ? 0 : intval($event['event_id'])) : 0;
// 砍价成功不显示优惠券 // 砍价成功不显示优惠券
$event['event_type'] == 4 && $is_event = $this->bgned ? 1 : 0; $event['event_type'] == 4 && $is_event = $this->bgned ? 1 : 0;
...@@ -547,7 +547,7 @@ class PayVideoAction extends CommonAction ...@@ -547,7 +547,7 @@ class PayVideoAction extends CommonAction
// 定义video_type_arr数组 // 定义video_type_arr数组
$video_type_arr = ['zy_video' => 1, 'zy_live' => 2, 'zy_album' => 3, 'zy_classes' => 6]; $video_type_arr = ['zy_video' => 1, 'zy_live' => 2, 'zy_album' => 3, 'zy_classes' => 6];
// 检测课程是否有活动 $is_event为0时显示优惠券:活动不显示优惠券 拼团课单独购买显示优惠券 // 检测课程是否有活动 $is_event为0时显示优惠券:活动不显示优惠券 拼团课单独购买显示优惠券
$is_event = 0; $is_event = 0;
if ($type = $video_type_arr[$type]) { if ($type = $video_type_arr[$type]) {
// 活动不显示优惠券 // 活动不显示优惠券
...@@ -583,7 +583,7 @@ class PayVideoAction extends CommonAction ...@@ -583,7 +583,7 @@ class PayVideoAction extends CommonAction
} }
//订单类型 //订单类型
$data['vtype'] = $c_data[0]; $data['vtype'] = $c_data[0];
$vc_map = array('uid' => $this->mid, 'type' => 1, 'sid' => $agent_id ?: $mhm_id, 'coupon_type' => 0, 'etime' => 1, 'maxprice' => $moner_data['price']); $vc_map = array('uid' => $this->mid, 'type' => 1, 'sid' => $agent_id ?: $mhm_id, 'coupon_type' => 0, 'etime' => 1, 'maxprice' => $moner_data['price']);
$videoCoupon = D('Coupon', 'classroom')->getUserCouponList($vc_map, 0); $videoCoupon = D('Coupon', 'classroom')->getUserCouponList($vc_map, 0);
foreach ($videoCoupon['data'] as $key => &$val) { foreach ($videoCoupon['data'] as $key => &$val) {
...@@ -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