setup-holiday-supplier-tool #123
|
@ -38,6 +38,28 @@ func (s Supplier) GetListSupplierInfo(p model.GetSupplierRequest) ([]*model.Resp
|
||||||
return r.Data, nil
|
return r.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDetailSupplierInfo ...
|
||||||
|
func (s Supplier) GetDetailSupplierInfo(p model.GetDetailSupplierRequest) (*model.ResponseSupplierInfo, error) {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Supplier.GetDetailSupplierInfo, toBytes(p))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var r struct {
|
||||||
|
Data *model.ResponseSupplierInfo `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) GetSupplierContractBySupplierID(p model.GetSupplierContractRequest) (*model.ResponseSupplierContract, error) {
|
func (s Supplier) GetSupplierContractBySupplierID(p model.GetSupplierContractRequest) (*model.ResponseSupplierContract, error) {
|
||||||
msg, err := natsio.GetServer().Request(subject.Supplier.GetSupplierContractBySupplierID, toBytes(p))
|
msg, err := natsio.GetServer().Request(subject.Supplier.GetSupplierContractBySupplierID, toBytes(p))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -9,6 +9,11 @@ type GetSupplierRequest struct {
|
||||||
ListID []primitive.ObjectID `json:"listID"`
|
ListID []primitive.ObjectID `json:"listID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDetailSupplierRequest ...
|
||||||
|
type GetDetailSupplierRequest struct {
|
||||||
|
Supplier string `json:"supplier"`
|
||||||
|
}
|
||||||
|
|
||||||
type GetSupplierContractRequest struct {
|
type GetSupplierContractRequest struct {
|
||||||
SupplierID primitive.ObjectID `json:"supplierID"`
|
SupplierID primitive.ObjectID `json:"supplierID"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,14 @@ func getSupplierValue(val string) string {
|
||||||
|
|
||||||
var Supplier = struct {
|
var Supplier = struct {
|
||||||
GetListSupplierInfo string
|
GetListSupplierInfo string
|
||||||
|
GetDetailSupplierInfo string
|
||||||
GetSupplierContractBySupplierID string
|
GetSupplierContractBySupplierID string
|
||||||
FindAll string
|
FindAll string
|
||||||
FindAllOld string
|
FindAllOld string
|
||||||
Count string
|
Count string
|
||||||
}{
|
}{
|
||||||
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
|
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
|
||||||
|
GetDetailSupplierInfo: getSupplierValue("get_detail_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"),
|
FindAllOld: getSupplierValue("find_all_old"),
|
||||||
|
|
Loading…
Reference in New Issue