liumiao
2021-02-02 af8997f668dad750f4388b7642078189f4de9b5e
根据学员获取课次
1 files modified
13 ■■■■ changed files
app/Http/Controllers/Api/v1/ClassScheduleController.php 13 ●●●● patch | view | raw | blame | history
app/Http/Controllers/Api/v1/ClassScheduleController.php
@@ -36,7 +36,7 @@
        {
            return $this->_response(null, ResponseCode::PARAM_ERROR, $message);
        }
        $signInSet = (new FaceController())->getSignInDetails($request->orgId);
        //根据学员查询当天的所有课次
        $username = $request->post("username");
        $startTime = $request->post("startTime");
@@ -53,11 +53,18 @@
            $mapFace[$f_val["classCode"] . "-" . $f_val["classNumber"] . "-" . $f_val["contentTime"]] = $f_val;
        }
        $mapList = [];
        $date = date("Y-m-d H:i");
        foreach($list as $l_val)
        {
            if(empty($mapFace[$l_val["classCode"] . "-" . $l_val["classNumber"] . "-" . $l_val["contentTime"]]))
            $classNumberArr = explode('-', $l_val["contentTime"]);
            $lastMinute = $signInSet['lastMinute'] > 0 ? $signInSet['lastMinute'] : 0;
            $beginsTime = $startTime . ' ' . date("H:i", strtotime("$classNumberArr[0] -" . $lastMinute . " min"));
            if($beginsTime <= $date)
            {
                $mapList[] = $l_val;
                if(empty($mapFace[$l_val["classCode"] . "-" . $l_val["classNumber"] . "-" . $l_val["contentTime"]]))
                {
                    $mapList[] = $l_val;
                }
            }
        }
        return $this->_response($mapList);