refactor: remove redundant name fields from order service
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
// goctl 1.10.1
|
||||
|
||||
package handler
|
||||
|
||||
|
||||
@@ -83,20 +83,12 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq) (resp *types.C
|
||||
return nil, err
|
||||
}
|
||||
|
||||
consumerName := strconv.FormatInt(consumerID, 10)
|
||||
playerName := strconv.FormatInt(playerID, 10)
|
||||
shopName := ""
|
||||
if req.ShopId > 0 {
|
||||
shopName = strconv.FormatInt(req.ShopId, 10)
|
||||
}
|
||||
now := time.Now().Unix()
|
||||
status := "pending_payment"
|
||||
|
||||
addReq := &orderservice.AddOrdersReq{
|
||||
ConsumerId: consumerID,
|
||||
ConsumerName: consumerName,
|
||||
PlayerId: playerID,
|
||||
PlayerName: playerName,
|
||||
ServiceSnapshot: string(snapshotBytes),
|
||||
Status: &status,
|
||||
TotalPrice: totalPriceStr,
|
||||
@@ -105,7 +97,6 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq) (resp *types.C
|
||||
}
|
||||
if req.ShopId > 0 {
|
||||
addReq.ShopId = &req.ShopId
|
||||
addReq.ShopName = &shopName
|
||||
}
|
||||
if req.Note != "" {
|
||||
addReq.Note = &req.Note
|
||||
|
||||
@@ -41,11 +41,8 @@ func toAPIOrder(in *orderservice.Orders) types.Order {
|
||||
order = types.Order{
|
||||
Id: in.GetId(),
|
||||
ConsumerId: in.GetConsumerId(),
|
||||
ConsumerName: in.GetConsumerName(),
|
||||
PlayerId: playerID,
|
||||
PlayerName: in.GetPlayerName(),
|
||||
ShopId: in.GetShopId(),
|
||||
ShopName: in.GetShopName(),
|
||||
Service: service,
|
||||
Status: in.GetStatus(),
|
||||
TotalPrice: totalPrice,
|
||||
|
||||
@@ -46,9 +46,7 @@ func (l *ReorderLogic) Reorder(req *types.PathId) (resp *types.CreateOrderResp,
|
||||
|
||||
addReq := &orderservice.AddOrdersReq{
|
||||
ConsumerId: oldOrder.GetConsumerId(),
|
||||
ConsumerName: oldOrder.GetConsumerName(),
|
||||
PlayerId: oldOrder.GetPlayerId(),
|
||||
PlayerName: oldOrder.GetPlayerName(),
|
||||
ServiceSnapshot: oldOrder.GetServiceSnapshot(),
|
||||
Status: &status,
|
||||
TotalPrice: oldOrder.GetTotalPrice(),
|
||||
@@ -59,9 +57,6 @@ func (l *ReorderLogic) Reorder(req *types.PathId) (resp *types.CreateOrderResp,
|
||||
if oldOrder.ShopId != nil {
|
||||
addReq.ShopId = oldOrder.ShopId
|
||||
}
|
||||
if oldOrder.ShopName != nil {
|
||||
addReq.ShopName = oldOrder.ShopName
|
||||
}
|
||||
if oldOrder.Note != nil {
|
||||
addReq.Note = oldOrder.Note
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
// goctl 1.10.1
|
||||
|
||||
package types
|
||||
|
||||
@@ -20,25 +20,22 @@ type EmptyResp struct {
|
||||
}
|
||||
|
||||
type Order struct {
|
||||
Id int64 `json:"id"`
|
||||
ConsumerId int64 `json:"consumerId"`
|
||||
ConsumerName string `json:"consumerName"`
|
||||
PlayerId string `json:"playerId"`
|
||||
PlayerName string `json:"playerName"`
|
||||
ShopId int64 `json:"shopId,optional"`
|
||||
ShopName string `json:"shopName,optional"`
|
||||
Service PlayerService `json:"service"`
|
||||
Status string `json:"status"`
|
||||
TotalPrice float64 `json:"totalPrice"`
|
||||
Note string `json:"note,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
AcceptedAt string `json:"acceptedAt,optional"`
|
||||
CompletedAt string `json:"completedAt,optional"`
|
||||
Id int64 `json:"id"`
|
||||
ConsumerId int64 `json:"consumerId"`
|
||||
PlayerId string `json:"playerId"`
|
||||
ShopId int64 `json:"shopId,optional"`
|
||||
Service PlayerService `json:"service"`
|
||||
Status string `json:"status"`
|
||||
TotalPrice float64 `json:"totalPrice"`
|
||||
Note string `json:"note,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
AcceptedAt string `json:"acceptedAt,optional"`
|
||||
CompletedAt string `json:"completedAt,optional"`
|
||||
}
|
||||
|
||||
type OrderListReq struct {
|
||||
PageReq
|
||||
Role string `form:"role"`
|
||||
Role string `form:"role"` // consumer, player, owner
|
||||
Status string `form:"status,optional"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user