feat(ik3cloud): 新增字典服务与币种结算方式收付款用途常量

- 新增 DictItem 结构体定义字段 field1 至 field8
- 实现 dict.All 方法用于获取字典数据
- 添加 BD_Currency、BD_SETTLETYPE 和 CN_RECPAYPURPOSE 常量
- 在 client.go 中为 ik3cloud 服务增加本地调试发现逻辑
This commit is contained in:
2025-12-12 17:20:22 +08:00
parent fce4272da9
commit 929366ed0b
3 changed files with 46 additions and 3 deletions

View File

@@ -61,9 +61,18 @@ func GetClient(s interface{}) (*RpcClient, error) {
mutex.Lock()
xClient, ok = mClient.Load(key)
if !ok {
d, err := consulClient.NewConsulDiscovery(basePath, servicePath, config.RpcConfig.RegistryServer, nil)
if err != nil {
return nil, errors.New("系统异常")
var d client.ServiceDiscovery
var err error
if basePath == "ik3cloud" {
d, err = client.NewPeer2PeerDiscovery("tcp@localhost:8081", "")
if err != nil {
return nil, errors.New("系统异常")
}
} else {
d, err = consulClient.NewConsulDiscovery(basePath, servicePath, config.RpcConfig.RegistryServer, nil)
if err != nil {
return nil, errors.New("系统异常")
}
}
option := client.DefaultOption
option.Retries = 3

View File

@@ -14,6 +14,9 @@ const (
ActionReceivable Action = "AR_receivable" // 付款单
ActionPayable Action = "AP_Payable" // 付款单
ActionProduct Action = "BD_MATERIAL" // 物料
ActionCurrency Action = "BD_Currency" // 币种
ActionSettleType Action = "BD_SETTLETYPE" // 结算方式
ActionRecPayPurpose Action = "CN_RECPAYPURPOSE" // 收付款用途
)
type OperatorType = string

31
ik3cloud/dict.go Normal file
View File

@@ -0,0 +1,31 @@
package ik3cloud
import (
"context"
"git.kumo.work/shama/service/client"
"git.kumo.work/shama/service/ik3cloud/constant"
)
type dict struct {
}
type DictItem struct {
Field1 any `json:"field1"`
Field2 any `json:"field2"`
Field3 any `json:"field3"`
Field4 any `json:"field4"`
Field5 any `json:"field5"`
Field6 any `json:"field6"`
Field7 any `json:"field7"`
Field8 any `json:"field8"`
}
// All @TITLE 获取字典
func (d *dict) All(ctx context.Context, companyType constant.Action) (reply []DictItem, err error) {
xClient, err := client.GetClient(d)
if err != nil {
return
}
err = xClient.Call(ctx, "All", companyType, &reply)
return
}