mergeDev/campaign #73
|
@ -80,6 +80,27 @@ func (s Supplier) FindAll(supplierID model.SupplierRequestPayload) (*model.Suppl
|
||||||
return r.Data, nil
|
return r.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s Supplier) FindAllOld(req model.SupplierFindAllReq) (*model.SupplierAll, error) {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Supplier.FindAllOld, toBytes(req))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var r struct {
|
||||||
|
Data *model.SupplierAll `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
|
||||||
|
}
|
||||||
|
|
||||||
func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*model.SupplierAll, error) {
|
func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*model.SupplierAll, error) {
|
||||||
msg, err := natsio.GetServer().Request(subject.Supplier.FindAll, toBytes(supplierID))
|
msg, err := natsio.GetServer().Request(subject.Supplier.FindAll, toBytes(supplierID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -38,3 +38,10 @@ type UpdateSupplierWarehousePayload struct {
|
||||||
DistrictCode int `json:"districtCode"`
|
DistrictCode int `json:"districtCode"`
|
||||||
WardCode int `json:"wardCode"`
|
WardCode int `json:"wardCode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SupplierFindAllReq struct {
|
||||||
|
Page int64 `json:"page"`
|
||||||
|
Limit int64 `json:"limit"`
|
||||||
|
Segment string `json:"segment"`
|
||||||
|
IDs []string `json:"ids"`
|
||||||
|
}
|
||||||
|
|
|
@ -10,8 +10,10 @@ var Supplier = struct {
|
||||||
GetListSupplierInfo string
|
GetListSupplierInfo string
|
||||||
GetSupplierContractBySupplierID string
|
GetSupplierContractBySupplierID string
|
||||||
FindAll string
|
FindAll string
|
||||||
|
FindAllOld string
|
||||||
}{
|
}{
|
||||||
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
|
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
|
||||||
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
|
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
|
||||||
FindAll: getSupplierValue("find_all"),
|
FindAll: getSupplierValue("find_all"),
|
||||||
|
FindAllOld: getSupplierValue("find_all_old"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue