lizhen_gitee 11 月之前
父節點
當前提交
8cc88503a5
共有 1 個文件被更改,包括 21 次插入8 次删除
  1. 21 8
      application/api/controller/doctor/Index.php

+ 21 - 8
application/api/controller/doctor/Index.php

@@ -17,13 +17,24 @@ class Index extends Apic
     protected $noNeedLogin = [];
     protected $noNeedRight = '*';
 
+    private function get_page_week($page = 1)
+    {
+        $arr = [
+            strtotime('Monday this week'),
+            strtotime('Sunday this week'),
+        ];
+
+        return $arr;
+    }
+
     //获取排班详情
     public function paiban_info(){
-        $today = date('Y-m-d');
-        $today_start = strtotime(date('Y-m-d'));
+        $today = date('Y-m-d');//今天
+
+        $page = input('page',1);//分页
 
-        //本周
-        $this_week = this_week();
+        //某周,page=1是本周
+        $this_week = $this->get_page_week($page);
 
         //医生排班
         $paiban = Db::name('doctor_paiban')->where('doctor_id',$this->auth->id)->where('activetime','BETWEEN',$this_week)->order('activetime asc')->column('activetime,active');
@@ -40,17 +51,19 @@ class Index extends Apic
                 'date_text' => date('d日',$i_time),
                 'week'      => date('w',$i_time),
                 'is_today'  => 0,
+                'year'      => date('Y',$i_time),
+                'month'     => date('n',$i_time),
             ];
 
             if($i_data['date'] == $today){
-                $i_data['is_today'] = 1;
+                $i_data['is_today'] = 1;//是否今天
             }
             if($i_data['week'] == 0){
-                $i_data['week'] = 7;
+                $i_data['week'] = 7; //周天转换
             }
-            $i_data['week_text'] = $week_text[$i_data['week']];
+            $i_data['week_text'] = $week_text[$i_data['week']];//周一 到  周日
 
-            //今天各整点
+            //今天各整点,早8,晚20
             $i_child = [];
             for($y=8;$y<=20;$y++){
                 $y_hour = $i_time + $y*3600;