Exemplo n.º 1
0
        public ActionResult SaleOff()
        {
            var             setting_item = periodDB.PeriodUserInfo.SingleOrDefault(m => m.UserName == User.Identity.Name);
            WeChatUtilities utilities    = new WeChatUtilities();
            string          _url         = ViewBag.Url = Request.Url.ToString();

            ViewBag.AppId = utilities.getAppId();
            string _nonce = CommonUtilities.generateNonce();

            ViewBag.Nonce = _nonce;
            string _timeStamp = CommonUtilities.generateTimeStamp().ToString();

            ViewBag.TimeStamp = _timeStamp;
            ViewBag.Signature = utilities.generateWxJsApiSignature(_nonce, utilities.getJsApiTicket(), _timeStamp, _url);
            if (setting_item != null)
            {
                DateTime today        = DateTime.Now.Date;
                var      SignInRecord = periodDB.CreditsRecord.SingleOrDefault(m => m.RecordDate > today && m.CreditsType_Id == 1 && m.UserName == User.Identity.Name);
                if (SignInRecord == null)
                {
                    ViewBag.enableSignIn = true;
                }
                else
                {
                    ViewBag.enableSignIn = false;
                }
                var current_user = UserManager.FindByName(User.Identity.Name);
                return(View(current_user));
            }
            else
            {
                return(RedirectToAction("Setting"));
            }
        }
Exemplo n.º 2
0
        public ActionResult CustomMicroPay()
        {
            WeChatUtilities utilities = new WeChatUtilities();
            string          _url      = ViewBag.Url = Request.Url.ToString();

            ViewBag.AppId = utilities.getAppId();
            string _nonce = CommonUtilities.generateNonce();

            ViewBag.Nonce = _nonce;
            string _timeStamp = CommonUtilities.generateTimeStamp().ToString();

            ViewBag.TimeStamp = _timeStamp;
            ViewBag.Signature = utilities.generateWxJsApiSignature(_nonce, utilities.getJsApiTicket(), _timeStamp, _url);
            return(View());
        }