Files
2025-09-01 13:58:20 +08:00

84 lines
2.4 KiB
C#

using Kingdee.CDP.WebApi.SDK;
using MyCode.Project.Domain.Config;
using MyCode.Project.Domain.Message.Response.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyCode.Project.Services
{
public static class K3CloudHelp
{
private static K3CloudApi k3CloudApi;
public static K3CloudApi GetK3CloudApiInstance()
{
K3CloudOption k3CloudOption = new K3CloudOption()
{
AcctID = K3CloudConfig.AcctID,
AppID = K3CloudConfig.AppID,
AppSec = K3CloudConfig.AppSec,
LCID = Convert.ToInt32(K3CloudConfig.LCID),
ServerUrl = K3CloudConfig.ServerUrl,
UserName = K3CloudConfig.UserName,
OrgNumber = K3CloudConfig.OrgNumber
};
if (k3CloudApi == null)
{
k3CloudApi = new K3CloudApi(k3CloudOption.ServerUrl, 30);
}
k3CloudApi.InitClient(
k3CloudOption.AcctID,
k3CloudOption.AppID,
k3CloudOption.AppSec,
k3CloudOption.UserName,
k3CloudOption.LCID,
k3CloudOption.OrgNumber,
k3CloudOption.ServerUrl
);
return k3CloudApi;
}
public static K3CloudApi CreateDefaultK3CloudApi()
{
return k3CloudApi;
}
private class K3CloudOption
{
/// <summary>
/// DBID
/// </summary>
public string AcctID { get; set; }
/// <summary>
/// 应用ID
/// </summary>
public string AppID { get; set; }
/// <summary>
/// 应用密钥
/// </summary>
public string AppSec { get; set; }
/// <summary>
/// 服务器地址
/// </summary>
public string ServerUrl { get; set; }
/// <summary>
/// 默认语言ID
/// </summary>
public int LCID { get; set; }
/// <summary>
/// 默认用户名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 默认组织ID
/// </summary>
public string OrgNumber { get; set; }
}
}
}