/// <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)); } }