feat: 完善小组绩效与有效端统计并修复审查问题
This commit is contained in:
@@ -98,6 +98,17 @@ func validateAccount(req *dto.BusinessAccountRequest, create bool) (*int, error)
|
||||
if req == nil {
|
||||
return nil, business.ErrAccountInput
|
||||
}
|
||||
if create && req.HireDate == nil {
|
||||
return nil, business.ErrMemberInput
|
||||
}
|
||||
if req.Phone != nil && !validMemberPhone(*req.Phone) {
|
||||
return nil, business.ErrMemberInput
|
||||
}
|
||||
if req.HireDate != nil {
|
||||
if _, err := time.Parse("2006-01-02", *req.HireDate); err != nil {
|
||||
return nil, business.ErrMemberInput
|
||||
}
|
||||
}
|
||||
if create && (req.Username == nil || req.RealName == nil || strings.TrimSpace(*req.RealName) == "" || req.Password == "") {
|
||||
return nil, business.ErrAccountInput
|
||||
}
|
||||
@@ -107,7 +118,7 @@ func validateAccount(req *dto.BusinessAccountRequest, create bool) (*int, error)
|
||||
for _, field := range []struct {
|
||||
s *string
|
||||
max int
|
||||
}{{req.NickName, 30}, {req.RealName, 30}, {req.Phone, 11}, {req.Email, 50}, {req.QQNumber, 20}, {req.RejectReason, 200}} {
|
||||
}{{req.NickName, 30}, {req.RealName, 30}, {req.Phone, 20}, {req.Email, 50}, {req.QQNumber, 20}, {req.RejectReason, 200}} {
|
||||
if field.s != nil && (utf8.RuneCountInString(*field.s) > field.max || strings.ContainsAny(*field.s, "<>")) {
|
||||
return nil, business.ErrAccountInput
|
||||
}
|
||||
@@ -147,6 +158,7 @@ func (s *AccountService) Create(ctx context.Context, req *dto.BusinessAccountReq
|
||||
}
|
||||
a := &business.Account{Username: stringValue(req.Username), NickName: stringValue(req.NickName), RealName: stringValue(req.RealName), Phone: stringValue(req.Phone),
|
||||
Email: stringValue(req.Email), QQNumber: stringValue(req.QQNumber), Password: req.Password, RejectReason: stringValue(req.RejectReason)}
|
||||
a.HireDate = stringValue(req.HireDate)
|
||||
if status != nil {
|
||||
a.Status = *status
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user