|
@@ -8,12 +8,13 @@ import (
|
|
|
)
|
|
|
|
|
|
type UserDTO struct {
|
|
|
- Id int
|
|
|
- Username string
|
|
|
- Mobile string
|
|
|
- OpenId string
|
|
|
- UnionId string
|
|
|
- GzhOpenId string
|
|
|
+ Id int
|
|
|
+ Username string
|
|
|
+ Mobile string
|
|
|
+ OpenId string
|
|
|
+ UnionId string
|
|
|
+ FollowingGzh int
|
|
|
+ GzhOpenId string
|
|
|
}
|
|
|
|
|
|
type FeedbackDTO struct {
|
|
@@ -24,10 +25,11 @@ type FeedbackDTO struct {
|
|
|
|
|
|
func convertUserDTO(user userDao.TemplateUser) UserDTO {
|
|
|
return UserDTO{
|
|
|
- Id: user.Id,
|
|
|
- Username: user.Username,
|
|
|
- Mobile: user.Mobile,
|
|
|
- OpenId: user.OpenId,
|
|
|
+ Id: user.Id,
|
|
|
+ Username: user.Username,
|
|
|
+ Mobile: user.Mobile,
|
|
|
+ OpenId: user.OpenId,
|
|
|
+ FollowingGzh: user.FollowingGzh,
|
|
|
}
|
|
|
}
|
|
|
func GetUserByMobile(mobile string) (UserDTO, error) {
|
|
@@ -82,11 +84,12 @@ func FeedBack(dto FeedbackDTO) (err error) {
|
|
|
|
|
|
func convertToTemplateUser(dto *UserDTO) userDao.TemplateUser {
|
|
|
return userDao.TemplateUser{
|
|
|
- Username: dto.Username,
|
|
|
- Mobile: dto.Mobile,
|
|
|
- OpenId: dto.OpenId,
|
|
|
- UnionId: dto.UnionId,
|
|
|
- GzhOpenId: dto.GzhOpenId,
|
|
|
+ Username: dto.Username,
|
|
|
+ Mobile: dto.Mobile,
|
|
|
+ OpenId: dto.OpenId,
|
|
|
+ UnionId: dto.UnionId,
|
|
|
+ GzhOpenId: dto.GzhOpenId,
|
|
|
+ FollowingGzh: dto.FollowingGzh,
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -96,6 +99,7 @@ func convertToUserDTO(templateUser userDao.TemplateUser, dto *UserDTO) {
|
|
|
dto.Mobile = templateUser.Mobile
|
|
|
dto.OpenId = templateUser.OpenId
|
|
|
dto.UnionId = templateUser.UnionId
|
|
|
+ dto.FollowingGzh = templateUser.FollowingGzh
|
|
|
}
|
|
|
|
|
|
func BindUserMobile(userId int, mobile string) (err error) {
|
|
@@ -145,8 +149,8 @@ func BindUserXcxOpenId(userId int, openId string) (err error) {
|
|
|
}
|
|
|
|
|
|
// 绑定公众号OpenId
|
|
|
-func BindUserGzhOpenId(userId int, openId string) (err error) {
|
|
|
- err = userDao.BindGzhOpenId(userId, openId)
|
|
|
+func BindUserGzhOpenId(userId int, openId string, followingGzh int) (err error) {
|
|
|
+ err = userDao.BindGzhOpenId(userId, openId, followingGzh)
|
|
|
if err != nil {
|
|
|
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
logger.Error("绑定公众号openId失败:%v", err)
|