public static GetSignature ( string ticket, string noncestr, string timestamp, string url ) : string | ||
ticket | string | |
noncestr | string | |
timestamp | string | |
url | string | |
Результат | string |
/// <summary> /// 获取给UI使用的JSSDK信息包 /// </summary> /// <param name="appId"></param> /// <param name="appSecret"></param> /// <param name="url"></param> /// <returns></returns> public static JsSdkUiPackage GetJsSdkUiPackage(string appId, string appSecret, string url) { //获取时间戳 var timestamp = GetTimestamp(); //获取随机码 string nonceStr = GetNoncestr(); string ticket = JsApiTicketContainer.TryGetJsApiTicket(appId, appSecret); //获取签名 string signature = JSSDKHelper.GetSignature(ticket, nonceStr, timestamp, url); //返回信息包 return(new JsSdkUiPackage(appId, timestamp, nonceStr, signature)); }
/// <summary> /// 【异步方法】获取给UI使用的JSSDK信息包 /// </summary> /// <param name="appId"></param> /// <param name="appSecret"></param> /// <param name="url"></param> /// <returns></returns> public static async Task <JsSdkUiPackage> GetJsSdkUiPackageAsync(string appId, string appSecret, string url) { //获取时间戳 var timestamp = GetTimestamp(); //获取随机码 string nonceStr = GetNoncestr(); string ticket = await JsApiTicketContainer.TryGetJsApiTicketAsync(appId, appSecret).ConfigureAwait(false); //获取签名 string signature = JSSDKHelper.GetSignature(ticket, nonceStr, timestamp, url); //返回信息包 return(new JsSdkUiPackage(appId, timestamp, nonceStr, signature)); }
// // GET: /JSSDK/ public ActionResult Index() { //获取时间戳 var timestamp = JSSDKHelper.GetTimestamp(); //获取随机码 var nonceStr = JSSDKHelper.GetNoncestr(); string ticket = JsApiTicketContainer.TryGetTicket(appId, secret); JSSDKHelper jsHelper = new JSSDKHelper(); //获取签名 var signature = jsHelper.GetSignature(ticket, nonceStr, timestamp, Request.Url.AbsoluteUri); ViewData["AppId"] = appId; ViewData["Timestamp"] = timestamp; ViewData["NonceStr"] = nonceStr; ViewData["Signature"] = signature; return View(); }
public ActionResult PreSaleProduct() { var products=PreSaleProductService.GetPreSaleProducts(p=>p.IsSale,p=>p.CreateTime, "order"); #region 分享相关 //获取时间戳 var timestamp = JSSDKHelper.GetTimestamp(); //获取随机码 var nonceStr = JSSDKHelper.GetNoncestr(); string ticket = JsApiTicketContainer.TryGetTicket(AppId, AppSecret); JSSDKHelper jsHelper = new JSSDKHelper(); //获取签名 var signature = jsHelper.GetSignature(ticket, nonceStr, timestamp, Request.Url.AbsoluteUri); ViewData["AppId"] = AppId; ViewData["Timestamp"] = timestamp; ViewData["NonceStr"] = nonceStr; ViewData["Signature"] = signature; #endregion return View(products); }
public JsonResult GetShareParms() { //获取时间戳 var timestamp = JSSDKHelper.GetTimestamp(); //获取随机码 var nonceStr = JSSDKHelper.GetNoncestr(); string ticket = JsApiTicketContainer.TryGetTicket(AppId, AppSecret); JSSDKHelper jsHelper = new JSSDKHelper(); //获取签名 var signature = jsHelper.GetSignature(ticket, nonceStr, timestamp, Request.Url.AbsoluteUri); var obj = new { appid = AppId, timestamp = timestamp, nonceStr = nonceStr, signature = signature }; return Json(obj); }
/// <summary> /// 转账 /// </summary> /// <returns></returns> public ActionResult TransferAccount(long orderId) { var payTipViewModel = new PayTipViewModel(); var orderViewModel = OrderService.GetOrderViewModel(this.UserInfo.UserId, orderId); payTipViewModel.OrderId = orderViewModel.OrderId; payTipViewModel.PayMoney = orderViewModel.ProductCount * orderViewModel.Price; payTipViewModel.IsPaySuccess = orderViewModel.Status == OrderStatus.Paid.GetHashCode(); payTipViewModel.Message = payTipViewModel.IsPaySuccess ? "支付成功" : "支付失败"; payTipViewModel.BuyCount = orderViewModel.ProductCount; //获取时间戳 var timestamp = JSSDKHelper.GetTimestamp(); //获取随机码 var nonceStr = JSSDKHelper.GetNoncestr(); string ticket = JsApiTicketContainer.TryGetTicket(AppId, AppSecret); JSSDKHelper jsHelper = new JSSDKHelper(); //获取签名 var signature = jsHelper.GetSignature(ticket, nonceStr, timestamp, Request.Url.AbsoluteUri); ViewData["AppId"] = AppId; ViewData["Timestamp"] = timestamp; ViewData["NonceStr"] = nonceStr; ViewData["Signature"] = signature; ViewBag.uid = DotNet.Common.CryptographyHelper.Base64Encrypt(this.UserInfo.UserId.ToString()); return View(payTipViewModel); }