diff --git a/internal/middleware/jwt.go b/internal/middleware/jwt.go index 0ec1538..084c59d 100644 --- a/internal/middleware/jwt.go +++ b/internal/middleware/jwt.go @@ -68,7 +68,7 @@ func JwtAuthMiddleware(logger *zap.Logger) gin.HandlerFunc { usClaims *Claims user *model.SystemUser ) - token := c.GetHeader("token") + token := c.GetHeader("Authorization") // 这里可以过滤不需要进行验证的接口 if path == "/user/login" || path == "/health" { goto Return diff --git a/internal/proto/response.go b/internal/proto/response.go index 0fea006..3daf080 100644 --- a/internal/proto/response.go +++ b/internal/proto/response.go @@ -2,15 +2,15 @@ package proto // BaseResponse 基础返回结构 type BaseResponse struct { - Code int `json:"code"` - Message string `json:"message"` - Data interface{} `json:"result,omitempty"` - Status string `json:"type,omitempty"` - Err error `json:"error,omitempty"` // 错误堆栈 - Page int64 `json:"page,omitempty"` //当前页码 - PageSize int64 `json:"pageSize,omitempty"` // 单页显示记录数--前端参数2 - PageCount int64 `json:"totalPage,omitempty"` // 总页数 - TotalSize int64 `json:"totalRow,omitempty"` // 总记录数 + Code int `json:"code"` + Message string `json:"message"` + Data interface{} `json:"result,omitempty"` + Status string `json:"type,omitempty"` + Err error `json:"error,omitempty"` // 错误堆栈 + //Page int64 `json:"page,omitempty"` //当前页码 + //PageSize int64 `json:"pageSize,omitempty"` // 单页显示记录数--前端参数2 + //PageCount int64 `json:"totalPage,omitempty"` // 总页数 + //TotalSize int64 `json:"total,omitempty"` // 总记录数 } type UserLoginResponse struct { diff --git a/internal/service/index.go b/internal/service/index.go index 0edad5d..c5563e5 100644 --- a/internal/service/index.go +++ b/internal/service/index.go @@ -14,19 +14,28 @@ import ( "xorm.io/xorm" ) +type PagingStruct struct { + List interface{} `json:"list"` + Total int64 `json:"total"` +} + // FillPaging 填充分页数据 func FillPaging(count int64, pageNum int64, pageSize int64, list interface{}, data *proto.BaseResponse) *proto.BaseResponse { - var tp int64 - if count%pageSize > 0 { - tp = count/pageSize + 1 - } else { - tp = count / pageSize - } - data.PageSize = pageSize - data.Data = list - data.Page = pageNum - data.PageCount = tp - data.TotalSize = count + //var tp int64 + //if count%pageSize > 0 { + // tp = count/pageSize + 1 + //} else { + // tp = count / pageSize + //} + ps := new(PagingStruct) + ps.List = list + ps.Total = count + data.Data = ps + //data.PageSize = pageSize + //data.Data = list + //data.Page = pageNum + //data.PageCount = tp + //data.TotalSize = count return data } diff --git a/model/index.go b/model/index.go index 350ac62..cbc1958 100644 --- a/model/index.go +++ b/model/index.go @@ -35,6 +35,8 @@ func New(driveName, dsn string) { &MatterService{}, &MatterServiceParams{}, &MatterVersion{}, + &Model{}, + &ModelVersion{}, &Node{}, &OriginalData{}, &Owner{},