From 4b15c89c738f10d912b9337b3ff6fd5e20a3c1a0 Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Fri, 16 Jun 2023 14:01:29 +0800 Subject: [PATCH] 3.9.0 --- route/cp_r/cp_relation.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/route/cp_r/cp_relation.go b/route/cp_r/cp_relation.go index b274afb..4c70879 100644 --- a/route/cp_r/cp_relation.go +++ b/route/cp_r/cp_relation.go @@ -417,6 +417,9 @@ func CpDetailPage(c *gin.Context) (*mycontext.MyContext, error) { if err != nil { return myCtx, err } + if user == nil || user.ID == 0 { + return myCtx, bizerr.InvalidParameter + } cp, err := cp_m.GetCp(model, user.ID) if err != nil { @@ -434,12 +437,14 @@ func CpDetailPage(c *gin.Context) (*mycontext.MyContext, error) { res = new(CpDetail) // 返回值 level := cp_m.GetCpLevel(model, cp.Id) - res.CpLevel = cp_cv.CvCpLevel{ - Level: level.Level, - Points: cp_e.CpLevelPoints[level.Level] + level.Points, - StartPoints: cp_e.CpLevelPoints[level.Level], - ExpireAtUnix: level.ExpireAt.Unix(), - SettlementDate: level.ExpireAt.Format(utils.DATE_FORMAT), + if level.ID > 0 { + res.CpLevel = cp_cv.CvCpLevel{ + Level: level.Level, + Points: cp_e.CpLevelPoints[level.Level] + level.Points, + StartPoints: cp_e.CpLevelPoints[level.Level], + ExpireAtUnix: level.ExpireAt.Unix(), + SettlementDate: level.ExpireAt.Format(utils.DATE_FORMAT), + } } if res.CpLevel.Level != cp_e.CpLevelMax { res.CpLevel.EndPoints = cp_e.CpLevelPoints[res.CpLevel.Level+1] -- 2.22.0