Ver código fonte

配套商店

lizhen_gitee 7 meses atrás
pai
commit
86aa42e0c5
1 arquivos alterados com 36 adições e 0 exclusões
  1. 36 0
      application/api/controller/Lesson.php

+ 36 - 0
application/api/controller/Lesson.php

@@ -610,6 +610,42 @@ class Lesson extends Api
     }
     }
 
 
     //从预约过来的 售课套餐列表
     //从预约过来的 售课套餐列表
+    public function package_shop(){
+
+        $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')
+            ->where('is_show',1)
+            ->where($where2)
+            ->order('weigh desc')->select();
+        $list = list_domain_image($list,['image']);
+        $list = $this->list_lang($list,['name','validity','activeremark']);
+
+        $this->success(1,$list);
+    }
+    //从预约过来的 售课套餐列表
     public function package_list(){
     public function package_list(){
         $lesson_id = input('lesson_id',0);
         $lesson_id = input('lesson_id',0);