|
|
|
@ -7544,6 +7544,101 @@ namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DBResult SendToLQTY(string APIUrl, string strJson, string USERID, string APINAME = "", string APIDETAILNAME = "", string USERKEY = "", string USERSECRET = "")
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
var DJYURL = MsSysParamSetDAL.GetData("PARAMNAME='LQTYAPIURL'");
|
|
|
|
|
|
|
|
|
|
var headers = new NameValueCollection();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(DJYURL.PARAMVALUE))
|
|
|
|
|
{
|
|
|
|
|
// /Booking/CancelBooking
|
|
|
|
|
//string rtn = WebRequestHelper.DoPost(DJYURL.PARAMVALUE + APIUrl, strJson);
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(USERKEY) && !string.IsNullOrWhiteSpace(USERSECRET))
|
|
|
|
|
{
|
|
|
|
|
headers["USER_KEY"] = USERKEY;
|
|
|
|
|
headers["USER_SECRET"] = USERSECRET;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(APINAME))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var accCfg = MsSysThirdPartyAccountDAL.MakeSureField(APINAME, USERID);
|
|
|
|
|
|
|
|
|
|
//枚举类型96050 维护api地址。有时一个业务有多个api,但是使用同一组userkey和secret
|
|
|
|
|
//因此如果通过 apiname=第三方账号密码设置中的类型 找不到内容
|
|
|
|
|
//则通过枚举类型96050当中,enumvalueid=apiname 查找 enumvaluename(在这里存放apiurl)
|
|
|
|
|
|
|
|
|
|
if (accCfg.Success)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var accCfgInfo = (SysThirdPartyAccount)accCfg.Data;
|
|
|
|
|
|
|
|
|
|
headers["USER_KEY"] = accCfgInfo.ACCOUNT;
|
|
|
|
|
headers["USER_SECRET"] = accCfgInfo.ACCOUNTPSW;
|
|
|
|
|
|
|
|
|
|
var enumValue = cdc.tSysEnumValue.Where(x => x.EnumTypeID == 96020 && x.EnumValueName == APINAME).ToList();
|
|
|
|
|
if (enumValue != null && enumValue.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
APIUrl = enumValue[0].EnumValueName_2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.SetErrorInfo($"[{APINAME}]没有设置第三方账号;");
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//headers["USER_KEY"] = "0c635164b5b140828d156f178c86113c";
|
|
|
|
|
//headers["USER_SECRET"] = "7d23ef98894358e261996f46fb7d63aa8428a3d558cb21ed116f88c77642ba781c361c94cb1a8031";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var apiurlList = cdc.tSysEnumValue.Where(x => x.EnumTypeID == 96050).ToList();
|
|
|
|
|
|
|
|
|
|
if (apiurlList != null && apiurlList.Count > 0 && apiurlList.Exists(x => x.EnumValueID == APIDETAILNAME))
|
|
|
|
|
{
|
|
|
|
|
APIUrl = apiurlList.First(x => x.EnumValueID == APIDETAILNAME).EnumValueName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BasicDataRefDAL.SaveLog(DJYURL.PARAMVALUE + APIUrl + "////" + strJson, $"{APINAME};{APIDETAILNAME}", "大简云接口调用", "发送");
|
|
|
|
|
|
|
|
|
|
var rtn = DSWeb.Areas.MvcShipping.Comm.WebRequestHelper.DoPost_JSON_Header(DJYURL.PARAMVALUE + APIUrl, strJson, 30000, headers);
|
|
|
|
|
|
|
|
|
|
BasicDataRefDAL.SaveLog(rtn, $"{APINAME};{APIDETAILNAME}", "大简云接口调用", "返回");
|
|
|
|
|
|
|
|
|
|
result.OK("同步完成", rtn);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MsSysParamSetDAL.SaveSysParamValue("LQTYAPIURL", "乐企他用接口服务地址", "http://47.105.115.105:26650");
|
|
|
|
|
|
|
|
|
|
//MsSysParamSetDAL.SaveSysParamValue("DJYAPIURL", "大简云接口服务地址", "http://47.105.115.105:26650");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
result.SetErrorInfo(e.Message);
|
|
|
|
|
SaveLog(JsonConvert.Serialize(e), "", "SendToDJY", "错误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
public static void CheckWebconfig(string itemname, ref DBResult result)
|
|
|
|
|
{
|
|
|
|
|
var item = ConfigurationManager.AppSettings[itemname];
|
|
|
|
|