81 lines
1.7 KiB
Go
81 lines
1.7 KiB
Go
package factory
|
||
|
||
import (
|
||
"context"
|
||
"time"
|
||
|
||
"git.kumo.work/shama/service/client"
|
||
)
|
||
|
||
type bank struct {
|
||
}
|
||
|
||
type BankItem struct {
|
||
Id int64 `json:"id"`
|
||
Bank string `json:"bank"`
|
||
BankAccount string `json:"bankAccount"`
|
||
BankAddress string `json:"bankAddress"`
|
||
BankCode string `json:"bankCode"`
|
||
MainFlag int64 `json:"mainFlag"`
|
||
CreatedAt *time.Time `json:"createdAt"`
|
||
UpdatedAt *time.Time `json:"updatedAt"`
|
||
}
|
||
|
||
// All @TITLE 获取银行
|
||
func (b *bank) All(ctx context.Context, factoryId int64) (reply []BankItem, err error) {
|
||
xClient, err := client.GetClient(b)
|
||
if err != nil {
|
||
return
|
||
}
|
||
err = xClient.Call(ctx, "All", factoryId, &reply)
|
||
return
|
||
}
|
||
|
||
type ArgsBankAdd struct {
|
||
FactoryId int64 // 工厂ID
|
||
BankAdd
|
||
}
|
||
|
||
type BankAdd struct {
|
||
Bank string // 开户银行
|
||
BankAccount string // 银行账户
|
||
BankAddress string // 银行地址
|
||
BankCode string // 银行联行号
|
||
MainFlag int64 // 主联系人标记(1=是,2=不是)
|
||
}
|
||
|
||
// Add @TITLE 添加银行
|
||
func (b *bank) Add(ctx context.Context, args ArgsBankAdd) (err error) {
|
||
xClient, err := client.GetClient(b)
|
||
if err != nil {
|
||
return
|
||
}
|
||
reply := 0
|
||
return xClient.Call(ctx, "Add", args, &reply)
|
||
}
|
||
|
||
type ArgsBankEdit struct {
|
||
BankId int64 // 银行ID
|
||
BankAdd
|
||
}
|
||
|
||
// Edit @TITLE 编辑银行
|
||
func (b *bank) Edit(ctx context.Context, args ArgsBankEdit) (err error) {
|
||
xClient, err := client.GetClient(b)
|
||
if err != nil {
|
||
return
|
||
}
|
||
reply := 0
|
||
return xClient.Call(ctx, "Edit", args, &reply)
|
||
}
|
||
|
||
// Delete @TITLE 删除银行
|
||
func (b *bank) Delete(ctx context.Context, bankIds []int64) (err error) {
|
||
xClient, err := client.GetClient(b)
|
||
if err != nil {
|
||
return
|
||
}
|
||
reply := 0
|
||
return xClient.Call(ctx, "Delete", bankIds, &reply)
|
||
}
|