Merge branch 'feature/get-bank-info' of git.selly.red:Selly-Modules/natsio into develop

This commit is contained in:
Tue 2022-10-11 14:02:55 +07:00
commit c7ad6baf4c
3 changed files with 28 additions and 4 deletions

View File

@ -37,3 +37,19 @@ func (s Bank) GetBankById(bankID string) (*model.BankBrief, error) {
return r.Data, nil return r.Data, nil
} }
func (s Bank) CheckBankAndBranchByID(p model.BankBranchRequest) bool {
msg, err := natsio.GetServer().Request(subject.Bank.CheckBankAndBranchByID, toBytes(p))
if err != nil {
return false
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return false
}
return r.Error == ""
}

View File

@ -0,0 +1,6 @@
package model
type BankBranchRequest struct {
BankID string `json:"bankId"`
BranchID string `json:"branchId"`
}

View File

@ -7,9 +7,11 @@ func getBankValue(val string) string {
} }
var Bank = struct { var Bank = struct {
GetBankById string GetBankById string
GetBankBranchById string GetBankBranchById string
CheckBankAndBranchByID string
}{ }{
GetBankById: getBankValue("get_bank_by_id"), GetBankById: getBankValue("get_bank_by_id"),
GetBankBranchById: getBankValue("get_bank_branch_by_id"), GetBankBranchById: getBankValue("get_bank_branch_by_id"),
CheckBankAndBranchByID: getBankValue("check_bank_and_brach_by_id"),
} }