feat: system notice

This commit is contained in:
zchengo
2023-01-02 11:00:29 +08:00
parent 88d32fa6c5
commit 957c06ca1a
11 changed files with 389 additions and 59 deletions
+20
View File
@@ -19,6 +19,14 @@ const (
)
type UserService struct {
noticeService *NoticeService
}
func NewUserService() *UserService {
userService := UserService{
noticeService: &NoticeService{},
}
return &userService
}
// 用户注册
@@ -75,6 +83,12 @@ func (u *UserService) Register(param *models.UserCreateParam) int {
}
}
// 注册通知
u.noticeService.Create(&models.NoticeParam{
Content: REGISTER_NOTICE_TEMPLATE,
Creator: newUser.Id,
})
return response.ErrCodeSuccess
}
@@ -106,6 +120,12 @@ func (u *UserService) Login(param *models.UserLoginParam) (*models.UserInfo, int
Token: token,
}
// 登录通知
u.noticeService.Create(&models.NoticeParam{
Content: LOGIN_NOTICE_TEMPLATE,
Creator: userInfo.Uid,
})
return &userInfo, response.ErrCodeSuccess
}