-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wechat): official account with menu setting
- Loading branch information
Showing
14 changed files
with
409 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,2 @@ | ||
import "admin/scrm/contactway.api" | ||
//import "admin/scrm/customer.api" | ||
//import "admin/scrm/contact.api" | ||
// organzation | ||
import "admin/scrm/organization/weworkemployee.api" | ||
import "admin/scrm/organization/weworkdepartment.api" | ||
// app | ||
import "admin/scrm/app/weworkgroup.api" | ||
import "admin/scrm/app/weworkapp.api" | ||
import "admin/scrm/app/weworkappmessage.api" | ||
// wechat.customer | ||
import "admin/scrm/customer/weworkcustomer.api" | ||
import "admin/scrm/customer/weworkcustomergroup.api" | ||
// bot | ||
import "admin/scrm/bot/weworkbot.api" | ||
// resource | ||
import "admin/scrm/resource/weworkresource.api" | ||
// qrcode | ||
import "admin/scrm/qrcode/weworkcustomergroupqrcode.api" | ||
// tag | ||
import "admin/scrm/tag/weworktag.api" | ||
import "admin/wechat/officialaccount/menu.api" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
internal/handler/admin/wechat/officialaccount/menu/createmenuhandler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package menu | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/wechat/officialaccount/menu" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func CreateMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.CreateMenuRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := menu.NewCreateMenuLogic(r.Context(), svcCtx) | ||
resp, err := l.CreateMenu(&req) | ||
if err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
} else { | ||
httpx.OkJsonCtx(r.Context(), w, resp) | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
internal/handler/admin/wechat/officialaccount/menu/deletemenuhandler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package menu | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/wechat/officialaccount/menu" | ||
"PowerX/internal/svc" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func DeleteMenuHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
l := menu.NewDeleteMenuLogic(r.Context(), svcCtx) | ||
resp, err := l.DeleteMenu() | ||
if err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
} else { | ||
httpx.OkJsonCtx(r.Context(), w, resp) | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
internal/handler/admin/wechat/officialaccount/menu/querymenushandler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package menu | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/wechat/officialaccount/menu" | ||
"PowerX/internal/svc" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func QueryMenusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
l := menu.NewQueryMenusLogic(r.Context(), svcCtx) | ||
resp, err := l.QueryMenus() | ||
if err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
} else { | ||
httpx.OkJsonCtx(r.Context(), w, resp) | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
internal/handler/admin/wechat/officialaccount/menu/syncmenushandler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package menu | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/wechat/officialaccount/menu" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func SyncMenusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.SyncMenusRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := menu.NewSyncMenusLogic(r.Context(), svcCtx) | ||
resp, err := l.SyncMenus(&req) | ||
if err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
} else { | ||
httpx.OkJsonCtx(r.Context(), w, resp) | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
internal/logic/admin/wechat/officialaccount/menu/createmenulogic.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package menu | ||
|
||
import ( | ||
"context" | ||
|
||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
|
||
"github.com/zeromicro/go-zero/core/logx" | ||
) | ||
|
||
type CreateMenuLogic struct { | ||
logx.Logger | ||
ctx context.Context | ||
svcCtx *svc.ServiceContext | ||
} | ||
|
||
func NewCreateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateMenuLogic { | ||
return &CreateMenuLogic{ | ||
Logger: logx.WithContext(ctx), | ||
ctx: ctx, | ||
svcCtx: svcCtx, | ||
} | ||
} | ||
|
||
func (l *CreateMenuLogic) CreateMenu(req *types.CreateMenuRequest) (resp *types.CreateMenuReply, err error) { | ||
// todo: add your logic here and delete this line | ||
|
||
return | ||
} |
30 changes: 30 additions & 0 deletions
30
internal/logic/admin/wechat/officialaccount/menu/deletemenulogic.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package menu | ||
|
||
import ( | ||
"context" | ||
|
||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
|
||
"github.com/zeromicro/go-zero/core/logx" | ||
) | ||
|
||
type DeleteMenuLogic struct { | ||
logx.Logger | ||
ctx context.Context | ||
svcCtx *svc.ServiceContext | ||
} | ||
|
||
func NewDeleteMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteMenuLogic { | ||
return &DeleteMenuLogic{ | ||
Logger: logx.WithContext(ctx), | ||
ctx: ctx, | ||
svcCtx: svcCtx, | ||
} | ||
} | ||
|
||
func (l *DeleteMenuLogic) DeleteMenu() (resp *types.DeleteMenuReply, err error) { | ||
// todo: add your logic here and delete this line | ||
|
||
return | ||
} |
Oops, something went wrong.