diff --git a/client/client.go b/client/client.go index 8b498d4..df6bd10 100644 --- a/client/client.go +++ b/client/client.go @@ -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 diff --git a/ik3cloud/constant/constant.go b/ik3cloud/constant/constant.go index fa9afc1..44c0040 100644 --- a/ik3cloud/constant/constant.go +++ b/ik3cloud/constant/constant.go @@ -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 diff --git a/ik3cloud/dict.go b/ik3cloud/dict.go new file mode 100644 index 0000000..aea53a9 --- /dev/null +++ b/ik3cloud/dict.go @@ -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 +}