Skip to content

Commit

Permalink
feat(wechat): official account get menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed Oct 1, 2023
1 parent 06eeacf commit 22431a6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
3 changes: 2 additions & 1 deletion api/admin/wechat/officialaccount/menu.api
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ type (
type (

QueryMenusReply struct {
Menu *OAMenu `json:"menu,optional"`
Button interface{} `json:"button"`
MatchRule interface{} `json:"matchrule"`
}
)

Expand Down
5 changes: 3 additions & 2 deletions cmd/ctl/database/migrate/powerx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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{},
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
)
Expand All @@ -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
}
2 changes: 1 addition & 1 deletion internal/logic/gethomelogic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
3 changes: 2 additions & 1 deletion internal/types/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 22431a6

Please sign in to comment.