예제 #1
0
        /// <summary>
        /// 首页
        /// </summary>
        /// <param name="unid">店铺id</param>
        /// <param name="info">微信用户信息json化字符串</param>
        /// <returns>页面缓存1小时</returns>
        //[OAuthFilter]
        public ActionResult Index(string unid, string info)
        {
            var userInfoCache = CookieHelper.GetCurrentWxUser();

            if (!string.IsNullOrEmpty(info) && userInfoCache == null)
            {
                WXUser entity = info.DeserializeJson <WXUser>();
                if (entity != null)
                {
                    //更新数据
                    IUserService.Update_User(entity);
                    CookieHelper.CreateWxUser(entity);
                }
            }

            //判断是否已有订单
            ViewBag.ExistsOrder = this.Request.Cookies["had"] == null ? false : (string.IsNullOrEmpty(this.Request.Cookies["had"].Value) ? false : true);

            //店铺id
            if (string.IsNullOrEmpty(unid))
            {
                unid = CookieHelper.GetCurrentShopId();
            }
            else
            {
                CookieHelper.CreateShopId(unid);
            }

            if (string.IsNullOrEmpty(unid))
            {
                return(OAuthExpired());
            }
            else
            {
                var entity = IDinnerShopService.Find_DinnerShop(unid);
                if (entity != null)
                {
                    var startTime = DateTime.Parse(entity.StartShoptime);
                    var endTime   = DateTime.Parse(entity.EndShoptime);
                    var nowTime   = DateTime.Parse(DateTime.Now.Hour + ":" + DateTime.Now.Minute);
                    if (nowTime < startTime || nowTime > endTime)
                    {
                        return(Content("抱歉,还没到营业时间"));
                    }
                }
                var item = IDinnerCategoryService.Get_ItemByShopId(unid);
                return(View(item));
            }
        }
예제 #2
0
        /// <summary>
        /// 明细(info)
        /// </summary>
        /// <param name="unid"></param
        /// <param name="info">用户信息</param>
        /// <returns></returns>
        //[OAuthFilter]
        public ActionResult Details(string unid, string info)
        {
            var userInfoCache = CookieHelper.GetCurrentWxUser();

            if (!string.IsNullOrEmpty(info) && userInfoCache == null)
            {
                WXUser entity = info.DeserializeJson <WXUser>();
                if (entity != null)
                {
                    //更新数据
                    IUserService.Update_User(entity);
                    CookieHelper.CreateWxUser(entity);
                }
            }

            var item = IScratchCardService.Show_ScratchCard(unid);

            return(View(item));
        }
예제 #3
0
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index(string info, string comId)
        {
            //接收微信用户数据
            var userInfoCache = CookieHelper.GetCurrentWxUser();
            var person        = CookieHelper.GetCurrentPeople();

            if (person == null && !string.IsNullOrEmpty(comId))
            {
                person = IPersonService.Get_ByComId(comId.GetInt());
                CookieHelper.CreatePeople(person);
            }
            UserCenterModel model = new UserCenterModel();

            if (!string.IsNullOrEmpty(info) && userInfoCache == null)
            {
                WXUser entity = info.DeserializeJson <WXUser>();
                if (entity != null)
                {
                    model.User = new Model.User()
                    {
                        NickName   = entity.nickname,
                        HeadImgUrl = entity.headimgurl
                    };
                    userInfoCache = entity;
                    //更新数据
                    IUserService.Update_User(entity);
                    CookieHelper.CreateWxUser(entity);
                }
            }

            model.User = new Model.User()
            {
                HeadImgUrl = userInfoCache.headimgurl,
                NickName   = userInfoCache.nickname
            };
            model.Score = IUserService.Find_PersonUserScore(person.UNID, userInfoCache.openid);
            var signModel = IUserSignService.Get_LastSign(userInfoCache.openid, person.UNID);

            model.SignNum = signModel == null ? 0 : (signModel.SignDate == DateTime.Now.Date || signModel.SignDate == DateTime.Now.AddDays(-1).Date ? signModel.SignNum : 0);

            return(View(model));
        }