|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using DSWeb.Areas.Dispatch.Helper;
|
|
|
|
|
using AlibabaCloud.SDK.Dingtalkh5package_1_0.Models;
|
|
|
|
|
using DSWeb.Areas.Dispatch.Helper;
|
|
|
|
|
using DSWeb.Areas.MvcShipping.DB;
|
|
|
|
|
using DSWeb.Areas.MvcShipping.Job;
|
|
|
|
|
using log4net;
|
|
|
|
@ -9,6 +10,7 @@ using System.Configuration;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.Caching;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using Tea;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.MvcShipping.Helper
|
|
|
|
|
{
|
|
|
|
@ -67,8 +69,45 @@ namespace DSWeb.Areas.MvcShipping.Helper
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class DingTalkAuditHelper {
|
|
|
|
|
private
|
|
|
|
|
public static AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client CreateClient()
|
|
|
|
|
{
|
|
|
|
|
AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config();
|
|
|
|
|
config.Protocol = "https";
|
|
|
|
|
config.RegionId = "central";
|
|
|
|
|
return new AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client(config);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void GetToken() {
|
|
|
|
|
AlibabaCloud.SDK.Dingtalkoauth2_1_0.Client client = CreateClient();
|
|
|
|
|
AlibabaCloud.SDK.Dingtalkoauth2_1_0.Models.GetSsoAccessTokenRequest getSsoAccessTokenRequest = new AlibabaCloud.SDK.Dingtalkoauth2_1_0.Models.GetSsoAccessTokenRequest
|
|
|
|
|
{
|
|
|
|
|
Corpid = "ding7f22510fcf025d5424f2f5cc6abecb85",
|
|
|
|
|
SsoSecret = "LPHtv90gkqmq-fzQ3i36vUNaOtSS39SmtdpsUgQaQbJStHoaWey2na9Pu6_SmCCp",
|
|
|
|
|
};
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
client.GetSsoAccessToken(getSsoAccessTokenRequest);
|
|
|
|
|
var _rstr=client.ToString();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (TeaException err)
|
|
|
|
|
{
|
|
|
|
|
if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
|
|
|
|
|
{
|
|
|
|
|
// err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception _err)
|
|
|
|
|
{
|
|
|
|
|
TeaException err = new TeaException(new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
{ "message", _err.Message }
|
|
|
|
|
});
|
|
|
|
|
if (!AlibabaCloud.TeaUtil.Common.Empty(err.Code) && !AlibabaCloud.TeaUtil.Common.Empty(err.Message))
|
|
|
|
|
{
|
|
|
|
|
// err 中含有 code 和 message 属性,可帮助开发定位问题
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|