yintai2/app/common/model/resource.go

36 lines
628 B
Go

package model
import "time"
type Resource struct {
ID int64
Name string
Type string
Code string
Path string
Method string
Pid int64
Maps string
CreateTime int64
UpdateTime int64
}
const (
ResourceTypeApi = "api"
ResourceTypePage = "page"
)
func (r *Resource) Format() map[string]any {
res := make(map[string]any)
res["id"] = r.ID
res["name"] = r.Name
res["type"] = r.Type
res["path"] = r.Path
//res["code"] = r.Code
res["pid"] = r.Pid
res["method"] = r.Method
res["create_time"] = time.Unix(r.CreateTime, 0).Format("2006-01-02 15:04:05")
return res
}