- 在 erp 服务中注册 ik3cloud 服务 - 创建 ik3cloud 结构体和服务接口 - 实现 GetCurrencyRate 方法用于获取指定货币的汇率 - 添加 ArgsGetCurrencyRate 参数结构体定义 - 集成客户端调用逻辑以支持远程服务调用
28 lines
515 B
Go
28 lines
515 B
Go
package erp
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
client2 "git.kumo.work/shama/service/client"
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
type ik3cloud struct {
|
|
}
|
|
|
|
type ArgsGetCurrencyRate struct {
|
|
Currency string
|
|
Date time.Time
|
|
}
|
|
|
|
// GetCurrencyRate @TITLE 获取汇率
|
|
func (i *ik3cloud) GetCurrencyRate(ctx context.Context, args ArgsGetCurrencyRate) (rate decimal.Decimal, err error) {
|
|
xClient, err := client2.GetClient(i)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "GetCurrencyRate", args, &rate)
|
|
return
|
|
}
|