|
@@ -609,14 +609,38 @@ class Lesson extends Api
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //售课套餐列表
|
|
|
|
|
|
+ //从预约过来的 售课套餐列表
|
|
public function package_list(){
|
|
public function package_list(){
|
|
$lesson_id = input('lesson_id',0);
|
|
$lesson_id = input('lesson_id',0);
|
|
|
|
|
|
|
|
+ $where2 = [];
|
|
|
|
+ //排除限购一次的
|
|
|
|
+ $map = [
|
|
|
|
+ 'o.user_id' => $this->auth->id,
|
|
|
|
+ 'o.order_status' => 1,
|
|
|
|
+ 'o.is_gift' => 0,
|
|
|
|
+ 'p.buytimes' => 1,
|
|
|
|
+ ];
|
|
|
|
+ $check_first = Db::name('package_order')->alias('o')
|
|
|
|
+ ->join('lesson_package p','o.package_id = p.id','LEFT')
|
|
|
|
+ ->where($map)->column('o.package_id');
|
|
|
|
+ if(!empty($check_first)){
|
|
|
|
+ $where2['id'] = ['NOTIN',$check_first];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //排除新旧会员群体
|
|
|
|
+ if($this->auth->oldstatus == 0){ //新会员
|
|
|
|
+ $where2['newuser'] = 1;
|
|
|
|
+ }
|
|
|
|
+ if($this->auth->oldstatus == 1){ //旧会员
|
|
|
|
+ $where2['olduser'] = 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
//套餐列表
|
|
//套餐列表
|
|
$list = Db::name('lesson_package')
|
|
$list = Db::name('lesson_package')
|
|
->where('find_in_set(:lesson_ids,lesson_ids)', ['lesson_ids' => $lesson_id])
|
|
->where('find_in_set(:lesson_ids,lesson_ids)', ['lesson_ids' => $lesson_id])
|
|
->where('is_show',1)
|
|
->where('is_show',1)
|
|
|
|
+ ->where($where2)
|
|
->order('weigh desc')->select();
|
|
->order('weigh desc')->select();
|
|
$list = list_domain_image($list,['image']);
|
|
$list = list_domain_image($list,['image']);
|
|
$list = $this->list_lang($list,['name','validity','activeremark']);
|
|
$list = $this->list_lang($list,['name','validity','activeremark']);
|
|
@@ -645,6 +669,20 @@ class Lesson extends Api
|
|
|
|
|
|
$package_info = Db::name('lesson_package')->where('id',$package_id)->find();
|
|
$package_info = Db::name('lesson_package')->where('id',$package_id)->find();
|
|
|
|
|
|
|
|
+ //如果限购,则报错
|
|
|
|
+ if($package_info['buytimes'] == 1){
|
|
|
|
+ $map = [
|
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
|
+ 'order_status' => 1,
|
|
|
|
+ 'is_gift' => 0,
|
|
|
|
+ 'package_id' => $package_id,
|
|
|
|
+ ];
|
|
|
|
+ $check_first = Db::name('package_order')->where($map)->find();
|
|
|
|
+ if(!empty($check_first)){
|
|
|
|
+ $this->error('该配套限购一次,您已经买过了');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//套餐订单
|
|
//套餐订单
|
|
$data = [
|
|
$data = [
|
|
'order_no' => createUniqueNo('P',$this->auth->id),
|
|
'order_no' => createUniqueNo('P',$this->auth->id),
|