Beispiel #1
0
        public JsonResult PaymentList(decimal balance)
        {
            string webRoot = Request.Url.Scheme + "://" + HttpContext.Request.Url.Host + (HttpContext.Request.Url.Port == 80 ? "" : (":" + HttpContext.Request.Url.Port.ToString()));

            //获取同步返回地址
            string returnUrl = webRoot + "/pay/CapitalChargeReturn/{0}";

            //获取异步通知地址
            string payNotify = webRoot + "/pay/CapitalChargeNotify/{0}";

            var payments = Core.PluginsManagement.GetPlugins <IPaymentPlugin>(true).Where(item => item.Biz.SupportPlatforms.Contains(PlatformType.PC));

            const string RELATEIVE_PATH = "/Plugins/Payment/";

            //不重复数字
            string ids = _iMemberCapitalService.CreateCode(CapitalDetailInfo.CapitalDetailType.ChargeAmount).ToString();

            var models = payments.Select(item =>
            {
                string requestUrl = string.Empty;
                try
                {
                    requestUrl = item.Biz.GetRequestUrl(string.Format(returnUrl, EncodePaymentId(item.PluginInfo.PluginId) + "-" + balance.ToString() + "-" + CurrentUser.Id.ToString()), string.Format(payNotify, EncodePaymentId(item.PluginInfo.PluginId) + "-" + balance.ToString() + "-" + CurrentUser.Id.ToString()), ids, balance, "预付款充值");
                }
                catch (Exception ex)
                {
                    Core.Log.Error("支付页面加载支付插件出错", ex);
                }
                return(new PaymentModel()
                {
                    Logo = RELATEIVE_PATH + item.PluginInfo.ClassFullName.Split(',')[1] + "/" + item.Biz.Logo,
                    RequestUrl = requestUrl,
                    UrlType = item.Biz.RequestUrlType,
                    Id = item.PluginInfo.PluginId
                });
            });

            models = models.Where(item => !string.IsNullOrEmpty(item.RequestUrl));//只选择正常加载的插件
            return(Json(models));
        }
 /// <summary>
 /// 根据不同类型生成单号(充值单号、提现单号)
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static long CreateCode(CapitalDetailInfo.CapitalDetailType type)
 {
     return(_iMemberCapitalService.CreateCode(type));
 }