Пример #1
0
        public ActionResult Pay(int?pt = 0, int?money = 0, string fpt = "", int?fcid = 0, int?ut = 0)
        {
            string       url          = string.Empty;
            ErrorMessage errorMessage = ErrorMessage.失败;

            BindPayType(pt.ToInt(), money.ToInt(), out url, out errorMessage, fpt, fcid.ToInt(), userType: ut.ToInt());
            if (errorMessage == ErrorMessage.成功)
            {
                string returnUrl = UrlParameterHelper.GetDecodingParams("returnUrl");
                if (!string.IsNullOrEmpty(returnUrl))
                {
                    url = StringHelper.GetReturnUrl(url, returnUrl);
                }
                return(Redirect(url));
            }
            //else if (errorMessage == ErrorMessage.支付参数错误)
            //{
            //
            //}
            //else if (errorMessage == ErrorMessage.生成订单号失败)
            //{
            //
            //}
            else
            {
                return(Redirect(string.Format("/error/index?errCode={0}&returnUrl=", (int)errorMessage).GetChannelRouteUrl(RouteChannelId)));
            }
        }
Пример #2
0
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);

            Code      = UrlParameterHelper.GetParams("code");
            State     = UrlParameterHelper.GetParams("state");
            ReturnUrl = UrlParameterHelper.GetDecodingParams("returnurl");
        }
Пример #3
0
        /// <summary>
        /// 搜索结果页
        /// </summary>
        /// <returns></returns>
        public ActionResult SearchList(string keyword, int pageIndex = 1, int pageSize = 10)
        {
            string where = GetSearchWhere(null, 0, 0, 0, keyword, Constants.Novel.ShowLocation.searchlist);
            string orderby = " order by n.Hits desc, n.FavCount desc, n.id desc";
            int    rowCount;
            var    bookList = _bookService.GetPagerList(where, orderby, out rowCount, pageIndex, pageSize,
                                                        new { keyword = UrlParameterHelper.GetDecodingParams("keyword") },
                                                        "[dbo].[Novel] as n inner join [dbo].[NovelClass] nc on nc.Id = n.ClassId",
                                                        "n.Id, n.Title, n.LargeCover, n.ThumbCover, n.SmallCover, n.UpdateStatus, nc.ClassName,n.Author,n.ShortDescription,n.ShortWordSize,n.ContentType, n.IsHideAuthor");

            ViewBag.TotalCount = rowCount;
            ViewBag.Keyword    = keyword;
            var model = new SimpleResponse <IEnumerable <NovelView> >(!bookList.IsNullOrEmpty(), bookList);

            return(View(model));
        }
Пример #4
0
        public ActionResult Open()
        {
            string url = "";

            try
            {
                string host        = StringHelper.GetHost();
                string path        = Request.Path;
                string queryString = Request.Url.Query;
                string code        = UrlParameterHelper.GetQueryString("code");
                string query       = "";
                string state       = "";
                if (!string.IsNullOrEmpty(code))
                {
                    query = UrlParameterHelper.GetDecodingParams("state");
                }
                else
                {
                    state = UrlParameterHelper.UrlEncode(queryString);
                }

                Com.WxPayAPI.JsApiPay jsApiPay = new Com.WxPayAPI.JsApiPay(host, path, queryString);
                jsApiPay.GetOpenidAndAccessToken(state, out url, code);

                string openid = jsApiPay.OpenId;

                if (string.IsNullOrEmpty(url))
                {
                    if (!string.IsNullOrEmpty(openid) && !string.IsNullOrEmpty(query))
                    {
                        IDictionary <string, object> dict = new Dictionary <string, object>();
                        dict.Add("openid", openid);
                        url = StringHelper.SpliceUrl(string.Concat("/user/order/wechat/js/index.aspx", query), dict);
                    }
                }
            }
            catch
            {
                url = "/error/notfound".GetChannelRouteUrl(RouteChannelId);
            }

            return(Redirect(url));
        }