예제 #1
0
        /// <summary>
        /// 签名算法 对string1进行sha1签名,得到signature
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        private async Task <Access_Sdk> GetSdkAsync(string url, string jsApiTicket)
        {
            string     noncestr  = CommonHelper.GuidTo16String();
            string     timestamp = GetUtcTimeStamp().ToString();
            string     string1   = "jsapi_ticket=" + jsApiTicket + "&noncestr=" + noncestr + "&timestamp=" + timestamp + "&url=" + url + "";
            string     signature = CommonHelper.Sha1(string1);
            Access_Sdk sdk       = new Access_Sdk();

            sdk.noncestr  = noncestr;
            sdk.timestamp = timestamp;
            sdk.signature = signature;
            return(await Task.FromResult(sdk));
        }
예제 #2
0
        /// <summary>
        /// 获取钉钉配置信息
        /// </summary>
        /// <param name="url"></param>
        /// <param name="jsApiTicket"></param>
        /// <returns></returns>
        public async Task <ResultModel.ResultInfo <Dictionary <string, string> > > GetDingdingConfigAsync(string url, string jsApiTicket)
        {
            string     _agentId = _config.AgentId;
            string     _corpId  = _config.CorpId;
            Access_Sdk sdk      = await GetSdkAsync(url, jsApiTicket);

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("agentId", _agentId);
            dic.Add("corpId", _corpId);
            dic.Add("timeStamp", sdk.timestamp);
            dic.Add("nonceStr", sdk.noncestr);
            dic.Add("signature", sdk.signature);
            var result = new ResultModel.ResultInfo <Dictionary <string, string> >();

            result.Code    = ResultModel.ResultCode.Success;
            result.Data    = dic;
            result.Message = "ok";
            return(await Task.FromResult(result));
        }