tysk/tysk.go

33 lines
719 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package tysk
import (
"gitea.cdlsxd.cn/self-tools/tysk/constant"
"gitea.cdlsxd.cn/self-tools/tysk/entity"
)
type Tysk struct {
UserName string // 用户名
Env string // 环境,测试dev,不传默认正式
}
func NewTysk(userName string, opts ...Option) TyskFacecade {
tysk := &Tysk{UserName: userName}
for _, opt := range opts {
opt(tysk) // 应用选项
}
return tysk
}
type Option func(*Tysk)
func WithEnvTest() Option {
return func(tysk *Tysk) {
tysk.Env = "dev"
}
}
func (g *Tysk) GetAccountBalance(accountList []string) (res entity.GetAccountBalanceResp, err error) {
err = g.handleRequest(constant.GetAccountBalance, map[string]interface{}{"accountNo": accountList}, &res)
return
}