order-warning #155
|
@ -119,3 +119,22 @@ func (o Order) GetSupplierOrders(p model.OrderSupplierQuery) (*model.SupplierOrd
|
|||
}
|
||||
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
|
||||
}
|
||||
|
|
|
@ -19,3 +19,9 @@ func (s Socket) EmitSocketEventDataReward(p model.PayloadEmitSocketEvent) error
|
|||
_, err := natsio.GetServer().Request(subject.Socket.EmitEventReward, toBytes(p))
|
||||
return err
|
||||
}
|
||||
|
||||
// EmitEventToUser ...
|
||||
func (s Socket) EmitEventToUser(p model.PayloadEmitSocketEvent) error {
|
||||
_, err := natsio.GetServer().Request(subject.Socket.EmitEventToUser, toBytes(p))
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -49,3 +49,7 @@ type OrderSupplierQuery struct {
|
|||
SupplierID string `json:"supplierId"`
|
||||
WarehouseIDs []string `json:"warehouseIDs"`
|
||||
}
|
||||
|
||||
type OrderGetTotalWarningPayload struct {
|
||||
UserID string `json:"userId"`
|
||||
}
|
||||
|
|
|
@ -33,3 +33,10 @@ 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"`
|
||||
TPLCode string `json:"tplCode" enums:"SLY,GHTK,GHN,SSC,SPY,VTP,SE,NTL,BEST"`
|
||||
}
|
||||
|
||||
// OrderGetTotalWarningRes ...
|
||||
type OrderGetTotalWarningRes struct {
|
||||
UserID string `json:"userId"`
|
||||
TotalWarningOrder int64 `json:"totalWarningOrder"`
|
||||
Action ActionType `json:"action"`
|
||||
}
|
||||
|
|
|
@ -7,17 +7,19 @@ func getOrderValue(val string) string {
|
|||
}
|
||||
|
||||
var Order = struct {
|
||||
UpdateORStatus string
|
||||
CancelDelivery string
|
||||
ChangeDeliveryStatus string
|
||||
UpdateLogisticInfoFailed string
|
||||
ORNotUpdateStatus string
|
||||
GetSupplierOrders string
|
||||
UpdateORStatus string
|
||||
GetUserTotalWarningOrders string
|
||||
CancelDelivery string
|
||||
ChangeDeliveryStatus string
|
||||
UpdateLogisticInfoFailed string
|
||||
ORNotUpdateStatus string
|
||||
GetSupplierOrders string
|
||||
}{
|
||||
UpdateORStatus: getOrderValue("update_outbound_request_status"),
|
||||
CancelDelivery: getOrderValue("cancel_delivery"),
|
||||
ChangeDeliveryStatus: getOrderValue("change_delivery_status"),
|
||||
UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
|
||||
ORNotUpdateStatus: getOrderValue("outbound_request_not_update_status"),
|
||||
GetSupplierOrders: getOrderValue("get_supplier_orders"),
|
||||
UpdateORStatus: getOrderValue("update_outbound_request_status"),
|
||||
GetUserTotalWarningOrders: getOrderValue("get_user_total_warning_orders"),
|
||||
CancelDelivery: getOrderValue("cancel_delivery"),
|
||||
ChangeDeliveryStatus: getOrderValue("change_delivery_status"),
|
||||
UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
|
||||
ORNotUpdateStatus: getOrderValue("outbound_request_not_update_status"),
|
||||
GetSupplierOrders: getOrderValue("get_supplier_orders"),
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ func getSocketValue(val string) string {
|
|||
// Socket ...
|
||||
var Socket = struct {
|
||||
EmitEventReward string
|
||||
EmitEventToUser string
|
||||
}{
|
||||
EmitEventReward: getSocketValue("emit_event_reward"),
|
||||
EmitEventToUser: "send_message_to_socket",
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue