diff --git a/api/admin/wechat/officialaccount/menu.api b/api/admin/wechat/officialaccount/menu.api index 426d1324..e3e07a9f 100644 --- a/api/admin/wechat/officialaccount/menu.api +++ b/api/admin/wechat/officialaccount/menu.api @@ -96,7 +96,8 @@ type ( type ( QueryMenusReply struct { - Menu *OAMenu `json:"menu,optional"` + Button interface{} `json:"button"` + MatchRule interface{} `json:"matchrule"` } ) diff --git a/cmd/ctl/database/migrate/powerx.go b/cmd/ctl/database/migrate/powerx.go index aac8c38d..f815cc8d 100644 --- a/cmd/ctl/database/migrate/powerx.go +++ b/cmd/ctl/database/migrate/powerx.go @@ -6,11 +6,11 @@ import ( "PowerX/internal/model" "PowerX/internal/model/crm/customerdomain" "PowerX/internal/model/crm/market" + "PowerX/internal/model/crm/membership" "PowerX/internal/model/crm/product" "PowerX/internal/model/crm/trade" infoorganizatoin "PowerX/internal/model/infoorganization" "PowerX/internal/model/media" - "PowerX/internal/model/membership" "PowerX/internal/model/origanzation" "PowerX/internal/model/permission" "PowerX/internal/model/scene" @@ -19,6 +19,7 @@ import ( "PowerX/internal/model/scrm/organization" "PowerX/internal/model/scrm/resource" "PowerX/internal/model/scrm/tag" + "PowerX/internal/model/wechat" "gorm.io/driver/mysql" "gorm.io/driver/postgres" "gorm.io/gorm" @@ -58,7 +59,7 @@ func (m *PowerMigrator) AutoMigrate() { // customer domain _ = m.db.AutoMigrate(&customerdomain.Lead{}, &customerdomain.Contact{}, &customerdomain.Customer{}, &membership.Membership{}) - _ = m.db.AutoMigrate(&model.WechatOACustomer{}, &model.WechatMPCustomer{}, &model.WeWorkExternalContact{}) + _ = m.db.AutoMigrate(&wechat.WechatOACustomer{}, &wechat.WechatMPCustomer{}, &wechat.WeWorkExternalContact{}) _ = m.db.AutoMigrate( &product.PivotProductToProductCategory{}, ) diff --git a/internal/logic/admin/wechat/officialaccount/menu/querymenuslogic.go b/internal/logic/admin/wechat/officialaccount/menu/querymenuslogic.go index eac016b4..87d0d64e 100644 --- a/internal/logic/admin/wechat/officialaccount/menu/querymenuslogic.go +++ b/internal/logic/admin/wechat/officialaccount/menu/querymenuslogic.go @@ -1,10 +1,11 @@ package menu import ( - "context" - "PowerX/internal/svc" "PowerX/internal/types" + "PowerX/internal/types/errorx" + "context" + "github.com/ArtisanCloud/PowerLibs/v3/object" "github.com/zeromicro/go-zero/core/logx" ) @@ -24,7 +25,17 @@ func NewQueryMenusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QueryM } func (l *QueryMenusLogic) QueryMenus() (resp *types.QueryMenusReply, err error) { - // todo: add your logic here and delete this line - return + res, err := l.svcCtx.PowerX.WechatOA.App.Menu.Get(l.ctx) + if err != nil { + return nil, err + } + if res.ErrCode != 0 { + return nil, errorx.WithCause(errorx.ErrNotFoundObject, res.ErrMsg) + } + + return &types.QueryMenusReply{ + Button: res.Menus.Buttons, + MatchRule: object.HashMap{}, + }, nil } diff --git a/internal/logic/gethomelogic.go b/internal/logic/gethomelogic.go index 3077e90f..12670986 100644 --- a/internal/logic/gethomelogic.go +++ b/internal/logic/gethomelogic.go @@ -27,6 +27,6 @@ func (l *GetHomeLogic) GetHome() (resp *types.GetHomeReply, err error) { return &types.GetHomeReply{ Greet: "Hello, I am PowerX!", Description: "This is awesome! you create me and make me alive", - Version: "V1.0.0", + Version: "V1.0.1", }, nil } diff --git a/internal/types/types.go b/internal/types/types.go index 86888c6f..71736bdb 100644 --- a/internal/types/types.go +++ b/internal/types/types.go @@ -2828,7 +2828,8 @@ type CreateMenuReply struct { } type QueryMenusReply struct { - Menu *OAMenu `json:"menu,optional"` + Button interface{} `json:"button"` + MatchRule interface{} `json:"matchrule"` } type DeleteMenuReply struct {