修改奖励类型,游戏列表接口,
This commit is contained in:
@ -31,7 +31,7 @@ type UpdateReq struct {
|
|||||||
GameName string `json:"gameName" v:"required#游戏名称不能为空" dc:"游戏名称"`
|
GameName string `json:"gameName" v:"required#游戏名称不能为空" dc:"游戏名称"`
|
||||||
GameCode string `json:"gameCode" v:"required#游戏代号不能为空" dc:"游戏代号"`
|
GameCode string `json:"gameCode" v:"required#游戏代号不能为空" dc:"游戏代号"`
|
||||||
Avatar string `json:"avatar" dc:"游戏图标"`
|
Avatar string `json:"avatar" dc:"游戏图标"`
|
||||||
Id int64 `json:"id" v:"required#游戏ID不能为空" dc:"ID"`
|
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateRes struct {
|
type UpdateRes struct {
|
||||||
|
|||||||
@ -150,9 +150,15 @@ func (s *sReward) ListSystemReward(ctx context.Context, in *model.RewardListIn)
|
|||||||
m = m.Where(do.Rewards{RewardTypeId: in.RewardTypeID})
|
m = m.Where(do.Rewards{RewardTypeId: in.RewardTypeID})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if in.Status > 0 {
|
||||||
|
m = m.Where(do.Rewards{
|
||||||
|
Status: in.Status,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
list := make([]model.Reward, 0)
|
list := make([]model.Reward, 0)
|
||||||
var total int
|
var total int
|
||||||
err = m.Page(in.Page, in.Size).Where(do.Rewards{RewardScope: 1, Status: in.Status}).OrderDesc(dao.Rewards.Columns().CreatedAt).OrderDesc(dao.Rewards.Columns().Id).ScanAndCount(&list, &total, false)
|
err = m.Page(in.Page, in.Size).Where(do.Rewards{RewardScope: 1}).OrderDesc(dao.Rewards.Columns().CreatedAt).OrderDesc(dao.Rewards.Columns().Id).ScanAndCount(&list, &total, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ecode.Fail.Sub("查询系统奖励失败")
|
return nil, ecode.Fail.Sub("查询系统奖励失败")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ type Game struct {
|
|||||||
GameName string `json:"gameName" orm:"game_name"` // 游戏名称
|
GameName string `json:"gameName" orm:"game_name"` // 游戏名称
|
||||||
GameCode string `json:"gameCode" orm:"game_code"` // 游戏代号
|
GameCode string `json:"gameCode" orm:"game_code"` // 游戏代号
|
||||||
Avatar string `json:"avatar" orm:"avatar"` // 图标
|
Avatar string `json:"avatar" orm:"avatar"` // 图标
|
||||||
|
Id int64 `json:"id" orm:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GameListIn 游戏列表入参
|
// GameListIn 游戏列表入参
|
||||||
|
|||||||
@ -1,13 +1,20 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import "github.com/gogf/gf/v2/frame/g"
|
import (
|
||||||
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
|
)
|
||||||
|
|
||||||
type RewardType struct {
|
type RewardType struct {
|
||||||
g.Meta `orm:"table:reward_type"`
|
g.Meta `orm:"table:reward_type"`
|
||||||
Id int64 `json:"id" dc:"ID" orm:"id,primary"`
|
Id int64 `json:"id" dc:"ID" orm:"id,primary"`
|
||||||
Name string `json:"name" dc:"名称" orm:"name"`
|
Name string `json:"name" dc:"名称" orm:"name"`
|
||||||
Sort int `json:"sort" dc:"排序" orm:"sort"`
|
Code string `json:"code" dc:"代号" orm:"code"`
|
||||||
Status int `json:"status" dc:"状态:1=启用,2=禁用" orm:"status"`
|
Status int `json:"status" dc:"状态:1=启用,2=禁用" orm:"status"`
|
||||||
|
Description string `json:"description" dc:"描述" orm:"description"`
|
||||||
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"`
|
||||||
|
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"`
|
||||||
|
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"删除时间"`
|
||||||
}
|
}
|
||||||
type RewardTypeIn struct {
|
type RewardTypeIn struct {
|
||||||
Page int
|
Page int
|
||||||
|
|||||||
@ -9,6 +9,7 @@ var (
|
|||||||
Logout = New(5, "用户未登录")
|
Logout = New(5, "用户未登录")
|
||||||
Disabled = New(6, "账户已被禁用")
|
Disabled = New(6, "账户已被禁用")
|
||||||
Denied = New(7, "没有权限执行该操作")
|
Denied = New(7, "没有权限执行该操作")
|
||||||
|
Expire = New(8, "token已过期")
|
||||||
Auth = New(1000, "账户名或密码不正确")
|
Auth = New(1000, "账户名或密码不正确")
|
||||||
Password = New(1001, "密码不正确")
|
Password = New(1001, "密码不正确")
|
||||||
EmailExist = New(1002, "该邮箱已被注册")
|
EmailExist = New(1002, "该邮箱已被注册")
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package jwt
|
package jwt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"server/utility/ecode"
|
"server/utility/ecode"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -99,6 +100,9 @@ func ParseToken(tokenString string) (*TokenOut, error) {
|
|||||||
return secretKey, nil
|
return secretKey, nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Is(err, jwt.ErrTokenExpired) {
|
||||||
|
return nil, ecode.Expire.Sub("token 已过期")
|
||||||
|
}
|
||||||
return nil, ecode.Fail.Sub("解析 token 出现异常")
|
return nil, ecode.Fail.Sub("解析 token 出现异常")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user