fix: align business V2 fields and page interactions

This commit is contained in:
Yvan
2026-11-07 02:00:12 +08:00
parent c2f3ebdf4a
commit 4038e3b42f
19 changed files with 290 additions and 127 deletions
+5 -5
View File
@@ -98,13 +98,10 @@ 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 req.HireDate != nil && (strings.TrimSpace(*req.HireDate) != "" || !create) {
if _, err := time.Parse("2006-01-02", *req.HireDate); err != nil {
return nil, business.ErrMemberInput
}
@@ -158,7 +155,10 @@ 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)
a.HireDate = strings.TrimSpace(stringValue(req.HireDate))
if a.HireDate == "" {
a.HireDate = time.Now().In(time.FixedZone("Asia/Shanghai", 8*3600)).Format("2006-01-02")
}
if status != nil {
a.Status = *status
}