Merge branch 'order-warning' into develop
This commit is contained in:
commit
f6447a771a
|
@ -140,3 +140,22 @@ func (o Order) GetSupplierCash(p model.OrderSupplierCashReq) (*model.OrderSuppli
|
||||||
}
|
}
|
||||||
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
|
||||||
|
}
|
||||||
|
|
|
@ -19,3 +19,9 @@ func (s Socket) EmitSocketEventDataReward(p model.PayloadEmitSocketEvent) error
|
||||||
_, err := natsio.GetServer().Request(subject.Socket.EmitEventReward, toBytes(p))
|
_, err := natsio.GetServer().Request(subject.Socket.EmitEventReward, toBytes(p))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EmitEventToUser ...
|
||||||
|
func (s Socket) EmitEventToUser(p model.PayloadEmitSocketEvent) error {
|
||||||
|
_, err := natsio.GetServer().Request(subject.Socket.EmitEventToUser, toBytes(p))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
|
@ -53,3 +53,7 @@ type OrderSupplierQuery struct {
|
||||||
type OrderSupplierCashReq struct {
|
type OrderSupplierCashReq struct {
|
||||||
SupplierID string `json:"supplierId"`
|
SupplierID string `json:"supplierId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type OrderGetTotalWarningPayload struct {
|
||||||
|
UserID string `json:"userId"`
|
||||||
|
}
|
||||||
|
|
|
@ -39,3 +39,9 @@ type OrderSupplierCashRes struct {
|
||||||
WaitingForReconcileCash float64 `json:"waitingForReconcileCash"`
|
WaitingForReconcileCash float64 `json:"waitingForReconcileCash"`
|
||||||
ReconciledCash float64 `json:"reconciledCash"`
|
ReconciledCash float64 `json:"reconciledCash"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OrderGetTotalWarningRes ...
|
||||||
|
type OrderGetTotalWarningRes struct {
|
||||||
|
UserID string `json:"userId"`
|
||||||
|
TotalWarningOrders int64 `json:"totalWarningOrders"`
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ func getOrderValue(val string) string {
|
||||||
|
|
||||||
var Order = struct {
|
var Order = struct {
|
||||||
UpdateORStatus string
|
UpdateORStatus string
|
||||||
|
GetUserTotalWarningOrders string
|
||||||
CancelDelivery string
|
CancelDelivery string
|
||||||
ChangeDeliveryStatus string
|
ChangeDeliveryStatus string
|
||||||
UpdateLogisticInfoFailed string
|
UpdateLogisticInfoFailed string
|
||||||
|
@ -16,6 +17,7 @@ var Order = struct {
|
||||||
GetSupplierCash string
|
GetSupplierCash string
|
||||||
}{
|
}{
|
||||||
UpdateORStatus: getOrderValue("update_outbound_request_status"),
|
UpdateORStatus: getOrderValue("update_outbound_request_status"),
|
||||||
|
GetUserTotalWarningOrders: getOrderValue("get_user_total_warning_orders"),
|
||||||
CancelDelivery: getOrderValue("cancel_delivery"),
|
CancelDelivery: getOrderValue("cancel_delivery"),
|
||||||
ChangeDeliveryStatus: getOrderValue("change_delivery_status"),
|
ChangeDeliveryStatus: getOrderValue("change_delivery_status"),
|
||||||
UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
|
UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
|
||||||
|
|
|
@ -9,6 +9,8 @@ func getSocketValue(val string) string {
|
||||||
// Socket ...
|
// Socket ...
|
||||||
var Socket = struct {
|
var Socket = struct {
|
||||||
EmitEventReward string
|
EmitEventReward string
|
||||||
|
EmitEventToUser string
|
||||||
}{
|
}{
|
||||||
EmitEventReward: getSocketValue("emit_event_reward"),
|
EmitEventReward: getSocketValue("emit_event_reward"),
|
||||||
|
EmitEventToUser: "send_message_to_socket",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue