From f1e4fba8f79c57202cf7f2df20e69c5ba5979879 Mon Sep 17 00:00:00 2001
From: liumiao <495261512@qq.com>
Date: 星期三, 31 三月 2021 10:58:23 +0800
Subject: [PATCH] 请假

---
 app/Http/Controllers/Api/v1/AskForLeaveController.php |   73 +-----------------------------------
 1 files changed, 2 insertions(+), 71 deletions(-)

diff --git a/app/Http/Controllers/Api/v1/AskForLeaveController.php b/app/Http/Controllers/Api/v1/AskForLeaveController.php
index 196aa2e..16783e9 100644
--- a/app/Http/Controllers/Api/v1/AskForLeaveController.php
+++ b/app/Http/Controllers/Api/v1/AskForLeaveController.php
@@ -33,10 +33,6 @@
         $rule = [
             'coursetableId' => 'required',
             'attendRecordId' => 'required',
-            'username' => 'required',
-            'classCode' => 'required',
-            'date' => 'required',
-            'contentTime' => 'required',
             "approvalStatus" => 'required',
             "approvalUserId" => 'required',
             "approvalOpinion" => 'required',
@@ -49,14 +45,11 @@
         }
         $coursetableId = explode(',', $request->post("coursetableId"));
         $attendRecordId = explode(',', $request->post("attendRecordId"));
-        $username = explode(',', $request->post("username"));
-        $classCode = explode(',', $request->post("classCode"));
-        $date = explode(',', $request->post("date"));
         $approvalStatus = explode(',', $request->post("approvalStatus"));
         $approvalUserId = explode(',', $request->post("approvalUserId"));
         $approvalOpinion = explode(',', $request->post("approvalOpinion"));
         $classHour = explode(',', $request->post("classHour"));
-        $contentTime = explode(',', $request->post("contentTime"));
+
         DB::beginTransaction(); //寮�鍚簨鍔�
         try
         {
@@ -84,13 +77,8 @@
                 $data = [
                     "coursetableId" => $coursetableId[$key],
                     "attendRecordId" => $val,
-                    "status" => $approvalStatus[$key],
-                    "studentCode" => $username[$key],
-                    "dates" => $date[$key],
-                    "contentTime" => $contentTime[$key],
-                    "classCode" => $classCode[$key],
                 ];
-                $this->setAttendApprovalLog($data);
+                AttendApprovalLogModel::updateRecordMass(["status" => $approvalStatus[$key]], $data);
             }
 
             DB::commit();
@@ -101,63 +89,6 @@
             CustomLog::queryinfo("璇峰亣鏃ュ織鍐欏叆------------>" . json_encode($e->getMessage(), true));
             return $this->_response('', ResponseCode::COMMON_ERROR, "璇峰亣澶辫触");
         }
-    }
-
-
-    /**
-     * @param $data
-     * @Author lium
-     * @Date  2021/3/29 14:02
-     * @Explain CN銆� 鍐欏叆璇峰亣鏃ュ織 銆�
-     * @Explain EN銆� ApprovalLog 銆�
-     */
-    public function setAttendApprovalLog($data)
-    {
-        //鎺掕琛�
-        $courseInfo = CourseTableModel::findRecordOneCondition(["id" => $data["coursetableId"]]);
-
-        //瀛﹀憳淇℃伅
-        $studentInfo = StudentsModel::findRecordOneCondition(["username" => $data["studentCode"]], ["name", "headPhoto"]);
-
-        //鏁欏笀鏁版嵁
-        $pWhere = ["ctm.classNumber" => $courseInfo["classNumber"], "ctm.classCode" => $data["classCode"], "ctm.isDelete" => 0];
-        $pSelect = ["u.EnName", "u.RealCnName", "u.UserId"];
-        $tUserInfo = ParentsModel::getDataJoinList(ParentsModel::organizeTeacherCourse(), $pWhere, $pSelect);
-        $teacherName = [];
-        $teacherId = [];
-        foreach($tUserInfo as $tVal)
-        {
-            if(!empty($tVal["EnName"]))
-            {
-                $teacherName[] = $tVal["EnName"];
-            }
-            else
-            {
-                $teacherName[] = $tVal["RealCnName"];
-            }
-            $teacherId[] = $tVal['UserId'];
-        }
-
-        //鐝骇鏁版嵁
-        $classInfo = ClassModel::findRecordOneCondition(["classCode" => $data["classCode"]], ["className"]);
-
-        $logData = [
-            "coursetableId" => $data["coursetableId"],
-            "attendRecordId" => $data["attendRecordId"],
-            "status" => $data["status"],
-            "studentCode" => $data["studentCode"],
-            "userName" => $studentInfo["name"],
-            "studentsFace" => $studentInfo["headPhoto"],
-            "dates" => $data["dates"],
-            "contentTime" => $data["contentTime"],
-            "teachersId" => implode(',', $teacherId),
-            "teachersName" => implode(',', $teacherName),
-            "classCode" => $data["classCode"],
-            "className" => $classInfo["className"],
-            "classNumber" => $courseInfo["classNumber"],
-
-        ];
-        AttendApprovalLogModel::addRecord($logData);
     }
 
 

--
Gitblit v1.8.0