This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
)
|
||||
|
||||
// MpMenu 微信公众号菜单表
|
||||
type MpMenu struct {
|
||||
global.GVA_MODEL
|
||||
Name *string `json:"name" gorm:"type:varchar(255);comment:菜单名称"`
|
||||
MenuKey *string `json:"menuKey" gorm:"type:varchar(255);comment:菜单标识"`
|
||||
ParentID *string `json:"parentId" gorm:"type:varchar(32);index;comment:父ID"`
|
||||
Type string `json:"type" gorm:"type:varchar(32);not null;default:'';index;comment:按钮类型"`
|
||||
URL *string `json:"url" gorm:"type:varchar(500);comment:网页链接"`
|
||||
MiniProgramAppID *string `json:"miniProgramAppId" gorm:"type:varchar(32);comment:小程序appid"`
|
||||
MiniProgramPagePath *string `json:"miniProgramPagePath" gorm:"type:varchar(200);comment:小程序页面路径"`
|
||||
ReplyMessageType *string `json:"replyMessageType" gorm:"type:varchar(32);comment:消息类型"`
|
||||
ReplyContent *string `json:"replyContent" gorm:"type:varchar(1024);comment:回复的消息内容"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
func (MpMenu) TableName() string {
|
||||
return "mp_menu"
|
||||
}
|
||||
|
||||
// MenuType 菜单类型常量
|
||||
const (
|
||||
MenuTypeClick = "click" // 点击推事件
|
||||
MenuTypeView = "view" // 跳转URL
|
||||
MenuTypeScanCodePush = "scancode_push" // 扫码推事件
|
||||
MenuTypeScanCodeWaitMsg = "scancode_waitmsg" // 扫码推事件且弹出"消息接收中"提示框
|
||||
MenuTypePicSysPhoto = "pic_sysphoto" // 弹出系统拍照发图
|
||||
MenuTypePicPhotoOrAlbum = "pic_photo_or_album" // 弹出拍照或者相册发图
|
||||
MenuTypePicWeixin = "pic_weixin" // 弹出微信相册发图器
|
||||
MenuTypeLocationSelect = "location_select" // 弹出地理位置选择器
|
||||
MenuTypeMiniProgram = "miniprogram" // 小程序
|
||||
)
|
||||
|
||||
// IsClickType 是否为点击类型
|
||||
func (m *MpMenu) IsClickType() bool {
|
||||
return m.Type == MenuTypeClick
|
||||
}
|
||||
|
||||
// IsViewType 是否为跳转类型
|
||||
func (m *MpMenu) IsViewType() bool {
|
||||
return m.Type == MenuTypeView
|
||||
}
|
||||
|
||||
// IsMiniProgramType 是否为小程序类型
|
||||
func (m *MpMenu) IsMiniProgramType() bool {
|
||||
return m.Type == MenuTypeMiniProgram
|
||||
}
|
||||
|
||||
// HasParent 是否有父菜单
|
||||
func (m *MpMenu) HasParent() bool {
|
||||
return m.ParentID != nil && *m.ParentID != ""
|
||||
}
|
||||
Reference in New Issue
Block a user