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"`
|
||||||
|
}
|
||||||
|
|
|
@ -7,19 +7,21 @@ 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
|
||||||
GetSupplierCash string
|
GetSupplierOrders string
|
||||||
|
GetSupplierCash 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"),
|
||||||
GetSupplierCash: getOrderValue("get_supplier_cash"),
|
GetSupplierOrders: getOrderValue("get_supplier_orders"),
|
||||||
|
GetSupplierCash: getOrderValue("get_supplier_cash"),
|
||||||
}
|
}
|
||||||
|
|
|
@ -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