-
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.
- Loading branch information
Showing
22 changed files
with
755 additions
and
48 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
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,8 +1,8 @@ | ||
syntax = "v1" | ||
|
||
info( | ||
title: "MGM管理" | ||
desc: "MGM管理" | ||
title: "MGMRule管理" | ||
desc: "MGMRule管理" | ||
author: "MichaelHu" | ||
email: "[email protected]" | ||
version: "v1" | ||
|
@@ -15,92 +15,90 @@ info( | |
) | ||
|
||
service PowerX { | ||
@doc "查询MGM列表" | ||
@handler ListMGMsPage | ||
get /mgms/page-list (ListMGMsPageRequest) returns (ListMGMsPageReply) | ||
@doc "请求MGM上传链接" | ||
@handler CreateMGM | ||
post /mgms (CreateMGMRequest) returns (CreateMGMReply) | ||
|
||
@doc "创建或更新MGM" | ||
@handler UpdateMGM | ||
put /mgms/:id (UpdateMGMRequest) returns (UpdateMGMReply) | ||
|
||
@doc "根据获取MGM" | ||
@handler GetMGM | ||
get /mgms/:id (GetMGMRequest) returns (GetMGMReply) | ||
|
||
@doc "删除MGM" | ||
@handler DeleteMGM | ||
delete /mgms/:id (DeleteMGMRequest) returns (DeleteMGMReply) | ||
@doc "查询MGMRule列表" | ||
@handler ListMGMRulesPage | ||
get /mgms/page-list (ListMGMRulesPageRequest) returns (ListMGMRulesPageReply) | ||
@doc "请求MGMRule上传链接" | ||
@handler CreateMGMRule | ||
post /mgms (CreateMGMRuleRequest) returns (CreateMGMRuleReply) | ||
|
||
@doc "创建或更新MGMRule" | ||
@handler UpdateMGMRule | ||
put /mgms/:id (UpdateMGMRuleRequest) returns (UpdateMGMRuleReply) | ||
|
||
@doc "根据获取MGMRule" | ||
@handler GetMGMRule | ||
get /mgms/:id (GetMGMRuleRequest) returns (GetMGMRuleReply) | ||
|
||
@doc "删除MGMRule" | ||
@handler DeleteMGMRule | ||
delete /mgms/:id (DeleteMGMRuleRequest) returns (DeleteMGMRuleReply) | ||
} | ||
|
||
type ( | ||
ListMGMsPageRequest struct { | ||
MGMTypes []int8 `form:"mgmTypes,optional"` | ||
ListMGMRulesPageRequest struct { | ||
MGMRuleTypes []int8 `form:"mgmTypes,optional"` | ||
Keys []string `form:"keys,optional"` | ||
OrderBy string `form:"orderBy,optional"` | ||
PageIndex int `form:"pageIndex,optional"` | ||
PageSize int `form:"pageSize,optional"` | ||
} | ||
|
||
MGM struct { | ||
MGMRule struct { | ||
Id int64 `json:"id,optional"` | ||
|
||
Title string `json:"title,optional"` | ||
SubTitle string `json:"subTitle,optional"` | ||
CoverImageId int64 `json:"coverImageId,optional"` | ||
ResourceUrl string `json:"resourceUrl,optional"` | ||
CommissionRate1 float32 `json:"commissionRate1,optional"` | ||
CommissionRate2 float32 `json:"commissionRate2,optional"` | ||
Scene int `json:"scene,optional"` | ||
Description string `json:"description,optional"` | ||
MGMType int `json:"mgmType,optional"` | ||
ViewedCount int `json:"viewedCount,optional"` | ||
|
||
} | ||
|
||
ListMGMsPageReply struct { | ||
List []*MGM `json:"list"` | ||
ListMGMRulesPageReply struct { | ||
List []*MGMRule `json:"list"` | ||
PageIndex int `json:"pageIndex"` | ||
PageSize int `json:"pageSize"` | ||
Total int64 `json:"total"` | ||
} | ||
) | ||
|
||
type ( | ||
CreateMGMRequest struct { | ||
MGM | ||
CreateMGMRuleRequest struct { | ||
MGMRule | ||
} | ||
|
||
CreateMGMReply struct { | ||
MGMId int64 `json:"id"` | ||
CreateMGMRuleReply struct { | ||
MGMRuleId int64 `json:"id"` | ||
} | ||
) | ||
|
||
type ( | ||
UpdateMGMRequest struct { | ||
MGMId int64 `path:"id"` | ||
MGM | ||
UpdateMGMRuleRequest struct { | ||
MGMRuleId int64 `path:"id"` | ||
MGMRule | ||
} | ||
|
||
UpdateMGMReply struct { | ||
MGMId int64 `json:"id"` | ||
UpdateMGMRuleReply struct { | ||
MGMRuleId int64 `json:"id"` | ||
} | ||
) | ||
|
||
type ( | ||
GetMGMRequest struct { | ||
MGMId int64 `path:"id"` | ||
GetMGMRuleRequest struct { | ||
MGMRuleId int64 `path:"id"` | ||
} | ||
|
||
GetMGMReply struct { | ||
*MGM | ||
GetMGMRuleReply struct { | ||
*MGMRule | ||
} | ||
) | ||
|
||
type ( | ||
DeleteMGMRequest struct { | ||
MGMId int64 `path:"id"` | ||
DeleteMGMRuleRequest struct { | ||
MGMRuleId int64 `path:"id"` | ||
} | ||
|
||
DeleteMGMReply struct { | ||
MGMId int64 `json:"id"` | ||
DeleteMGMRuleReply struct { | ||
MGMRuleId int64 `json:"id"` | ||
} | ||
) |
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 mgm | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/market/mgm" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func CreateMGMHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.CreateMGMRuleRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := mgm.NewCreateMGMRuleLogic(r.Context(), svcCtx) | ||
resp, err := l.CreateMGMRule(&req) | ||
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/crm/market/mgm/createmgmrulehandler.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 mgm | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/market/mgm" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func CreateMGMRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.CreateMGMRuleRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := mgm.NewCreateMGMRuleLogic(r.Context(), svcCtx) | ||
resp, err := l.CreateMGMRule(&req) | ||
if err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
} else { | ||
httpx.OkJsonCtx(r.Context(), w, resp) | ||
} | ||
} | ||
} |
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 mgm | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/market/mgm" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func DeleteMGMHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.DeleteMGMRuleRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := mgm.NewDeleteMGMRuleLogic(r.Context(), svcCtx) | ||
resp, err := l.DeleteMGMRule(&req) | ||
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/crm/market/mgm/deletemgmrulehandler.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 mgm | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/market/mgm" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func DeleteMGMRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.DeleteMGMRuleRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := mgm.NewDeleteMGMRuleLogic(r.Context(), svcCtx) | ||
resp, err := l.DeleteMGMRule(&req) | ||
if err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
} else { | ||
httpx.OkJsonCtx(r.Context(), w, resp) | ||
} | ||
} | ||
} |
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 mgm | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/market/mgm" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func GetMGMHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.GetMGMRuleRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := mgm.NewGetMGMRuleLogic(r.Context(), svcCtx) | ||
resp, err := l.GetMGMRule(&req) | ||
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/crm/market/mgm/getmgmrulehandler.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 mgm | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/market/mgm" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func GetMGMRuleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.GetMGMRuleRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := mgm.NewGetMGMRuleLogic(r.Context(), svcCtx) | ||
resp, err := l.GetMGMRule(&req) | ||
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/crm/market/mgm/listmgmrulespagehandler.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 mgm | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/market/mgm" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func ListMGMRulesPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.ListMGMRulesPageRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := mgm.NewListMGMRulesPageLogic(r.Context(), svcCtx) | ||
resp, err := l.ListMGMRulesPage(&req) | ||
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/crm/market/mgm/listmgmspagehandler.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 mgm | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/market/mgm" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func ListMGMsPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.ListMGMRulesPageRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := mgm.NewListMGMRulesPageLogic(r.Context(), svcCtx) | ||
resp, err := l.ListMGMRulesPage(&req) | ||
if err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
} else { | ||
httpx.OkJsonCtx(r.Context(), w, resp) | ||
} | ||
} | ||
} |
Oops, something went wrong.