Skip to content

Commit

Permalink
Merge pull request #261 from ArtisanCloud/dev/michaelhu
Browse files Browse the repository at this point in the history
Dev/michaelhu
  • Loading branch information
Matrix-X committed Oct 7, 2023
2 parents adfeda5 + b8a17b9 commit c137962
Show file tree
Hide file tree
Showing 39 changed files with 1,490 additions and 49 deletions.
1 change: 1 addition & 0 deletions api/admin.crm.api
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "admin/crm/customerdomain/lead.api"
import "admin/crm/customerdomain/customer.api"
import "admin/crm/market/media.api"
import "admin/crm/market/store.api"
import "admin/crm/market/mgm.api"
import "admin/crm/business/opportunity.api"
import "admin/crm/product/pricebook.api"
import "admin/crm/product/product.api"
Expand Down
94 changes: 46 additions & 48 deletions api/admin/crm/market/mgm.api
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"
Expand All @@ -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"`
}
)
142 changes: 142 additions & 0 deletions api/admin/crm/product/productstatistics.api
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"`
}
)


1 change: 1 addition & 0 deletions api/mp/product/productcategory.api
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ info(
)

import "../../admin/crm/product/productcategory.api"
import "../../admin/crm/product/productstatistics.api"

@server(
group: mp/product
Expand Down
28 changes: 28 additions & 0 deletions internal/handler/admin/crm/market/mgm/createmgmhandler.go
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 internal/handler/admin/crm/market/mgm/createmgmrulehandler.go
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)
}
}
}
28 changes: 28 additions & 0 deletions internal/handler/admin/crm/market/mgm/deletemgmhandler.go
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)
}
}
}
Loading

0 comments on commit c137962

Please sign in to comment.