1、修改模型服务bug
This commit is contained in:
		
							parent
							
								
									5c8be63b8e
								
							
						
					
					
						commit
						3532dc294e
					
				|  | @ -68,7 +68,7 @@ func JwtAuthMiddleware(logger *zap.Logger) gin.HandlerFunc { | ||||||
| 			usClaims *Claims | 			usClaims *Claims | ||||||
| 			user     *model.SystemUser | 			user     *model.SystemUser | ||||||
| 		) | 		) | ||||||
| 		token := c.GetHeader("token") | 		token := c.GetHeader("Authorization") | ||||||
| 		// 这里可以过滤不需要进行验证的接口
 | 		// 这里可以过滤不需要进行验证的接口
 | ||||||
| 		if path == "/user/login" || path == "/health" { | 		if path == "/user/login" || path == "/health" { | ||||||
| 			goto Return | 			goto Return | ||||||
|  |  | ||||||
|  | @ -2,15 +2,15 @@ package proto | ||||||
| 
 | 
 | ||||||
| // BaseResponse 基础返回结构
 | // BaseResponse 基础返回结构
 | ||||||
| type BaseResponse struct { | type BaseResponse struct { | ||||||
| 	Code      int         `json:"code"` | 	Code    int         `json:"code"` | ||||||
| 	Message   string      `json:"message"` | 	Message string      `json:"message"` | ||||||
| 	Data      interface{} `json:"result,omitempty"` | 	Data    interface{} `json:"result,omitempty"` | ||||||
| 	Status    string      `json:"type,omitempty"` | 	Status  string      `json:"type,omitempty"` | ||||||
| 	Err       error       `json:"error,omitempty"`     // 错误堆栈
 | 	Err     error       `json:"error,omitempty"` // 错误堆栈
 | ||||||
| 	Page      int64       `json:"page,omitempty"`      //当前页码
 | 	//Page      int64       `json:"page,omitempty"`      //当前页码
 | ||||||
| 	PageSize  int64       `json:"pageSize,omitempty"`  // 单页显示记录数--前端参数2
 | 	//PageSize  int64       `json:"pageSize,omitempty"`  // 单页显示记录数--前端参数2
 | ||||||
| 	PageCount int64       `json:"totalPage,omitempty"` // 总页数
 | 	//PageCount int64       `json:"totalPage,omitempty"` // 总页数
 | ||||||
| 	TotalSize int64       `json:"totalRow,omitempty"`  // 总记录数
 | 	//TotalSize int64       `json:"total,omitempty"`     // 总记录数
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type UserLoginResponse struct { | type UserLoginResponse struct { | ||||||
|  |  | ||||||
|  | @ -14,19 +14,28 @@ import ( | ||||||
| 	"xorm.io/xorm" | 	"xorm.io/xorm" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | type PagingStruct struct { | ||||||
|  | 	List  interface{} `json:"list"` | ||||||
|  | 	Total int64       `json:"total"` | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // FillPaging 填充分页数据
 | // FillPaging 填充分页数据
 | ||||||
| func FillPaging(count int64, pageNum int64, pageSize int64, list interface{}, data *proto.BaseResponse) *proto.BaseResponse { | func FillPaging(count int64, pageNum int64, pageSize int64, list interface{}, data *proto.BaseResponse) *proto.BaseResponse { | ||||||
| 	var tp int64 | 	//var tp int64
 | ||||||
| 	if count%pageSize > 0 { | 	//if count%pageSize > 0 {
 | ||||||
| 		tp = count/pageSize + 1 | 	//	tp = count/pageSize + 1
 | ||||||
| 	} else { | 	//} else {
 | ||||||
| 		tp = count / pageSize | 	//	tp = count / pageSize
 | ||||||
| 	} | 	//}
 | ||||||
| 	data.PageSize = pageSize | 	ps := new(PagingStruct) | ||||||
| 	data.Data = list | 	ps.List = list | ||||||
| 	data.Page = pageNum | 	ps.Total = count | ||||||
| 	data.PageCount = tp | 	data.Data = ps | ||||||
| 	data.TotalSize = count | 	//data.PageSize = pageSize
 | ||||||
|  | 	//data.Data = list
 | ||||||
|  | 	//data.Page = pageNum
 | ||||||
|  | 	//data.PageCount = tp
 | ||||||
|  | 	//data.TotalSize = count
 | ||||||
| 	return data | 	return data | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -35,6 +35,8 @@ func New(driveName, dsn string) { | ||||||
| 		&MatterService{}, | 		&MatterService{}, | ||||||
| 		&MatterServiceParams{}, | 		&MatterServiceParams{}, | ||||||
| 		&MatterVersion{}, | 		&MatterVersion{}, | ||||||
|  | 		&Model{}, | ||||||
|  | 		&ModelVersion{}, | ||||||
| 		&Node{}, | 		&Node{}, | ||||||
| 		&OriginalData{}, | 		&OriginalData{}, | ||||||
| 		&Owner{}, | 		&Owner{}, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue