45 lines
1.5 KiB
Go
45 lines
1.5 KiB
Go
|
package entity
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
MenuIdOrNameExiErr = errors.New("ID OR Name exists")
|
||
|
MenuLockKey = "mop_app_manage_svr_menu_lock_key"
|
||
|
)
|
||
|
|
||
|
type MenuInfo struct {
|
||
|
TraceId string `bson:"traceId" json:"traceId"`
|
||
|
Name string `bson:"name" json:"name"`
|
||
|
InfoId string `bson:"infoId" json:"infoId"`
|
||
|
ImageUrl string `bson:"imageUrl" json:"imageUrl"`
|
||
|
SortNum int `bson:"sortNum" json:"sortNum"`
|
||
|
CreateTime int64 `bson:"createTime" json:"createTime"`
|
||
|
UpdateTime int64 `bson:"updateTime" json:"updateTime"`
|
||
|
UpdateOperator string `bson:"updateOperator" json:"updateOperator"`
|
||
|
}
|
||
|
|
||
|
//type IMenuInfoRepo interface {
|
||
|
// GetInfoByTraceId(ctx context.Context, id string) (*MenuInfo, error)
|
||
|
// GetAllMenuList(ctx context.Context, sort []string) ([]MenuInfo, int, error)
|
||
|
// Add(ctx context.Context, info *MenuInfo) error
|
||
|
// GetNextSortNum(ctx context.Context) (int, error)
|
||
|
// DelByTraceId(ctx context.Context, id string) error
|
||
|
// UpdateInfo(ctx context.Context, id string, info *MenuInfo) error
|
||
|
// AllCount(ctx context.Context) (int, error)
|
||
|
// Sort(ctx context.Context, req *apiproto.MenuSortReq) error
|
||
|
// NotFound(err error) bool
|
||
|
//}
|
||
|
//
|
||
|
//func Lock(ctx context.Context, t time.Duration) error {
|
||
|
// notExi, _ := utils.Setnx(ctx, MenuLockKey, "ok", int(t.Seconds()))
|
||
|
// if notExi {
|
||
|
// return nil
|
||
|
// }
|
||
|
// return errors.New("try lock err")
|
||
|
//}
|
||
|
//func Unlock(ctx context.Context) error {
|
||
|
// return fcredis.Client().Del(ctx, MenuLockKey).Err()
|
||
|
//}
|