Explorar el Código

update 完善代码逻辑

Alvin hace 8 meses
padre
commit
e7000e48bf

+ 14 - 2
game/game_cluster/nodes/webadmin/service/playerMange.go

@@ -635,8 +635,20 @@ func (a *PlayerManage) PlayerInfo(ctx context.Context, req entity.PlayerInfoReq)
 
 			return 0
 		}(),
-		Successions:    loginRecord.ContinuousDays,
-		MaxSuccessions: loginRecord.ContinuousDaysMax,
+		Successions: func() int {
+			if loginRecord != nil {
+				return loginRecord.ContinuousDays
+			}
+
+			return 0
+		}(),
+		MaxSuccessions: func() int {
+			if loginRecord != nil {
+				return loginRecord.ContinuousDaysMax
+			}
+
+			return 0
+		}(),
 		PrevTime: func() int64 {
 			if loginRecord != nil {
 				return loginRecord.CreateAt

+ 95 - 39
game/game_cluster/nodes/webadmin/service/synthesis.go

@@ -133,11 +133,6 @@ func (s *Synthesis) getOverviewDetail(userName string) (*entity.OverviewDetail,
 		return nil, codeResult
 	}
 
-	if loginRecord == nil {
-		mhayaLogger.Warnf("getOverviewDetail loginRecord:%v", loginRecord)
-		return nil, nil
-	}
-
 	return &entity.OverviewDetail{
 		UserName:                   userName,
 		OpenId:                     userDetail.OpenId,
@@ -151,11 +146,29 @@ func (s *Synthesis) getOverviewDetail(userName string) (*entity.OverviewDetail,
 		Withdrawals:                activeDetail.Withdrawals,
 		CumulativeWithdrawalAmount: activeDetail.CumulativeWithdrawalAmount,
 		TurntableRuns:              activeDetail.TurntableRuns,
-		PointsRanking:              loginRecord.PointsRankSeq,
-		RankingOfDiceRolls:         loginRecord.ThrowDiceRankSeq,
-		InvitesRanking:             loginRecord.InviteUserRankSeq,
-		TonValue:                   assetDetail.TonValue,
-		UsdtValue:                  assetDetail.UsdtValue,
+		PointsRanking: func() int64 {
+			if loginRecord != nil {
+				return loginRecord.PointsRankSeq
+			}
+
+			return 0
+		}(),
+		RankingOfDiceRolls: func() int64 {
+			if loginRecord != nil {
+				return loginRecord.ThrowDiceRankSeq
+			}
+
+			return 0
+		}(),
+		InvitesRanking: func() int64 {
+			if loginRecord != nil {
+				return loginRecord.InviteUserRankSeq
+			}
+
+			return 0
+		}(),
+		TonValue:  assetDetail.TonValue,
+		UsdtValue: assetDetail.UsdtValue,
 	}, nil
 }
 
@@ -243,11 +256,6 @@ func (s *Synthesis) getUserDetail(userName string) (*entity.UserListDetail, *cod
 		return nil, codeResult
 	}
 
-	if firstLoginRecord == nil {
-		mhayaLogger.Warnf("getUserDetail firstLoginRecord:%v", firstLoginRecord)
-		return nil, nil
-	}
-
 	// 获取最新的用户登录记录
 	loginRecord, codeResult := playerMgr.GetPlayerLastestLoginRecord(userName)
 	if codeResult != nil {
@@ -255,20 +263,51 @@ func (s *Synthesis) getUserDetail(userName string) (*entity.UserListDetail, *cod
 		return nil, codeResult
 	}
 
-	if loginRecord == nil {
-		mhayaLogger.Warnf("getUserDetail loginRecord:%v", loginRecord)
-		return nil, nil
-	}
-
 	return &entity.UserListDetail{
-		UserName:       userName,
-		OpenId:         loginRecord.TgId,
-		CreateTime:     registerRecord.CreateAt,
-		FirstLoginDate: firstLoginRecord.CreateAt,
-		LoginIP:        loginRecord.Ip,
-		LastLoginTime:  loginRecord.CreateAt,
-		TonWall:        loginRecord.TonWall,
-		Fingerprint:    loginRecord.Fingerprint,
+		UserName: userName,
+		OpenId: func() string {
+			if loginRecord != nil {
+				return loginRecord.TgId
+			}
+
+			return ""
+		}(),
+		CreateTime: registerRecord.CreateAt,
+		FirstLoginDate: func() int64 {
+			if firstLoginRecord != nil {
+				return firstLoginRecord.CreateAt
+			}
+
+			return 0
+		}(),
+		LoginIP: func() string {
+			if loginRecord != nil {
+				return loginRecord.Ip
+			}
+
+			return ""
+		}(),
+		LastLoginTime: func() int64 {
+			if loginRecord != nil {
+				return loginRecord.CreateAt
+			}
+
+			return 0
+		}(),
+		TonWall: func() string {
+			if loginRecord != nil {
+				return loginRecord.TonWall
+			}
+
+			return ""
+		}(),
+		Fingerprint: func() string {
+			if loginRecord != nil {
+				return loginRecord.Fingerprint
+			}
+
+			return ""
+		}(),
 	}, nil
 }
 
@@ -1202,11 +1241,6 @@ func (s *Synthesis) getActive(userName string) (*entity.ActiveDetail, *code.Resu
 		return nil, codeResult
 	}
 
-	if loginRecord == nil {
-		mhayaLogger.Warnf("getActive loginRecord:%v", loginRecord)
-		return nil, nil
-	}
-
 	// 邀请成功人数
 	inviteCount, codeResult := playerMgr.GetSuccessfulInvitations(userName, 0)
 	if codeResult != nil {
@@ -1237,11 +1271,29 @@ func (s *Synthesis) getActive(userName string) (*entity.ActiveDetail, *code.Resu
 	}
 
 	return &entity.ActiveDetail{
-		UserName:                   userName,
-		IfUserVip:                  loginRecord.IfTgVip,
-		CreateTime:                 registerRecord.CreateAt,
-		LastLoginTime:              loginRecord.CreateAt,
-		MaxSuccessions:             loginRecord.ContinuousDaysMax,
+		UserName: userName,
+		IfUserVip: func() bool {
+			if loginRecord != nil {
+				return loginRecord.IfTgVip
+			}
+
+			return false
+		}(),
+		CreateTime: registerRecord.CreateAt,
+		LastLoginTime: func() int64 {
+			if loginRecord != nil {
+				return loginRecord.CreateAt
+			}
+
+			return 0
+		}(),
+		MaxSuccessions: func() int {
+			if loginRecord != nil {
+				return loginRecord.ContinuousDaysMax
+			}
+
+			return 0
+		}(),
 		SuccessfulInvitations:      inviteCount,
 		Withdrawals:                withdrawCount,
 		CumulativeWithdrawalAmount: cumulativeWithdrawalAmount,
@@ -1379,7 +1431,11 @@ func (s *Synthesis) getTaskCompletionDetail(userName string) (*entity.TaskComple
 			return joinDcRecord != nil
 		}(),
 		IsBindTwitter: func() bool {
-			return updateRecord.XId == ""
+			if updateRecord != nil {
+				return updateRecord.XId == ""
+			}
+
+			return false
 		}(),
 		IsFollowYoutube: func() bool {
 			return followYoutubeRecord != nil