1、修改模型服务bug

This commit is contained in:
wangjian 2023-01-06 16:10:18 +08:00
parent 5c8be63b8e
commit 3532dc294e
4 changed files with 32 additions and 21 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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
}

View File

@ -35,6 +35,8 @@ func New(driveName, dsn string) {
&MatterService{},
&MatterServiceParams{},
&MatterVersion{},
&Model{},
&ModelVersion{},
&Node{},
&OriginalData{},
&Owner{},