🎨 update
This commit is contained in:
@@ -1101,7 +1101,7 @@ type (
|
|||||||
Nickname string `json:"nickname,optional"`
|
Nickname string `json:"nickname,optional"`
|
||||||
Avatar string `json:"avatar,optional"`
|
Avatar string `json:"avatar,optional"`
|
||||||
Email string `json:"email,optional"`
|
Email string `json:"email,optional"`
|
||||||
Gender int64 `json:"gender,optional"`
|
Gender string `json:"gender,optional"`
|
||||||
Introduce string `json:"introduce,optional"`
|
Introduce string `json:"introduce,optional"`
|
||||||
Blog string `json:"blog,optional"`
|
Blog string `json:"blog,optional"`
|
||||||
Location string `json:"location,optional"`
|
Location string `json:"location,optional"`
|
||||||
|
@@ -165,9 +165,9 @@ Minio:
|
|||||||
# Minio 地址
|
# Minio 地址
|
||||||
Endpoint: 115.190.97.132:9000
|
Endpoint: 115.190.97.132:9000
|
||||||
# Minio 访问密钥
|
# Minio 访问密钥
|
||||||
AccessKeyID: RsIT1NvhINLgPt9ElBda
|
AccessKeyID: tHIVeEW2BpRxoRnl2E4C
|
||||||
# Minio 访问密钥
|
# Minio 访问密钥
|
||||||
SecretAccessKey: 5ZXGFpuFsKgPXQ9DPAyAB7mzsvlbCZpBheNbmc89
|
SecretAccessKey: Et7TM5EPlGYNOrSabAN8i2cLSqn6QjhRllLLaYTx
|
||||||
# Minio 使用SSL
|
# Minio 使用SSL
|
||||||
UseSSL: false
|
UseSSL: false
|
||||||
#NSQ配置
|
#NSQ配置
|
||||||
|
@@ -6,6 +6,7 @@ import (
|
|||||||
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
|
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
|
||||||
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
|
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
|
||||||
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
|
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
@@ -31,7 +32,11 @@ func (l *ModifyPersonalInfoLogic) ModifyPersonalInfo(req *types.ModifyPersonalIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
authUser := l.svcCtx.DB.ScaAuthUser
|
authUser := l.svcCtx.DB.ScaAuthUser
|
||||||
info, err := authUser.Where(authUser.UID.Eq(uid)).Updates(model.ScaAuthUser{Nickname: req.Nickname, Avatar: req.Avatar, Email: req.Email, Gender: req.Gender, Introduce: req.Introduce, Blog: req.Blog, Location: req.Location, Company: req.Company})
|
gender, err := strconv.ParseInt(req.Gender, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return "", errors.New("gender is not valid")
|
||||||
|
}
|
||||||
|
info, err := authUser.Where(authUser.UID.Eq(uid)).Updates(model.ScaAuthUser{Nickname: req.Nickname, Avatar: req.Avatar, Email: req.Email, Gender: gender, Introduce: req.Introduce, Blog: req.Blog, Location: req.Location, Company: req.Company})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@@ -38,8 +38,7 @@ func (l *AdminLoginLogic) AdminLogin(r *http.Request, req *types.AdminLoginReque
|
|||||||
authUser := l.svcCtx.DB.ScaAuthUser
|
authUser := l.svcCtx.DB.ScaAuthUser
|
||||||
permissionRule := l.svcCtx.DB.ScaAuthPermissionRule
|
permissionRule := l.svcCtx.DB.ScaAuthPermissionRule
|
||||||
adminUser, err := authUser.
|
adminUser, err := authUser.
|
||||||
LeftJoin(permissionRule, authUser.UID.EqCol(permissionRule.V0)).
|
Where(authUser.Username.Eq(req.Account)).
|
||||||
Where(authUser.Username.Eq(req.Account), authUser.Password.Eq(req.Password), permissionRule.V1.Eq(constant.Admin)).
|
|
||||||
Group(authUser.UID).First()
|
Group(authUser.UID).First()
|
||||||
if err != nil && err != gorm.ErrRecordNotFound {
|
if err != nil && err != gorm.ErrRecordNotFound {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -50,6 +49,13 @@ func (l *AdminLoginLogic) AdminLogin(r *http.Request, req *types.AdminLoginReque
|
|||||||
if !utils.Verify(adminUser.Password, req.Password) {
|
if !utils.Verify(adminUser.Password, req.Password) {
|
||||||
return nil, errors.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "login.invalidPassword"))
|
return nil, errors.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "login.invalidPassword"))
|
||||||
}
|
}
|
||||||
|
first, err := permissionRule.Where(permissionRule.Ptype.Eq("g"), permissionRule.V0.Eq(adminUser.UID), permissionRule.V1.Eq(constant.Admin)).First()
|
||||||
|
if err != nil && err != gorm.ErrRecordNotFound {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if first == nil {
|
||||||
|
return nil, errors.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "login.notPermission"))
|
||||||
|
}
|
||||||
data, err := HandleLoginJWT(adminUser, l.svcCtx, true, r, l.ctx)
|
data, err := HandleLoginJWT(adminUser, l.svcCtx, true, r, l.ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@@ -384,7 +384,7 @@ type ModifyPersonalInfoRequest struct {
|
|||||||
Nickname string `json:"nickname,optional"`
|
Nickname string `json:"nickname,optional"`
|
||||||
Avatar string `json:"avatar,optional"`
|
Avatar string `json:"avatar,optional"`
|
||||||
Email string `json:"email,optional"`
|
Email string `json:"email,optional"`
|
||||||
Gender int64 `json:"gender,optional"`
|
Gender string `json:"gender,optional"`
|
||||||
Introduce string `json:"introduce,optional"`
|
Introduce string `json:"introduce,optional"`
|
||||||
Blog string `json:"blog,optional"`
|
Blog string `json:"blog,optional"`
|
||||||
Location string `json:"location,optional"`
|
Location string `json:"location,optional"`
|
||||||
|
Reference in New Issue
Block a user