public ActionResult CreateStep1()
        {
            //if (string.IsNullOrEmpty(CurrentUser.PaymentPassword))
            //{
            //    return RedirectToAction("SetPayPassword", "UserCenter",
            //        new { returnUrl = Url.Action("CreateStep1", "Question") });
            //}

            var question = _cacheManager.Get <Question>(getKey()) ?? new Question();
            //检查是否有钱包对象
            //没有就创建一个
            var user = CurrentUser;

            _payMeentDbService.CheckAndCreate(user.Id);


            var model = new WXShareModel();

            model.appId     = WxPayConfig.APPID;
            model.nonceStr  = WxPayApi.GenerateNonceStr();
            model.timestamp = Util.CreateTimestamp();
            model.ticket    = GetTicket();
            model.url       = "http://www.haoyoucai888.com" + Request.Url.PathAndQuery;
            model.MakeSign();

            ViewBag.Share = model;

            return(View(question));
        }
예제 #2
0
        //[LoginValid]
        public ActionResult Detail(int id)
        {
            var question = _questionDbService.GetById(id);

            if (question == null)
            {
                return(View("NoData"));
            }
            question.RewardUsers.Clear();
            question.RewardUsers = _questionDbService.GetAllRewardUsers(id).ToList();
            question.PraisesNum  = _questionDbService.GetQuestionPraiseNum(id);

            var t1 = new Task(() => Update(id));

            t1.Start();

            var user = _workContext.CurrentUser;


            if (user != null)
            {
                ViewBag.isSelf = user.Id == question.UserId;
                var ll = _questionDbService.GetPraiseLog(user.Id, question.Id) != null;
                ViewBag.IsLike = ll;
                var aa = _friendDbService.GetFirendByUserId(user.Id, question.UserId) != null;
                ViewBag.Attentioned = aa;
            }
            else
            {
                ViewBag.Attentioned = false;
                ViewBag.isSelf      = false;
                ViewBag.IsLike      = false;
            }
            ViewBag.Reward        = 0.1;
            ViewBag.IsAnwserRight = HasAnwserRight(question);
            if (ViewBag.IsAnwserRight)
            {
                var my = question.RewardUsers.FirstOrDefault(n => n.Id == user.Id);
                if (my != null)
                {
                    var index = question.RewardUsers.ToList().IndexOf(my);
                    ViewBag.Reward = question.GetReward()[index];
                }
            }

            var model = new WXShareModel();

            model.appId     = WxPayConfig.APPID;
            model.nonceStr  = WxPayApi.GenerateNonceStr();
            model.timestamp = Util.CreateTimestamp();
            model.ticket    = GetTicket();
            model.url       = "http://www.haoyoucai888.com" + Request.Url.PathAndQuery;
            model.MakeSign();

            ViewBag.Share  = model;
            ViewBag.imgUrl = "http://www.haoyoucai888.com" + question.ImageUrl;
            return(View(question));
        }
예제 #3
0
        public ActionResult H5Login()
        {
            var model = new WXShareModel();

            model.appId     = WxPayConfig.APPID;
            model.nonceStr  = WxPayApi.GenerateNonceStr();
            model.timestamp = Util.CreateTimestamp();
            model.ticket    = GetTicket();
            model.url       = "http://www.haoyoucai888.com/Home/H5Login";// domain + Request.Url.PathAndQuery;
            model.MakeSign();
            return(View(model));
        }
예제 #4
0
        public ActionResult H5Login()
        {
            var model = new WXShareModel();

            model.appId     = WxPayConfig.APPID;
            model.nonceStr  = WxPayApi.GenerateNonceStr();
            model.timestamp = Util.CreateTimestamp();
            model.ticket    = GetTicket();
            model.url       = "http://www.haoyoucai888.com/ExternalAuthWeiXin/H5Login";// domain + Request.Url.PathAndQuery;
            model.MakeSign();
            Logger.Debug("获取到ticket:" + model.ticket);
            Logger.Debug("获取到签名:" + model.signature);
            return(View(model));
        }