liumiao
2021-01-26 45401fbfadd1e225bfeeb89b8dfae0ee300a1f57
根据学员获取课次
1 files modified
28 ■■■■ changed files
app/Http/Controllers/Api/v1/ClassScheduleController.php 28 ●●●● patch | view | raw | blame | history
app/Http/Controllers/Api/v1/ClassScheduleController.php
@@ -343,7 +343,7 @@
        $date = $request->post("date");
        $orgId = $request->post("orgId", 43);
        $roleIdArr = $request->post("roleIdArr");
        $teacherId = $this->getAndCheckTeacherId();
        $teacherId = $this->getAndCheckTeacherId(); //236523
        if(empty($date))
        {
            $date = date("Y-m-d");
@@ -394,16 +394,19 @@
        //获取班级课程
        $courseMap = $this->getCourseList($classCodeArr);
        //获取人脸签到
        $faceList = $this->getFaceList($classCodeArr);
        $mapList = [];
        foreach($list as $val)
        {
            //班级人数
            $classStudentsNum = !empty($students[$val["classCode"]]) ? count($students[$val["classCode"]]) : 0;
            $signIn = !empty($faceList[$val["classCode"] . "-" . $val["classNumber"] . "-" . $val["contentTime"]]) ? count($faceList[$val["classCode"] . "-" . $val["classNumber"] . "-" . $val["contentTime"]]) : 0; //人脸签到
            //学员签到记录
            $recordList = !empty($recordMap[$val["courseTableId"]]) ? $recordMap[$val["courseTableId"]] : [];
            $actualNum = 0; //实到
            $actualNum = 0; //出勤
            $leaveNum = 0; //请假
            $signIn = 0; //签到
            foreach($recordList as $rVal)
            {
                switch ($rVal)
@@ -413,9 +416,6 @@
                        break;
                    case 4:
                        $leaveNum += 1;
                        break;
                    default:
                        $signIn += 1;
                        break;
                }
            }
@@ -433,6 +433,22 @@
    }
    /**
     * @param $classCodeArr
     * 人脸签到
     */
    public function getFaceList($classCodeArr)
    {
        $faceMap = [];
        $list = FaceAttendanceModel::getRecordListCondition(["classCode" => ["wherein" => $classCodeArr]], ["classCode", "classNumber", "contentTime"])->toArray();
        foreach($list as $val)
        {
            $faceMap[$val["classCode"] . "-" . $val["classNumber"] . "-" . $val["contentTime"]][] = $val;
        }
        return $faceMap;
    }
    /**
     * 获取课程
     * @param $classCodeArr
     */