fix: align business V2 fields and page interactions
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user