From c11180094e70ae0d7cf940b1f60a2ba177f899f6 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Sun, 31 Dec 2023 13:41:46 +0800 Subject: [PATCH 1/2] by Robin at 20231231;fix single query --- api/proto/account/proto/account_vo_api.go | 9 +++++++++ api/proto/account/proto/account_vo_op.go | 6 ++++++ .../proto/realname_authentication_api_vo.go | 3 +++ api/proto/streamer/proto/streamer_vo_op.go | 12 ++++++++++++ .../proto/streamerauthapproval_api_vo.go | 3 +++ .../proto/streamerauthapproval_op_vo.go | 3 +++ api/proto/streamerlink/proto/streamerlink_vo.go | 6 ++++++ 7 files changed, 42 insertions(+) diff --git a/api/proto/account/proto/account_vo_api.go b/api/proto/account/proto/account_vo_api.go index 9b77740e..17404811 100644 --- a/api/proto/account/proto/account_vo_api.go +++ b/api/proto/account/proto/account_vo_api.go @@ -31,6 +31,9 @@ type ApiListOthersVO struct { } func (vo *ApiListVO) CopyAccount(account *dbstruct.Account) *ApiListVO { + if account == nil { + return vo + } vo.Mid = account.Mid vo.Name = account.Name vo.UserId = account.UserId @@ -48,6 +51,9 @@ func (vo *ApiListVO) CopyAccount(account *dbstruct.Account) *ApiListVO { } func (vo *ApiListVO) CopyWallet(wallet *dbstruct.Wallet) *ApiListVO { + if wallet == nil { + return vo + } vo.GoldNum = wallet.Coins vo.DiamondNum = wallet.Diamonds vo.WithdrawDiamondNum = wallet.WithdrawDiamonds @@ -55,6 +61,9 @@ func (vo *ApiListVO) CopyWallet(wallet *dbstruct.Wallet) *ApiListVO { } func (vo *ApiListOthersVO) CopyAccount(account *dbstruct.Account) *ApiListOthersVO { + if account == nil { + return vo + } vo.Mid = account.Mid vo.Name = account.Name vo.UserId = account.UserId diff --git a/api/proto/account/proto/account_vo_op.go b/api/proto/account/proto/account_vo_op.go index 0b9b78a9..3e789fbe 100644 --- a/api/proto/account/proto/account_vo_op.go +++ b/api/proto/account/proto/account_vo_op.go @@ -30,6 +30,9 @@ type OpListOthersVO struct { } func (vo *OpListVO) CopyAccount(account *dbstruct.Account) *OpListVO { + if account == nil { + return vo + } vo.Mid = account.Mid vo.Name = account.Name vo.UserId = account.UserId @@ -47,6 +50,9 @@ func (vo *OpListVO) CopyAccount(account *dbstruct.Account) *OpListVO { } func (vo *OpListOthersVO) CopyAccount(account *dbstruct.Account) *OpListOthersVO { + if account == nil { + return vo + } vo.Mid = account.Mid vo.Name = account.Name vo.UserId = account.UserId diff --git a/api/proto/realname_authentication/proto/realname_authentication_api_vo.go b/api/proto/realname_authentication/proto/realname_authentication_api_vo.go index ab37bc84..09848bc8 100644 --- a/api/proto/realname_authentication/proto/realname_authentication_api_vo.go +++ b/api/proto/realname_authentication/proto/realname_authentication_api_vo.go @@ -13,6 +13,9 @@ type RealNameAuthenticationApiVO struct { } func (p *RealNameAuthenticationApiVO) CopyRealNameAuthentication(realname_authentication *dbstruct.RealNameAuthentication) { + if realname_authentication == nil { + return + } p.Status = util.DerefInt64(realname_authentication.Status) p.StautsDesc = consts.RealNameAuthenticationStatusDescMap[p.Status] p.Remarks = util.DerefString(realname_authentication.Remarks) diff --git a/api/proto/streamer/proto/streamer_vo_op.go b/api/proto/streamer/proto/streamer_vo_op.go index 299eda93..208286b5 100644 --- a/api/proto/streamer/proto/streamer_vo_op.go +++ b/api/proto/streamer/proto/streamer_vo_op.go @@ -50,6 +50,9 @@ type OpListExtVO struct { } func (vo *OpListExtVO) CopyAccount(account *dbstruct.Account) { + if account == nil { + return + } vo.Name = account.Name vo.UserId = account.UserId vo.Avatar = account.Avatar @@ -57,6 +60,9 @@ func (vo *OpListExtVO) CopyAccount(account *dbstruct.Account) { } func (vo *OpListExtVO) CopyStreamer(streamer *dbstruct.Streamer) { + if streamer == nil { + return + } vo.Id = streamer.Id vo.Mid = streamer.Mid vo.Gender = streamer.Gender @@ -78,6 +84,9 @@ func (vo *OpListExtVO) CopyStreamer(streamer *dbstruct.Streamer) { } func (vo *OpListExtVO) CopyPlatforms(platforms *[]*streamerlinkproto.StreamerLinkVO) { + if platforms == nil { + return + } vo.Platforms = platforms } @@ -86,6 +95,9 @@ type OpListWxIdVO struct { } func (vo *OpListWxIdVO) CopyStreamer(streamer *dbstruct.Streamer) { + if streamer == nil { + return + } vo.Mid = streamer.Mid } diff --git a/api/proto/streamerauthapproval/proto/streamerauthapproval_api_vo.go b/api/proto/streamerauthapproval/proto/streamerauthapproval_api_vo.go index 0fd4039d..ea1405cf 100644 --- a/api/proto/streamerauthapproval/proto/streamerauthapproval_api_vo.go +++ b/api/proto/streamerauthapproval/proto/streamerauthapproval_api_vo.go @@ -13,6 +13,9 @@ func (vo *StreamerAuthApprovalApiVO) CopyStreamerAuthApproval(streamerauthapprov } func (vo *StreamerAuthApprovalApiVO) CopyAccount(account *dbstruct.Account) *StreamerAuthApprovalApiVO { + if account == nil { + return vo + } vo.UserId = account.UserId return vo } diff --git a/api/proto/streamerauthapproval/proto/streamerauthapproval_op_vo.go b/api/proto/streamerauthapproval/proto/streamerauthapproval_op_vo.go index 8db359b3..f7fab28a 100644 --- a/api/proto/streamerauthapproval/proto/streamerauthapproval_op_vo.go +++ b/api/proto/streamerauthapproval/proto/streamerauthapproval_op_vo.go @@ -13,6 +13,9 @@ func (vo *StreamerAuthApprovalOpVO) CopyStreamerAuthApproval(streamerauthapprova } func (vo *StreamerAuthApprovalOpVO) CopyAccount(account *dbstruct.Account) *StreamerAuthApprovalOpVO { + if account == nil { + return vo + } vo.UserId = account.UserId return vo } diff --git a/api/proto/streamerlink/proto/streamerlink_vo.go b/api/proto/streamerlink/proto/streamerlink_vo.go index 953e0366..67a2009a 100644 --- a/api/proto/streamerlink/proto/streamerlink_vo.go +++ b/api/proto/streamerlink/proto/streamerlink_vo.go @@ -18,6 +18,9 @@ func NewStreamerLinkVO() *StreamerLinkVO { } func (vo *StreamerLinkVO) CopyStreamerLink(streamerlink *dbstruct.StreamerLink) *StreamerLinkVO { + if streamerlink == nil { + return vo + } vo.Id = streamerlink.Id vo.Mid = streamerlink.Mid vo.LinkNo = streamerlink.LinkNo @@ -32,6 +35,9 @@ func (vo *StreamerLinkVO) CopyStreamerLink(streamerlink *dbstruct.StreamerLink) } func (vo *StreamerLinkVO) CopyPlatformCfg(platformCfg *apollostruct.PlatformCfg) *StreamerLinkVO { + if platformCfg == nil { + return vo + } vo.Name = platformCfg.Name vo.Icon = platformCfg.Icon return vo -- 2.41.0 From 5945014c7e25ad1045bf809ffa8ee4ffc73b1108 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Sun, 31 Dec 2023 13:44:04 +0800 Subject: [PATCH 2/2] by Robin at 20231231; fix not enabled info --- api/errcode/errcode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/errcode/errcode.go b/api/errcode/errcode.go index 93b8a398..b61e493f 100644 --- a/api/errcode/errcode.go +++ b/api/errcode/errcode.go @@ -31,7 +31,7 @@ var ErrCodeMsgMap = map[ErrCode]string{ ErrCodeLoginVeriCodeExpired: "验证码已过期", ErrCodeLoginAcctLocked: "登录账户尝试爆破登录,已被锁定", ErrCodeLoginAcctBanned: "登录账户已被封禁", - ErrCodeLoginAcctNotEnabled: "登录账户未启用", + ErrCodeLoginAcctNotEnabled: "登录账户未设置密码,请使用验证码登录", ErrCodeLoginNoChangeInAPswdReset: "新旧密码相同", ErrCodeLoginRegisterUserFail: "账号注册失败,请稍后重试", ErrCodeLoginWrongOldPswd: "旧密码错误", -- 2.41.0