-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #261 from ArtisanCloud/dev/michaelhu
Dev/michaelhu
- Loading branch information
Showing
39 changed files
with
1,490 additions
and
49 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,142 @@ | ||
syntax = "v1" | ||
|
||
info( | ||
title: "产品统计" | ||
desc: "产品统计" | ||
author: "MichaelHu" | ||
email: "[email protected]" | ||
version: "v1" | ||
) | ||
|
||
@server( | ||
group: admin/crm/product/productstatistics | ||
prefix: /api/v1/admin/product | ||
middleware: EmployeeJWTAuth | ||
) | ||
|
||
service PowerX { | ||
@doc "查询产品规格列表" | ||
@handler ListProductStatisticsPage | ||
get /product-statistics/page-list (ListProductStatisticsPageRequest) returns (ListProductStatisticsPageReply) | ||
|
||
@doc "查询产品规格详情" | ||
@handler GetProductStatistics | ||
get /product-statistics/:id (GetProductStatisticsRequest) returns (GetProductStatisticsReply) | ||
|
||
|
||
@doc "创建产品规格" | ||
@handler CreateProductStatistics | ||
post /product-statistics (CreateProductStatisticsRequest) returns (CreateProductStatisticsReply) | ||
|
||
@doc "配置产品规格" | ||
@handler ConfigProductStatistics | ||
post /product-statistics/config (ConfigProductStatisticsRequest) returns (ConfigProductStatisticsReply) | ||
|
||
|
||
@doc "全量产品规格" | ||
@handler PutProductStatistics | ||
put /product-statistics/:id (PutProductStatisticsRequest) returns (PutProductStatisticsReply) | ||
|
||
@doc "增量产品规格" | ||
@handler PatchProductStatistics | ||
patch /product-statistics/:id (PatchProductStatisticsRequest) returns (PatchProductStatisticsReply) | ||
|
||
|
||
@doc "删除产品规格" | ||
@handler DeleteProductStatistics | ||
delete /product-statistics/:id (DeleteProductStatisticsRequest) returns (DeleteProductStatisticsReply) | ||
} | ||
|
||
type ( | ||
ProductStatistics { | ||
Id int64 `json:"id,optional"` | ||
ProductId int64 `json:"productId"` | ||
SoldAmount int64 `json:"SoldAmount,optional"` | ||
InventoryQuantity int64 `json:"InventoryQuantity,optional"` | ||
ViewCount int64 `json:"ViewCount,optional"` | ||
} | ||
) | ||
|
||
type ( | ||
ListProductStatisticsPageRequest struct { | ||
LikeName string `form:"likeName,optional"` | ||
ProductId int64 `form:"productId"` | ||
OrderBy string `form:"orderBy,optional"` | ||
PageIndex int `form:"pageIndex,optional"` | ||
PageSize int `form:"pageSize,optional"` | ||
} | ||
|
||
|
||
ListProductStatisticsPageReply struct { | ||
List []*ProductStatistics `json:"list"` | ||
PageIndex int `json:"pageIndex"` | ||
PageSize int `json:"pageSize"` | ||
Total int64 `json:"total"` | ||
} | ||
) | ||
|
||
type ( | ||
CreateProductStatisticsRequest struct { | ||
ProductStatistics | ||
} | ||
|
||
CreateProductStatisticsReply struct { | ||
ProductStatisticsId int64 `json:"id"` | ||
} | ||
) | ||
|
||
type ( | ||
ConfigProductStatisticsRequest struct { | ||
ProductStatisticss []ProductStatistics `json:"productStatisticss"` | ||
} | ||
|
||
ConfigProductStatisticsReply struct { | ||
Result bool `json:"result"` | ||
} | ||
) | ||
|
||
type ( | ||
GetProductStatisticsRequest struct { | ||
ProductStatisticsId int64 `path:"id"` | ||
} | ||
|
||
GetProductStatisticsReply struct { | ||
*ProductStatistics | ||
} | ||
) | ||
|
||
|
||
type ( | ||
PutProductStatisticsRequest struct { | ||
ProductStatisticsId int64 `path:"id"` | ||
ProductStatistics | ||
} | ||
|
||
PutProductStatisticsReply struct { | ||
*ProductStatistics | ||
} | ||
) | ||
|
||
type ( | ||
PatchProductStatisticsRequest struct { | ||
ProductStatisticsId int64 `path:"id"` | ||
ProductStatistics | ||
} | ||
|
||
PatchProductStatisticsReply struct { | ||
*ProductStatistics | ||
} | ||
) | ||
|
||
|
||
type ( | ||
DeleteProductStatisticsRequest struct { | ||
ProductStatisticsId int64 `path:"id"` | ||
} | ||
|
||
DeleteProductStatisticsReply struct { | ||
ProductStatisticsId 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
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) | ||
} | ||
} | ||
} |
Oops, something went wrong.