From d0e7e0c5f1a29357830983bc4747109ef677ae24 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 21 Dec 2023 11:03:29 +0800 Subject: [PATCH] update --- .../svc_self_support_for_school.go | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/app/admin/svc/enterprise_manage/svc_self_support_for_school.go b/app/admin/svc/enterprise_manage/svc_self_support_for_school.go index 46619d0..3b2e22c 100644 --- a/app/admin/svc/enterprise_manage/svc_self_support_for_school.go +++ b/app/admin/svc/enterprise_manage/svc_self_support_for_school.go @@ -412,11 +412,44 @@ func SelfSupportForSchoolStudentUpdate(req md.SelfSupportForSchoolStudentUpdateR _ = session.Rollback() return } - info.CollectFaceType = req.CollectFaceType - _, err = selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoUpdate(info, "collect_face_type") - if err != nil { - _ = session.Rollback() + if info == nil { + now := time.Now() + selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{} + selfSupportForSchoolInfoDb.Set(req.EnterpriseId) + selfSupportForSchoolInfo, err := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo() + if err != nil { + return + } + if selfSupportForSchoolInfo == nil { + return errors.New("当前学校暂未完成《一脸通行入驻》") + } + info = &model.SelfSupportForUserFaceInfo{ + EnterpriseId: req.EnterpriseId, + UserIdentityId: req.UserIdentityId, + CollectFaceType: req.CollectFaceType, + SchoolCode: selfSupportForSchoolInfo.SchoolCode, + SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode, + ParentUserId: "", + ParentLogonId: "", + UserId: "", + SchoolFacePassStatus: "CLOSE", + SchoolFacePaymentStatus: "CLOSE", + ConcentrateSchoolFacePassStatus: 1, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + } + _, err1 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info) + if err1 != nil { + return err1 + } + } else { + info.CollectFaceType = req.CollectFaceType + _, err = selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoUpdate(info, "collect_face_type") + if err != nil { + _ = session.Rollback() + } } + return session.Commit() }