Merge pull request 'by Robin at 20240326' (#205) from feat-IRONFANS-ALTER-Robin into main

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/205
This commit is contained in:
chenhao 2024-03-26 13:12:26 +08:00
commit 4f8ed5742e
2 changed files with 15 additions and 11 deletions

View File

@ -6,14 +6,14 @@ import (
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"service/library/mediafiller"
"github.com/gin-gonic/gin"
)
func ApiLoginByPswd(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*loginproto.ApiLoginByPswdReq)
//isEnabled, token, accountVO, ec := service.DefaultService.ApiLoginByPswd(ctx, req)
ec := errcode.ErrCodeSuspend
isEnabled, token, accountVO, ec := service.DefaultService.ApiLoginByPswd(ctx, req)
if ec != errcode.ErrCodeLoginSrvOk {
logger.Error("ApiLoginByPswd fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
@ -21,13 +21,13 @@ func ApiLoginByPswd(ctx *gin.Context) {
}
//填充媒体切片
// mediafiller.FillEntity(ctx, accountVO.Avatar)
mediafiller.FillEntity(ctx, accountVO.Avatar)
// ReplyOk(ctx, &loginproto.ApiLoginData{
// IsEnabled: isEnabled,
// Token: token,
// AccountVO: accountVO,
// })
ReplyOk(ctx, &loginproto.ApiLoginData{
IsEnabled: isEnabled,
Token: token,
AccountVO: accountVO,
})
}
@ -107,7 +107,5 @@ func ApiLogout(ctx *gin.Context) {
}
func ApiValidate(ctx *gin.Context) {
ec := errcode.ErrCodeSuspend
ReplyErrCodeMsg(ctx, ec)
//ReplyOk(ctx, nil)
ReplyOk(ctx, nil)
}

View File

@ -76,6 +76,12 @@ func (s *Service) ApiLoginByPswd(ctx *gin.Context, req *loginproto.ApiLoginByPsw
return
}
// 20240326整改临时调整
if util.DerefInt64(account.Status) != consts.Admin && util.DerefInt64(account.Status) != consts.Supportor {
ec = errcode.ErrCodeSuspend
return
}
// 2.让已登录的用户强制下线
if util.DerefInt64(login.IsLogined) == 1 {
if _, ec = s.ApiLogout(ctx, &loginproto.ApiLogoutReq{