修复登录及验证码功能
This commit is contained in:
@@ -3,7 +3,6 @@ package service
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"photowall/internal/config"
|
||||
"photowall/internal/model"
|
||||
"photowall/pkg/sensitive"
|
||||
"strings"
|
||||
@@ -14,11 +13,12 @@ import (
|
||||
)
|
||||
|
||||
type ClassService struct {
|
||||
db *gorm.DB
|
||||
db *gorm.DB
|
||||
configSvc *ConfigService
|
||||
}
|
||||
|
||||
func NewClassService(db *gorm.DB) *ClassService {
|
||||
return &ClassService{db: db}
|
||||
func NewClassService(db *gorm.DB, configSvc *ConfigService) *ClassService {
|
||||
return &ClassService{db: db, configSvc: configSvc}
|
||||
}
|
||||
|
||||
// CreateClassReq 创建班级请求
|
||||
@@ -104,6 +104,10 @@ func (s *ClassService) Create(userID uint, req *CreateClassReq) (*model.Class, e
|
||||
teachers := cleanNames(req.TeacherNames)
|
||||
|
||||
// 6. 构建班级
|
||||
graceDays := 30
|
||||
if s.configSvc != nil {
|
||||
graceDays = s.configSvc.GetInt("audit_grace_days", 30)
|
||||
}
|
||||
class := &model.Class{
|
||||
SchoolID: req.SchoolID,
|
||||
CollegeID: req.CollegeID,
|
||||
@@ -113,7 +117,7 @@ func (s *ClassService) Create(userID uint, req *CreateClassReq) (*model.Class, e
|
||||
GraduateYear: req.GraduateYear,
|
||||
AdminUserID: userID,
|
||||
GraduationPhoto: req.GraduationPhoto,
|
||||
AuditDeadline: time.Now().AddDate(0, 0, config.C.AuditGraceDays),
|
||||
AuditDeadline: time.Now().AddDate(0, 0, graceDays),
|
||||
}
|
||||
class.SetStudentNames(students)
|
||||
class.SetTeacherNames(teachers)
|
||||
|
||||
Reference in New Issue
Block a user