package com.autu._admin.article; import java.util.List; import com.autu.common.annotation.SysLogInfo; import com.autu.common.controller.BaseController; import com.autu.common.model.entity.Article; import com.autu.common.model.entity.Meta; import com.autu.common.model.entity.User; import com.jfinal.aop.Inject; import com.jfinal.kit.Ret; import com.jfinal.plugin.activerecord.Page; /** * 文章后台管理的控制器 * * @author tyf * */ public class ArticleAdminApi extends BaseController { @Inject private AdminArticleService articleService; @Inject private AdminArticleLuceneIndexes luceneIndexes; @SysLogInfo(value="重置文章索引",action="udpate") public void createIndex() { luceneIndexes.resetArticleIndexes(); renderJson(Ret.ok()); } public void list() { Article article = getModel(Article.class, "", true); Integer metaid = getParaToInt("categoryId"); Integer pageNum = getParaToInt("page"); Integer limit = getParaToInt("limit"); Page<Article> articlePage = articleService.page(article, metaid, pageNum, limit); Ret ret = Ret.ok().set("code", 0).set("data", articlePage.getList()).set("count", articlePage.getTotalRow()); renderJson(ret.toJson()); } @SysLogInfo(value="使用metaweblog接口推送文章",action="other") public void asyncMetaWeblog() { Integer id=getParaToInt(); renderJson(articleService.asyncMetaWeblog(id)); } /** * 执行文章编辑 * * @throws Exception */ @SysLogInfo(value="编辑文章",action="saveOrUpdate") public void edit() { Article article = getModel(Article.class, "", true); List<Meta> tags=getModelList(Meta.class, "tag"); List<Meta> categorys=getModelList(Meta.class, "category"); User user=getLoginUser(); article.setUserId(user.getId()); articleService.saveOrUpdate(article, tags, categorys); renderJson(Ret.ok("msg","添加成功!").set("article", article).toJson()); } @SysLogInfo(value="废弃文章",action="update") public void remove() { Integer id =getParaToInt(0); renderJson(articleService.remove(id).toJson());; } @SysLogInfo(value="删除文章",action="delete") public void delete() { Integer id =getParaToInt(0); renderJson(articleService.delete(id).toJson());; } @SysLogInfo(value="恢复文章",action="update") public void recover() { Integer id = getParaToInt(0); renderJson(articleService.recover(id));; } /** * 获取文章信息 */ public void get() { renderJson(Ret.ok("article", articleService.get(getParaToInt(0)))); } /** * 获取浏览量最多的前几条 */ public void listHot() { renderJson(Ret.ok("list", articleService.listHot(getParaToInt("num",8)))); } }

校园网 LV9
2023年5月31日
qingsj LV6
2023年3月2日
dawnguarda LV17
2022年11月2日
lcbaaa LV6
2022年8月12日
wr450702 LV2
2022年5月18日
小尤ggggg LV8
2022年5月9日
Demo1111 LV30
2022年3月14日
刘亦菲9527 LV15
2021年12月31日
采暖11 LV11
2021年12月6日
chinawind1990 LV5
2021年11月25日

wkq888 LV17
4月9日
krispeng LV15
2024年11月20日
yellow_flowers LV8
2024年7月8日
TY0165 LV20
2024年6月21日
玖零定制问题修复 LV34
2024年5月4日
微信网友_6927932988952576 LV12
2024年3月31日
lichengai LV7
2024年2月26日
yxzzxy LV3
2024年2月18日
pangzhihui LV14
2024年2月15日
无敌霸王龙
2024年1月18日
暂无贡献等级