This commit is contained in:
PastSaid
2024-04-29 17:57:07 +08:00
parent e1e6cba475
commit 16fbd10312
123 changed files with 5923 additions and 18677 deletions

View File

@@ -0,0 +1,65 @@
using E_ZKEcc.Domian;
using HandleUtils;
using Kingdee.BOS.Log;
using Kingdee.BOS.TCP;
using Kingdee.BOS.Util;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace E_ZKEcc
{
public class BaseService
{
protected readonly string _appKey;
protected readonly string _appSecret;
protected readonly string _apiVersion;
protected readonly string _moduleName;
protected readonly string _moduleCnName;
protected readonly string _serverUrl;
protected string _actionName;
protected string _realServerUrl;
protected JsonSerializerSettings _serializerSettings;
public BaseService(ApiInfoDomian apiInfo, string moduleName, string moduleCnName = "")
{
_appKey = apiInfo.appKey;
_apiVersion = apiInfo.apiVersion;
_appSecret = apiInfo.appSecret;
_serverUrl = apiInfo.serverUrl;
_moduleName = moduleName;
_moduleCnName = moduleCnName;
_serializerSettings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
};
//_realServerUrl = $"{_serverUrl}/api/{_apiVersion}/{_moduleName}/{_apiName}/?Key={_appKey}";
}
/// <summary>
/// 执行请求
/// </summary>
/// <param name="dataJson"></param>
/// <returns></returns>
public string DoExecute(string dataJson)
{
////对json字符串进行url编码
//var requestData = EncryptHelper.UrlEncode(dataJson);
//var request = new Dictionary<string, object>();
_realServerUrl = $"{_serverUrl}/api/{_apiVersion}/{_moduleName}/{_actionName}/?key={_appKey}";
string result = WebHelper.DoPost(_realServerUrl, dataJson);
return result;
}
}
}