get freeships by supplier ids
This commit is contained in:
parent
f0eb62f3f5
commit
27b14aa122
|
@ -138,3 +138,22 @@ func (s Supplier) GetWarehouseFreeship() (*model.ResponseListWarehouseIDByBusine
|
||||||
|
|
||||||
return r.Data, nil
|
return r.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetFreeshipsBySupplierIDs ...
|
||||||
|
func (s Supplier) GetFreeshipsBySupplierIDs(p model.GetFreeshipsBySupplierIds) (*model.ResponseListFreeshipsBySupplierIds, error) {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Selly.GetFreeshipsBySupplierIds, toBytes(p))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var r struct {
|
||||||
|
Data *model.ResponseListFreeshipsBySupplierIds `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
|
||||||
|
}
|
||||||
|
|
|
@ -38,3 +38,7 @@ type UpdateSupplierWarehousePayload struct {
|
||||||
DistrictCode int `json:"districtCode"`
|
DistrictCode int `json:"districtCode"`
|
||||||
WardCode int `json:"wardCode"`
|
WardCode int `json:"wardCode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetFreeshipsBySupplierIds struct {
|
||||||
|
SupplierIDs []string `json:"supplierIds"`
|
||||||
|
}
|
||||||
|
|
|
@ -33,3 +33,14 @@ type SupplierAll struct {
|
||||||
type ResponseListWarehouseIDByBusinessType struct {
|
type ResponseListWarehouseIDByBusinessType struct {
|
||||||
Warehouses []string `json:"warehouses"`
|
Warehouses []string `json:"warehouses"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Freeship struct {
|
||||||
|
ID string `json:"_id"`
|
||||||
|
ShortName string `json:"shortName"`
|
||||||
|
MilestoneText []string `json:"milestoneText"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResponseListFreeshipsBySupplierIds struct {
|
||||||
|
SupplierID string `json:"supplierId"`
|
||||||
|
Freeships []Freeship `json:"freeships"`
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ var prefixes = struct {
|
||||||
Supplier string
|
Supplier string
|
||||||
Seller string
|
Seller string
|
||||||
AuthSMS string
|
AuthSMS string
|
||||||
|
Selly string
|
||||||
}{
|
}{
|
||||||
Communication: "communication",
|
Communication: "communication",
|
||||||
Order: "order",
|
Order: "order",
|
||||||
|
@ -20,4 +21,5 @@ var prefixes = struct {
|
||||||
Bank: "bank",
|
Bank: "bank",
|
||||||
Seller: "seller",
|
Seller: "seller",
|
||||||
AuthSMS: "auth_sms",
|
AuthSMS: "auth_sms",
|
||||||
|
Selly: "selly",
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package subject
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func getSellyValue(val string) string {
|
||||||
|
return fmt.Sprintf("%s.%s", prefixes.Selly, val)
|
||||||
|
}
|
||||||
|
|
||||||
|
var Selly = struct {
|
||||||
|
GetFreeshipsBySupplierIds string
|
||||||
|
}{
|
||||||
|
GetFreeshipsBySupplierIds: getSellyValue("get_freeships_by_supplier_ids"),
|
||||||
|
}
|
Loading…
Reference in New Issue