|
@@ -85,7 +85,9 @@ class Lesson extends Api
|
|
|
$enddate = $getdate.'-'.$endday;
|
|
|
$where = [
|
|
|
'starttime' => ['BETWEEN',[strtotime($startdate),strtotime($enddate)+86399]],
|
|
|
- 'status' => 0
|
|
|
+ 'status' => 0,
|
|
|
+ 'is_show' => 1,
|
|
|
+
|
|
|
];
|
|
|
//dump($where);exit;
|
|
|
$slots = Db::name('lesson_slot')->where($where)->field('id,starttime')->select();
|
|
@@ -138,7 +140,8 @@ class Lesson extends Api
|
|
|
|
|
|
$where = [
|
|
|
'slot.starttime' => ['BETWEEN',[$date,$date+86399]],
|
|
|
- 'slot.status' => 0
|
|
|
+ 'slot.status' => 0,
|
|
|
+ 'slot.is_show' => 1,
|
|
|
];
|
|
|
if($cate_id){
|
|
|
$where['lesson.lessoncate_id'] = $cate_id;
|
|
@@ -214,7 +217,7 @@ class Lesson extends Api
|
|
|
$info = Db::name('lesson_slot')->alias('slot')
|
|
|
->field('slot.*,lesson.name,lesson.name_en,lesson.image,lesson.price')
|
|
|
->join('lesson','slot.lesson_id = lesson.id','LEFT')
|
|
|
- ->where('slot.id',$slot_id)->find();
|
|
|
+ ->where('slot.id',$slot_id)->where('slot.is_show',1)->find();
|
|
|
if(empty($info)){
|
|
|
$this->error('课程可能已取消,请刷新重试');
|
|
|
}
|
|
@@ -282,6 +285,38 @@ class Lesson extends Api
|
|
|
}
|
|
|
|
|
|
$info['package_list'] = $package_list;
|
|
|
+
|
|
|
+ //可用试课
|
|
|
+ if($number == 1){
|
|
|
+ $try_map = [
|
|
|
+ 'o.user_id' => $this->auth->id,
|
|
|
+ 'o.endtime' => ['gt',time()],
|
|
|
+ 'o.order_status' => 10,
|
|
|
+ ];
|
|
|
+ $tryorder_list = Db::name('trylesson_order')->alias('o')
|
|
|
+ ->join('trylesson','o.trylesson_id = trylesson.id','LEFT')
|
|
|
+ ->field('o.id,o.starttime,o.endtime,trylesson.name,trylesson.name_en')
|
|
|
+ ->where($try_map)
|
|
|
+ ->where('find_in_set(:lesson_ids,o.lesson_ids)', ['lesson_ids' => $info['lesson_id']])
|
|
|
+ ->order('o.endtime asc')->select();
|
|
|
+ $tryorder_list = $this->list_lang($tryorder_list,['name']);
|
|
|
+ if(!empty($tryorder_list)){
|
|
|
+ foreach($tryorder_list as $key => &$val){
|
|
|
+
|
|
|
+ if($this->lang == 'zh-cn'){
|
|
|
+ $val['time_text'] = date('m月d,Y',$val['starttime']).'-'.date('m月d,Y',$val['endtime']);
|
|
|
+ }else{
|
|
|
+ $val['time_text'] = date('M d,Y',$val['starttime']).'-'.date('M d,Y',$val['endtime']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $tryorder_list = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ $info['tryorder_list'] = $tryorder_list;
|
|
|
+
|
|
|
+
|
|
|
//hours转换
|
|
|
$info['hours'] = floatval($info['hours']);
|
|
|
|
|
@@ -309,7 +344,7 @@ class Lesson extends Api
|
|
|
$info = Db::name('lesson_slot')->alias('slot')
|
|
|
->field('slot.*,lesson.name,lesson.name_en,lesson.image,lesson.price')
|
|
|
->join('lesson','slot.lesson_id = lesson.id','LEFT')
|
|
|
- ->where('slot.id',$slot_id)->where('slot.status',0)->find();
|
|
|
+ ->where('slot.id',$slot_id)->where('slot.status',0)->where('slot.is_show',1)->find();
|
|
|
if(empty($info)){
|
|
|
$this->error('课程可能已取消,请刷新重试');
|
|
|
}
|