mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-12-24 08:12:55 +08:00
Copy摞动位置
This commit is contained in:
@@ -1,9 +1,24 @@
|
||||
package response
|
||||
|
||||
//PageResp 分页返回值
|
||||
import (
|
||||
"x_admin/core"
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
)
|
||||
|
||||
// PageResp 分页返回值
|
||||
type PageResp struct {
|
||||
Count int64 `json:"count"` // 总数
|
||||
PageNo int `json:"pageNo"` // 每页数量
|
||||
PageSize int `json:"pageSize"` // 每页Size
|
||||
Lists interface{} `json:"lists"` // 数据
|
||||
}
|
||||
|
||||
// Copy 拷贝结构体
|
||||
func Copy(toValue interface{}, fromValue interface{}) interface{} {
|
||||
if err := copier.Copy(toValue, fromValue); err != nil {
|
||||
core.Logger.Errorf("Copy err: err=[%+v]", err)
|
||||
panic(SystemError)
|
||||
}
|
||||
return toValue
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-sql-driver/mysql"
|
||||
"github.com/jinzhu/copier"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -95,15 +94,6 @@ func Result(c *gin.Context, resp RespType, data interface{}) {
|
||||
})
|
||||
}
|
||||
|
||||
// Copy 拷贝结构体
|
||||
func Copy(toValue interface{}, fromValue interface{}) interface{} {
|
||||
if err := copier.Copy(toValue, fromValue); err != nil {
|
||||
core.Logger.Errorf("Copy err: err=[%+v]", err)
|
||||
panic(SystemError)
|
||||
}
|
||||
return toValue
|
||||
}
|
||||
|
||||
// Ok 正常响应
|
||||
func Ok(c *gin.Context) {
|
||||
Result(c, Success, nil)
|
||||
|
||||
Reference in New Issue
Block a user