order-warning #155

Merged
sinhluu merged 3 commits from order-warning into master 2023-04-14 02:37:55 +00:00
4 changed files with 43 additions and 12 deletions
Showing only changes of commit 041dd43616 - Show all commits

View File

@ -119,3 +119,22 @@ func (o Order) GetSupplierOrders(p model.OrderSupplierQuery) (*model.SupplierOrd
} }
return &r.Data, nil return &r.Data, nil
} }
// GetUserTotalWarningOrder ...
func (o Order) GetUserTotalWarningOrder(p model.OrderGetTotalWarningPayload) (*model.OrderGetTotalWarningRes, error) {
msg, err := natsio.GetServer().Request(subject.Order.GetUserTotalWarningOrders, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data model.OrderGetTotalWarningRes `json:"data"`
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return nil, err
}
if r.Error != "" {
return nil, errors.New(r.Error)
}
return &r.Data, nil
}

View File

@ -49,3 +49,7 @@ type OrderSupplierQuery struct {
SupplierID string `json:"supplierId"` SupplierID string `json:"supplierId"`
WarehouseIDs []string `json:"warehouseIDs"` WarehouseIDs []string `json:"warehouseIDs"`
} }
type OrderGetTotalWarningPayload struct {
UserID string `json:"userId"`
}

View File

@ -33,3 +33,9 @@ type SupplierOrderDelivery struct {
Status string `json:"status" enums:"waiting_to_confirm,waiting_to_pick,picking,picked,delay_pickup,pickup_failed,delivering,delay_delivery,delivered,cancelled,delivery_failed,waiting_to_return,returning,delay_return,compensation,returned"` Status string `json:"status" enums:"waiting_to_confirm,waiting_to_pick,picking,picked,delay_pickup,pickup_failed,delivering,delay_delivery,delivered,cancelled,delivery_failed,waiting_to_return,returning,delay_return,compensation,returned"`
TPLCode string `json:"tplCode" enums:"SLY,GHTK,GHN,SSC,SPY,VTP,SE,NTL,BEST"` TPLCode string `json:"tplCode" enums:"SLY,GHTK,GHN,SSC,SPY,VTP,SE,NTL,BEST"`
} }
// OrderGetTotalWarningRes ...
type OrderGetTotalWarningRes struct {
UserID string `json:"userId"`
TotalWarningOrders int64 `json:"totalWarningOrders"`
}

View File

@ -7,17 +7,19 @@ func getOrderValue(val string) string {
} }
var Order = struct { var Order = struct {
UpdateORStatus string UpdateORStatus string
CancelDelivery string GetUserTotalWarningOrders string
ChangeDeliveryStatus string CancelDelivery string
UpdateLogisticInfoFailed string ChangeDeliveryStatus string
ORNotUpdateStatus string UpdateLogisticInfoFailed string
GetSupplierOrders string ORNotUpdateStatus string
GetSupplierOrders string
}{ }{
UpdateORStatus: getOrderValue("update_outbound_request_status"), UpdateORStatus: getOrderValue("update_outbound_request_status"),
CancelDelivery: getOrderValue("cancel_delivery"), GetUserTotalWarningOrders: getOrderValue("get_user_total_warning_orders"),
ChangeDeliveryStatus: getOrderValue("change_delivery_status"), CancelDelivery: getOrderValue("cancel_delivery"),
UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"), ChangeDeliveryStatus: getOrderValue("change_delivery_status"),
ORNotUpdateStatus: getOrderValue("outbound_request_not_update_status"), UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
GetSupplierOrders: getOrderValue("get_supplier_orders"), ORNotUpdateStatus: getOrderValue("outbound_request_not_update_status"),
GetSupplierOrders: getOrderValue("get_supplier_orders"),
} }