feat(ik3cloud): 初始化项目基础配置与部门模块
- 添加 .gitignore 忽略规则 - 实现应用配置加载与管理逻辑 - 添加默认配置文件 app.ini - 配置 Gitea CI/CD 工作流用于构建和部署 - 实现金蝶云客户端初始化功能 - 添加 RPC 插件支持 Consul 注册中心 - 实现部门数据获取及树形结构处理逻辑 - 添加通用工具函数库 - 初始化 Go 模块依赖管理 - 创建 Dockerfile 用于服务容器化部署
This commit is contained in:
39
app/lib/ik3cloud/client.go
Normal file
39
app/lib/ik3cloud/client.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package ik3cloud
|
||||
|
||||
import (
|
||||
"github.com/deep-project/kingdee"
|
||||
"github.com/deep-project/kingdee/adapters"
|
||||
client2 "github.com/deep-project/kingdee/pkg/client"
|
||||
)
|
||||
|
||||
var Client = &client{}
|
||||
|
||||
type client struct {
|
||||
config *Config
|
||||
*client2.Client
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Host string // 接口地址
|
||||
AccountId string // 账套ID
|
||||
Username string // 用户名
|
||||
AppId string // 应用ID
|
||||
AppSecret string // 应用秘钥
|
||||
LanguageId string // 语言ID
|
||||
}
|
||||
|
||||
func InitClient(config *Config) (*client, error) {
|
||||
var err error
|
||||
Client.Client, err = kingdee.New(config.Host, &adapters.LoginBySign{
|
||||
AccountID: config.AccountId,
|
||||
Username: config.Username,
|
||||
AppID: config.AppId,
|
||||
AppSecret: config.AppSecret,
|
||||
LanguageID: config.LanguageId,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
Client.config = config
|
||||
return Client, nil
|
||||
}
|
||||
Reference in New Issue
Block a user