public JsonResponse GetPrenextBlog([FromBody] PrenextModel model) { try { if (string.IsNullOrEmpty(model.BlogNum)) { return(new JsonResponse { Code = 1, Msg = "参数不合法" }); } var dic = new Dictionary <string, object> { { nameof(Bloginfo.IsDeleted), 0 }, { nameof(Bloginfo.BlogNum), model.BlogNum } }; var retlist = BlogHelper.GetPrenextBlog(model.BlogNum, model.BlogType); return(new JsonResponse { Code = retlist.IsSucceed ? 0 : 1, Data = retlist }); } catch (Exception ex) { LogHelper.WriteLog(ex, "BlogController/GetPrenext"); return(new JsonResponse { Code = 1, Msg = "程序好像开小差了" + ex.Message }); } }
public JsonResponse GetListBlogTypes([FromBody] PrenextModel model) { try { var dic = new Dictionary <string, object> { { nameof(Category.IsDeleted), 0 }, { nameof(Category.States), 0 } }; string key = ConfigUtil.BlogTypeListCacheKey; List <Category> retlist = new List <Category>(); var cacheobj = CacheHelper.GetCacheItem(key)?.ToString() ?? ""; if (!string.IsNullOrEmpty(cacheobj)) { retlist = CacheHelper.GetCacheItem(key)?.DeserialObjectToList <Category>(); } if (retlist == null || retlist.Count == 0) { retlist = BlogHelper.GetList_Category(dic); CacheHelper.AddCacheItem(key, retlist.SerializObject(), DateTime.Now.AddDays(2), Cache.NoSlidingExpiration, CacheItemPriority.High); } retlist = retlist?.OrderByDescending(x => x.CreateTime)?.OrderByDescending(x => x.Sort)?.ToList(); return(new JsonResponse { Code = retlist != null ? 0 : 1, Data = retlist }); } catch (Exception ex) { LogHelper.WriteLog(ex, "BlogController/GetListBlogTypes"); return(new JsonResponse { Code = 1, Msg = "程序好像开小差了" + ex.Message }); } }