add order func
This commit is contained in:
parent
b9a7d9648e
commit
12afbd81fe
|
@ -50,3 +50,19 @@ func (o Order) CancelDelivery(p model.OrderCancelDelivery) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ChangeDeliveryStatus ...
|
||||
func (o Order) ChangeDeliveryStatus(p model.OrderChangeDeliveryStatus) error {
|
||||
msg, err := natsio.GetServer().Request(subject.Order.ChangeDeliveryStatus, toBytes(p))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var r model.CommonResponseData
|
||||
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||
return err
|
||||
}
|
||||
if r.Error != "" {
|
||||
return errors.New(r.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -15,3 +15,8 @@ type DistinctWithField struct {
|
|||
Conditions interface{} `json:"conditions"`
|
||||
Filed string `json:"filed"`
|
||||
}
|
||||
|
||||
type ActionBy struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
|
|
@ -13,3 +13,10 @@ type OrderUpdateORStatus struct {
|
|||
type OrderCancelDelivery struct {
|
||||
OrderID string `json:"orderId"`
|
||||
}
|
||||
|
||||
// OrderChangeDeliveryStatus ...
|
||||
type OrderChangeDeliveryStatus struct {
|
||||
OrderID string `json:"orderId"`
|
||||
DeliveryStatus string `json:"deliveryStatus"`
|
||||
ActionBy ActionBy `json:"actionBy"`
|
||||
}
|
||||
|
|
|
@ -7,9 +7,11 @@ func getOrderValue(val string) string {
|
|||
}
|
||||
|
||||
var Order = struct {
|
||||
UpdateORStatus string
|
||||
CancelDelivery string
|
||||
UpdateORStatus string
|
||||
CancelDelivery string
|
||||
ChangeDeliveryStatus string
|
||||
}{
|
||||
UpdateORStatus: getOrderValue("update_outbound_request_status"),
|
||||
CancelDelivery: getOrderValue("cancel_delivery"),
|
||||
UpdateORStatus: getOrderValue("update_outbound_request_status"),
|
||||
CancelDelivery: getOrderValue("cancel_delivery"),
|
||||
ChangeDeliveryStatus: getOrderValue("change_delivery_status"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue