-
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.
Merge pull request #277 from ArtisanCloud/dev/michaelhu
feat(crm): add register code for beta systemn running
- Loading branch information
Showing
33 changed files
with
1,280 additions
and
50 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 |
---|---|---|
@@ -0,0 +1,153 @@ | ||
syntax = "v1" | ||
|
||
info( | ||
title: "注册码管理" | ||
desc: "注册码管理" | ||
author: "MichaelHu" | ||
email: "[email protected]" | ||
version: "v1" | ||
) | ||
|
||
@server( | ||
group: admin/crm/customerdomain/registercode | ||
prefix: /api/v1/admin/customerdomain | ||
middleware: EmployeeJWTAuth | ||
) | ||
|
||
service PowerX { | ||
@doc "查询注册码" | ||
@handler GetRegisterCode | ||
get /register-codes/:id (GetRegisterCodeReqeuest) returns (GetRegisterCodeReply) | ||
|
||
@doc "获取注册码分页列表" | ||
@handler ListRegisterCodesPage | ||
get /register-codes/page-list (ListRegisterCodesPageRequest) returns (ListRegisterCodesPageReply) | ||
|
||
@doc "创建注册码" | ||
@handler CreateRegisterCode | ||
post /register-codes (CreateRegisterCodeRequest) returns (CreateRegisterCodeReply) | ||
|
||
@doc "批量创建注册码" | ||
@handler GenerateRegisterCode | ||
post /register-codes/generate (GenerateRegisterCodeRequest) returns (GenerateRegisterCodeReply) | ||
|
||
@doc "全量注册码" | ||
@handler PutRegisterCode | ||
put /register-codes/:id (PutRegisterCodeRequest) returns (PutRegisterCodeReply) | ||
|
||
@doc "增量注册码" | ||
@handler PatchRegisterCode | ||
patch /register-codes/:id (PatchRegisterCodeRequest) returns (PatchRegisterCodeReply) | ||
|
||
@doc "删除注册码" | ||
@handler DeleteRegisterCode | ||
delete /register-codes/:id (DeleteRegisterCodeRequest) returns (DeleteRegisterCodeReply) | ||
|
||
} | ||
|
||
|
||
type ( | ||
RegisterCode { | ||
Id int64 `json:"id,optional"` | ||
Code string `json:"code,optional"` | ||
RegisterCustomerID int64 `json:"registerCustomerID,optional"` | ||
ExpiredAt string `json:"expiredAt,optional"` | ||
CreatedAt string `json:"createdAt,optional"` | ||
} | ||
) | ||
|
||
type ( | ||
GetRegisterCodeReqeuest { | ||
Id int64 `path:"id"` | ||
} | ||
|
||
GetRegisterCodeReply { | ||
RegisterCode *RegisterCode `json:"customer"` | ||
} | ||
) | ||
|
||
type ( | ||
ListRegisterCodesPageRequest { | ||
LikeName string `form:"likeName,optional"` | ||
LikeMobile string `form:"likeMobile,optional"` | ||
Sources []int `form:"sources,optional"` | ||
Statuses []int `form:"statuses,optional"` | ||
OrderBy string `form:"orderBy,optional"` | ||
PageIndex int `form:"pageIndex,optional"` | ||
PageSize int `form:"pageSize,optional"` | ||
} | ||
|
||
ListRegisterCodesPageReply { | ||
List []RegisterCode `json:"list,optional"` | ||
PageIndex int `json:"pageIndex,optional"` | ||
PageSize int `json:"pageSize,optional"` | ||
Total int64 `json:"total,optional"` | ||
} | ||
) | ||
|
||
type ( | ||
CreateRegisterCodeRequest { | ||
RegisterCode | ||
} | ||
|
||
CreateRegisterCodeReply { | ||
RegisterCodeId int64 `json:"id"` | ||
} | ||
) | ||
|
||
type ( | ||
GenerateRegisterCodeRequest { | ||
BatchCount int `json:"batchCount"` | ||
} | ||
|
||
GenerateRegisterCodeReply { | ||
result bool `json:"result"` | ||
} | ||
) | ||
|
||
type PutRegisterCodeRequest { | ||
RegisterCodeId int64 `path:"id"` | ||
RegisterCode | ||
} | ||
|
||
type PutRegisterCodeReply { | ||
*RegisterCode | ||
} | ||
|
||
|
||
type ( | ||
PatchRegisterCodeRequest { | ||
RegisterCodeId int64 `path:"id"` | ||
Name string `json:"name,optional"` | ||
Email string `json:"email,optional"` | ||
InviterId int64 `json:"inviterId,optional"` | ||
Source int `json:"source,optional"` | ||
Type int `json:"type,optional"` | ||
IsActivated bool `json:"isActivated,optional,omitempty"` | ||
} | ||
|
||
PatchRegisterCodeReply { | ||
*RegisterCode | ||
} | ||
) | ||
|
||
type ( | ||
DeleteRegisterCodeRequest { | ||
Id int64 `path:"id"` | ||
} | ||
|
||
DeleteRegisterCodeReply { | ||
RegisterCodeId int64 `json:"id"` | ||
} | ||
) | ||
|
||
type ( | ||
AssignRegisterCodeToEmployeeRequest { | ||
Id string `path:"id"` | ||
EmployeeId int64 `json:"employeeId"` | ||
} | ||
|
||
AssignRegisterCodeToEmployeeReply { | ||
RegisterCodeId int64 `json:"customerId"` | ||
} | ||
) |
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/crm/customerdomain/registercode/createregistercodehandler.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 registercode | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/customerdomain/registercode" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func CreateRegisterCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.CreateRegisterCodeRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := registercode.NewCreateRegisterCodeLogic(r.Context(), svcCtx) | ||
resp, err := l.CreateRegisterCode(&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/customerdomain/registercode/deleteregistercodehandler.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 registercode | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/customerdomain/registercode" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func DeleteRegisterCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.DeleteRegisterCodeRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := registercode.NewDeleteRegisterCodeLogic(r.Context(), svcCtx) | ||
resp, err := l.DeleteRegisterCode(&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/customerdomain/registercode/generateregistercodehandler.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 registercode | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/customerdomain/registercode" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func GenerateRegisterCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.GenerateRegisterCodeRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := registercode.NewGenerateRegisterCodeLogic(r.Context(), svcCtx) | ||
resp, err := l.GenerateRegisterCode(&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/customerdomain/registercode/getregistercodehandler.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 registercode | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/customerdomain/registercode" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func GetRegisterCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.GetRegisterCodeReqeuest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := registercode.NewGetRegisterCodeLogic(r.Context(), svcCtx) | ||
resp, err := l.GetRegisterCode(&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/customerdomain/registercode/listregistercodespagehandler.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 registercode | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/customerdomain/registercode" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func ListRegisterCodesPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.ListRegisterCodesPageRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := registercode.NewListRegisterCodesPageLogic(r.Context(), svcCtx) | ||
resp, err := l.ListRegisterCodesPage(&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/customerdomain/registercode/patchregistercodehandler.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 registercode | ||
|
||
import ( | ||
"net/http" | ||
|
||
"PowerX/internal/logic/admin/crm/customerdomain/registercode" | ||
"PowerX/internal/svc" | ||
"PowerX/internal/types" | ||
"github.com/zeromicro/go-zero/rest/httpx" | ||
) | ||
|
||
func PatchRegisterCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) { | ||
var req types.PatchRegisterCodeRequest | ||
if err := httpx.Parse(r, &req); err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
return | ||
} | ||
|
||
l := registercode.NewPatchRegisterCodeLogic(r.Context(), svcCtx) | ||
resp, err := l.PatchRegisterCode(&req) | ||
if err != nil { | ||
httpx.ErrorCtx(r.Context(), w, err) | ||
} else { | ||
httpx.OkJsonCtx(r.Context(), w, resp) | ||
} | ||
} | ||
} |
Oops, something went wrong.