Kaynağa Gözat

课程表列表

lizhen_gitee 7 ay önce
ebeveyn
işleme
4076808c58
1 değiştirilmiş dosya ile 34 ekleme ve 3 silme
  1. 34 3
      application/admin/controller/Lessonslot.php

+ 34 - 3
application/admin/controller/Lessonslot.php

@@ -12,7 +12,7 @@ use app\common\library\Email;
  */
 class Lessonslot extends Backend
 {
-    protected $noNeedLogin = ['vue_index'];
+    protected $noNeedLogin = ['vue_index','vue_staff'];
 
     /**
      * Lessonslot模型对象
@@ -225,7 +225,7 @@ class Lessonslot extends Backend
         if(!empty($danceroom_id)){
             $where['danceroom_id'] = $danceroom_id;
         }
-        //$where['starttime'] = ['BETWEEN',[$starttime,$endtime]];
+        $where['starttime'] = ['BETWEEN',[$starttime,$endtime]];
 
         $wherenew = '';
         if(!empty($bookstatus)){
@@ -241,7 +241,7 @@ class Lessonslot extends Backend
         }
 
         $field = [
-            'slot.id','slot.starttime','slot.endtime','slot.num_max','slot.bookednum',
+            'slot.id','slot.starttime','slot.endtime','slot.num_max','slot.bookednum','coach_ids',
             'coach.nickname as Staff','coach.bgcolor',
             'lesson.name_en as title',
             'danceroom.name_en as Location',
@@ -258,6 +258,9 @@ class Lessonslot extends Backend
 
         if(!empty($list)){
             foreach($list as $key => $val){
+
+                $val['resourceId'] = $val['coach_ids'];
+
                 $val['start'] = date('Y-m-d H:i',$val['starttime']);
                 $val['end']   = date('Y-m-d H:i',$val['endtime']);
 
@@ -290,5 +293,33 @@ class Lessonslot extends Backend
         $this->result($list,1,'success','json');
 
     }
+    //教练表头
+    public function vue_staff()
+    {
+        $coach_id = input('coach_id','');
+        //教练列表
+        $coach_map = [];
+        if(!empty($coach_id)){
+            $coach_map['coach_ids'] = ['IN',$coach_id];
+        }
+        $coach_list = Db::name('coach')->where($coach_map)->order('id desc')->select();
+
+        $result = [];
+        if(!empty($coach_list)){
+            foreach($coach_list as $ckey => $cval){
+                $result[] = [
+                    'id' => $cval['id'],
+                    'title' => $cval['nickname'],
+                    'extendedProps' => [
+                        'name' => $cval['nickname'],
+                        'avatar' => localpath_to_netpath($cval['avatar']),
+                    ],
+                ];
+            }
+        }
+
+        $this->result($result,1,'success','json');
+
+    }
 
 }