This commit is contained in:
li 2022-04-24 15:13:20 +08:00
parent 9198f8b648
commit 56f661b70d
4 changed files with 16 additions and 8 deletions

View File

@ -38,8 +38,9 @@ func GameCardList(c *gin.Context) {
}
uc := auth.GetCurrentUser(c)
if uc == nil {
RespJson(c, status.Unauthorized, nil)
return
//RespJson(c, status.Unauthorized, nil)
//return
uc = &auth.UserClaims{Uid: 0}
}
fmt.Println("游戏类型:GameTypeIds:", req.GameTypeIds)

View File

@ -48,7 +48,8 @@ func UserAccessAuth(c *gin.Context) {
token = s[1]
}
if token == "" || len(token) < 10 {
RespJson(c, status.Unauthorized, nil)
// TODO
//RespJson(c, status.Unauthorized, nil)
return
}
@ -58,9 +59,11 @@ func UserAccessAuth(c *gin.Context) {
logger.Error(err)
if err == TokenExpired {
RespJson(c, status.AccessTokenExpired, nil)
} else {
RespJson(c, status.Unauthorized, nil)
}
// TODO
//else {
// RespJson(c, status.Unauthorized, nil)
//}
return
}

View File

@ -87,7 +87,6 @@ func GetGameCardList(sortType, page, pageSize int, gameTypeIds []uint64, storeId
// logger.Error("NewGameCardQuerySet err:", err)
// return cards, 0, err
//}
user := GetUserByUid(uid)
qs := NewGameCardQuerySet(DB).IDNe(914)
switch sortType {
@ -142,9 +141,13 @@ func GetGameCardList(sortType, page, pageSize int, gameTypeIds []uint64, storeId
qs = qs.IDIn(gameIds...)
}
if user.MemberExpire.After(time.Now().AddDate(0, 0, -14)) {
if uid != 0 {
user := GetUserByUid(uid)
if user.MemberExpire.After(time.Now()) &&
user.MemberExpire.AddDate(0, 0, -14).Before(time.Now()) {
qs = qs.RealPriceLte(30000)
}
}
if count == 0 {
count, err = qs.Count()
}

View File

@ -121,6 +121,7 @@ func InitTestDB() {
&GameCard{},
&FundRecord{},
&User{},
)
fmt.Println("DB init success")