feat(app): update

This commit is contained in:
Yangtao
2025-11-19 14:24:13 +08:00
parent 1eac66d7fd
commit 0c34585649
329 changed files with 10760 additions and 281 deletions

View File

@ -0,0 +1,62 @@
package request
import (
"errors"
"gitea.ddegame.cn/open/servicebase/pkg/tools"
)
type BaseRequest struct {
AccessToken string
}
// 参数合法性检验
func (request *BaseRequest) CheckParameter() (err error) {
if len(request.AccessToken) == 0 {
err = errors.New("AccessToken不能为空")
return
}
return
}
type IdReq struct {
BaseRequest
BizId string
}
func (request *IdReq) CheckParameter() (e error) {
if e = request.BaseRequest.CheckParameter(); e != nil {
return
}
if len(request.BizId) == 0 {
return errors.New("BizId不能为空")
}
return
}
type BasePageReq struct {
BaseRequest
Page string
Size string
}
func (d *BasePageReq) Check() (e error) {
if e = d.BaseRequest.CheckParameter(); e != nil {
return
}
if len(d.Page) == 0 {
d.Page = "0"
}
if len(d.Size) == 0 {
d.Size = "10"
}
return
}
func (d *BasePageReq) Offset() int {
return tools.StrToInt(d.Page) * tools.StrToInt(d.Size)
}
func (d *BasePageReq) Limit() int {
return tools.StrToInt(d.Size)
}