Пример #1
0
 /// <summary>
 /// 保存用户缓存
 /// </summary>
 private void SaveCurrentUser(SysUserContext context)
 {
     try
     {
         DateTime expireTime = DateTime.Now.AddHours(12);
         SessionCookieUtility.WriteCookie(Constant.SysCookieKey, DesEncoderAndDecoder.Encrypt(context.Serialize()), expireTime);
     }
     catch (Exception ex)
     {
         LogUtils.LogError("SysUserService.SaveCurrentUser", ex);
     }
 }
Пример #2
0
        //跳转至支付宝支付页面
        public ActionResult alipay(int id)
        {
            OrderResponse response    = _orderService.OrderDetail(id);
            var           userContext = UserContext.WebUserContext;

            if (response == null || response.MemberId != userContext.Id)
            {
                return(RedirectToAction("index", "player", new { area = "player" }));
            }
            else if (response.OrderStatus == OrderStatusEm.支付成功)
            {
                return(RedirectToAction("paysuccess", "playerpay", new { area = "player", orderId = id }));
            }
            else if (response.OrderStatus != OrderStatusEm.等待支付 && response.OrderStatus != OrderStatusEm.支付失败)
            {
                return(RedirectToAction("index", "player", new { area = "player" }));
            }
            else
            {
                _orderService.PayLog(id, response.Money, PayTypeEm.支付宝, userContext.Id); //插入支付流水信息
                string str     = "1";
                string str2    = "/callback/alinotifyurl";                               //异步回调地址
                string str3    = "/callback/alireturnurl";                               //同步回调地址
                string str4    = Constant.PayAccount;                                    //支付宝账号
                string str5    = DesEncoderAndDecoder.Encrypt($"{id}#nsda");
                string pkgName = response.Remark;
                string str7    = response.Money.ToString();
                string info    = response.Remark;
                string str9    = "";//网站地址
                string str10   = Submit.Query_timestamp();
                string str11   = "";
                SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();
                sParaTemp.Add("partner", Config.Partner);
                sParaTemp.Add("_input_charset", Config.Input_charset.ToLower());
                sParaTemp.Add("service", "create_direct_pay_by_user");
                sParaTemp.Add("payment_type", str);
                sParaTemp.Add("notify_url", str2);
                sParaTemp.Add("return_url", str3);
                sParaTemp.Add("seller_email", str4);
                sParaTemp.Add("out_trade_no", str5);
                sParaTemp.Add("subject", pkgName);
                sParaTemp.Add("total_fee", str7);
                sParaTemp.Add("body", info);
                sParaTemp.Add("show_url", str9);
                sParaTemp.Add("anti_phishing_key", str10);
                sParaTemp.Add("exter_invoke_ip", str11);
                string content = Submit.BuildRequest(sParaTemp, "get", "确认");
                return(Content(content));
            }
        }