Silent 6 years ago
parent
commit
7afb7f5037

+ 8 - 4
app/Http/Controllers/TestController.php

xqd
@@ -15,9 +15,13 @@ class TestController extends Controller
 {
     public function index(Request $request)
     {
-        $items = CheckCard::where('student_id', 7)->whereNotNull('begin_date_time')->whereNotNull('end_date_time')->get()->pluck('begin_date_time')->map(function ($item) {
-            return substr($item, 0, 10);
-        })->unique();
-        dd($items);
+        $today = Carbon::today();
+        $this_week_begin = null;
+        while($today->dayOfWeekIso != 1) {
+            $today = $today->subDay();
+        }
+        $this_week_begin = $today->toDateTimeString();
+        $this_week_end = $today->addDays(7)->toDateTimeString();
+        dd($this_week_begin, $this_week_end);
     }
 }

+ 9 - 0
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -340,6 +340,15 @@ class ApiController extends Controller
         $student_course->end_date = Carbon::createFromTimestamp(strtotime($student_course->apply_date))->addDays($student_course->duration)->toDateString();
         $student_course->short_leave_times = $student->short_leave_times;
         $student_course->long_leave_times = $student->long_leave_times;
+
+        $today = Carbon::today();
+        $this_week_begin = null;
+        while($today->dayOfWeekIso != 1) {
+            $today = $today->subDay();
+        }
+        $this_week_begin = $today->toDateTimeString();
+        $this_week_end = $today->addDays(7)->toDateTimeString();
+
         return response()->json(['status' => 'success', 'courseInfo' => $student_course]);
     }