parent
8f30271702
commit
11aa66ef8d
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"printWidth": 80,
|
||||
"proseWrap": "preserve",
|
||||
"bracketSameLine": false,
|
||||
"endOfLine": "auto",
|
||||
"tabWidth": 4,
|
||||
"useTabs": false,
|
||||
"trailingComma": "none"
|
||||
}
|
||||
23
pc/app.vue
23
pc/app.vue
|
|
@ -2,6 +2,7 @@
|
|||
import { ID_INJECTION_KEY, ElConfigProvider } from 'element-plus'
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
import { useAppStore } from './stores/app'
|
||||
|
||||
provide(ID_INJECTION_KEY, {
|
||||
prefix: 100,
|
||||
current: 0
|
||||
|
|
@ -11,7 +12,8 @@ const config = {
|
|||
}
|
||||
const appStore = useAppStore()
|
||||
const { pc_title, pc_ico, pc_keywords, pc_desc } = appStore.getWebsiteConfig
|
||||
useHead({
|
||||
const { clarity_code } = appStore.getSiteStatistics
|
||||
const headOptions: any = {
|
||||
title: pc_title,
|
||||
meta: [
|
||||
{ name: 'description', content: pc_desc },
|
||||
|
|
@ -22,8 +24,23 @@ useHead({
|
|||
rel: 'icon',
|
||||
href: pc_ico
|
||||
}
|
||||
]
|
||||
})
|
||||
],
|
||||
script: []
|
||||
}
|
||||
|
||||
if (clarity_code) {
|
||||
headOptions.script.push({
|
||||
type: 'text/javascript',
|
||||
innerHTML: `
|
||||
(function(c,l,a,r,i,t,y){
|
||||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
||||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
||||
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
||||
})(window, document, "clarity", "script", "${clarity_code}");
|
||||
`
|
||||
})
|
||||
}
|
||||
useHead(headOptions)
|
||||
</script>
|
||||
<template>
|
||||
<ElConfigProvider v-bind="config">
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ export enum RequestMethodsEnum {
|
|||
}
|
||||
|
||||
export enum RequestCodeEnum {
|
||||
SUCCESS = 1,
|
||||
FAIL = 0,
|
||||
NOT_INSTALL = -2,
|
||||
LOGIN_FAILURE = -1,
|
||||
FAIL = 0,
|
||||
SUCCESS = 1,
|
||||
OPEN_NEW_PAGE = 2
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
<template>
|
||||
<section class="layout-default min-w-[1200px]">
|
||||
<LayoutHeader />
|
||||
<div class="main-contain">
|
||||
<LayoutMain class="flex-1 min-h-0 flex">
|
||||
<slot v-if="userStore.isLogin || !$route.meta.auth" />
|
||||
<ToLogin class="h-full" v-else />
|
||||
</LayoutMain>
|
||||
<LayoutFooter />
|
||||
</div>
|
||||
<Account />
|
||||
</section>
|
||||
<section class="layout-default min-w-[1200px]">
|
||||
<LayoutHeader />
|
||||
<div class="main-contain">
|
||||
<LayoutMain class="flex-1 min-h-0 flex">
|
||||
<slot v-if="userStore.isLogin || !$route.meta.auth" />
|
||||
<ToLogin class="h-full" v-else />
|
||||
</LayoutMain>
|
||||
<LayoutFooter />
|
||||
</div>
|
||||
<Account />
|
||||
</section>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import LayoutHeader from './components/header/index.vue'
|
||||
import LayoutMain from './components/main/index.vue'
|
||||
import LayoutFooter from './components/footer/index.vue'
|
||||
import Account from './components/account/index.vue'
|
||||
import { useUserStore } from '~~/stores/user'
|
||||
import ToLogin from './components/account/to-login.vue'
|
||||
const userStore = useUserStore()
|
||||
import LayoutHeader from "./components/header/index.vue";
|
||||
import LayoutMain from "./components/main/index.vue";
|
||||
import LayoutFooter from "./components/footer/index.vue";
|
||||
import Account from "./components/account/index.vue";
|
||||
import { useUserStore } from "~~/stores/user";
|
||||
import ToLogin from "./components/account/to-login.vue";
|
||||
const userStore = useUserStore();
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.main-contain {
|
||||
min-height: calc(100vh - var(--header-height));
|
||||
@apply flex flex-col;
|
||||
min-height: calc(100vh - var(--header-height));
|
||||
@apply flex flex-col;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ export const useAppStore = defineStore({
|
|||
getLoginConfig: (state) => state.config.login || {},
|
||||
getCopyrightConfig: (state) => state.config.copyright || [],
|
||||
getQrcodeConfig: (state) => state.config.qrcode || {},
|
||||
getAdminUrl: (state) => state.config.admin_url
|
||||
getAdminUrl: (state) => state.config.admin_url,
|
||||
getSiteStatistics: (state) => state.config.siteStatistics || {}
|
||||
},
|
||||
actions: {
|
||||
async getConfig() {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const useUserStore = defineStore({
|
|||
const data = await getUserCenter()
|
||||
this.userInfo = data
|
||||
},
|
||||
setUser(userInfo) {
|
||||
setUser(userInfo: any) {
|
||||
this.userInfo = userInfo
|
||||
},
|
||||
login(token: string) {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ export function createRequest(opt?: Partial<FetchOptions>) {
|
|||
case RequestCodeEnum.LOGIN_FAILURE:
|
||||
userStore.logout()
|
||||
return Promise.reject(data)
|
||||
case RequestCodeEnum.NOT_INSTALL:
|
||||
window.location.replace('/install/install.php')
|
||||
break
|
||||
default:
|
||||
return data
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import com.mdd.admin.validate.commons.PageValidate;
|
|||
import com.mdd.admin.vo.article.ArticleCateVo;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.entity.article.Article;
|
||||
import com.mdd.common.entity.article.ArticleCategory;
|
||||
import com.mdd.common.mapper.article.ArticleCategoryMapper;
|
||||
import com.mdd.common.entity.article.ArticleCate;
|
||||
import com.mdd.common.mapper.article.ArticleCateMapper;
|
||||
import com.mdd.common.mapper.article.ArticleMapper;
|
||||
import com.mdd.common.util.TimeUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -31,7 +31,7 @@ import java.util.List;
|
|||
public class ArtCateServiceImpl implements IArtCateService {
|
||||
|
||||
@Resource
|
||||
ArticleCategoryMapper articleCategoryMapper;
|
||||
ArticleCateMapper articleCategoryMapper;
|
||||
|
||||
@Resource
|
||||
ArticleMapper articleMapper;
|
||||
|
|
@ -44,15 +44,15 @@ public class ArtCateServiceImpl implements IArtCateService {
|
|||
*/
|
||||
@Override
|
||||
public List<ArticleCateVo> all() {
|
||||
QueryWrapper<ArticleCategory> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<ArticleCate> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("id", "name", "sort", "is_show", "create_time", "update_time")
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.orderByDesc(Arrays.asList("sort", "id"));
|
||||
|
||||
List<ArticleCategory> lists = articleCategoryMapper.selectList(queryWrapper);
|
||||
List<ArticleCate> lists = articleCategoryMapper.selectList(queryWrapper);
|
||||
|
||||
List<ArticleCateVo> vos = new ArrayList<>();
|
||||
for (ArticleCategory category : lists) {
|
||||
for (ArticleCate category : lists) {
|
||||
ArticleCateVo vo = new ArticleCateVo();
|
||||
BeanUtils.copyProperties(category, vo);
|
||||
|
||||
|
|
@ -76,9 +76,9 @@ public class ArtCateServiceImpl implements IArtCateService {
|
|||
Integer pageNo = pageValidate.getPageNo();
|
||||
Integer pageSize = pageValidate.getPageSize();
|
||||
|
||||
QueryWrapper<ArticleCategory> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<ArticleCate> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("id", "name", "sort", "is_show", "create_time", "update_time")
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.orderByDesc(Arrays.asList("sort", "id"));
|
||||
|
||||
articleCategoryMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
||||
|
|
@ -86,16 +86,16 @@ public class ArtCateServiceImpl implements IArtCateService {
|
|||
"=:isShow@is_show:int"
|
||||
});
|
||||
|
||||
IPage<ArticleCategory> iPage = articleCategoryMapper.selectPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
IPage<ArticleCate> iPage = articleCategoryMapper.selectPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
List<ArticleCateVo> list = new ArrayList<>();
|
||||
for (ArticleCategory category : iPage.getRecords()) {
|
||||
for (ArticleCate category : iPage.getRecords()) {
|
||||
ArticleCateVo vo = new ArticleCateVo();
|
||||
BeanUtils.copyProperties(category, vo);
|
||||
|
||||
Long number = articleMapper.selectCount(new QueryWrapper<Article>()
|
||||
.eq("cid", category.getId())
|
||||
.eq("is_delete", 0));
|
||||
.isNull("delete_time"));
|
||||
|
||||
vo.setNumber(number);
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(vo.getCreateTime()));
|
||||
|
|
@ -115,13 +115,12 @@ public class ArtCateServiceImpl implements IArtCateService {
|
|||
*/
|
||||
@Override
|
||||
public ArticleCateVo detail(Integer id) {
|
||||
ArticleCategory model = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCategory>()
|
||||
.select(ArticleCategory.class, info->
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
ArticleCate model = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCate>()
|
||||
.select(ArticleCate.class, info->
|
||||
!info.getColumn().equals("delete_time"))
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0));
|
||||
.isNull("delete_time"));
|
||||
|
||||
Assert.notNull(model, "分类不存在");
|
||||
|
||||
|
|
@ -141,7 +140,7 @@ public class ArtCateServiceImpl implements IArtCateService {
|
|||
*/
|
||||
@Override
|
||||
public void add(ArtCateCreateValidate createValidate) {
|
||||
ArticleCategory model = new ArticleCategory();
|
||||
ArticleCate model = new ArticleCate();
|
||||
model.setName(createValidate.getName());
|
||||
model.setSort(createValidate.getSort());
|
||||
model.setIsShow(model.getIsShow());
|
||||
|
|
@ -158,13 +157,13 @@ public class ArtCateServiceImpl implements IArtCateService {
|
|||
*/
|
||||
@Override
|
||||
public void edit(ArtCateUpdateValidate updateValidate) {
|
||||
ArticleCategory model = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCategory>()
|
||||
.select(ArticleCategory.class, info->
|
||||
ArticleCate model = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCate>()
|
||||
.select(ArticleCate.class, info->
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
!info.getColumn().equals("delete_time"))
|
||||
.eq("id", updateValidate.getId())
|
||||
.eq("is_delete", 0));
|
||||
.isNull("delete_time"));
|
||||
|
||||
Assert.notNull(model, "分类不存在");
|
||||
|
||||
|
|
@ -183,22 +182,21 @@ public class ArtCateServiceImpl implements IArtCateService {
|
|||
*/
|
||||
@Override
|
||||
public void del(Integer id) {
|
||||
ArticleCategory model = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCategory>()
|
||||
ArticleCate model = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCate>()
|
||||
.select("id,is_show")
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0));
|
||||
.isNull("delete_time"));
|
||||
|
||||
Assert.notNull(model, "分类不存在");
|
||||
|
||||
Article article = articleMapper.selectOne(new QueryWrapper<Article>()
|
||||
.eq("cid", id)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.isNull(article, "当前分类已被文章使用,请先移除!");
|
||||
|
||||
model.setIsDelete(1);
|
||||
model.setDeleteTime(TimeUtils.timestamp());
|
||||
articleCategoryMapper.updateById(model);
|
||||
}
|
||||
|
|
@ -211,11 +209,11 @@ public class ArtCateServiceImpl implements IArtCateService {
|
|||
*/
|
||||
@Override
|
||||
public void change(Integer id) {
|
||||
ArticleCategory model = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCategory>()
|
||||
ArticleCate model = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCate>()
|
||||
.select("id,is_show")
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0));
|
||||
.isNull("delete_time"));
|
||||
|
||||
Assert.notNull(model, "分类不存在");
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import com.mdd.admin.vo.article.ArticleListedVo;
|
|||
import com.mdd.common.config.GlobalConfig;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.entity.article.Article;
|
||||
import com.mdd.common.entity.article.ArticleCategory;
|
||||
import com.mdd.common.mapper.article.ArticleCategoryMapper;
|
||||
import com.mdd.common.entity.article.ArticleCate;
|
||||
import com.mdd.common.mapper.article.ArticleCateMapper;
|
||||
import com.mdd.common.mapper.article.ArticleMapper;
|
||||
import com.mdd.common.util.StringUtils;
|
||||
import com.mdd.common.util.TimeUtils;
|
||||
|
|
@ -37,7 +37,7 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
ArticleMapper articleMapper;
|
||||
|
||||
@Resource
|
||||
ArticleCategoryMapper articleCategoryMapper;
|
||||
ArticleCateMapper articleCategoryMapper;
|
||||
|
||||
/**
|
||||
* 文章列表
|
||||
|
|
@ -120,13 +120,10 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
model.setCid(createValidate.getCid());
|
||||
model.setTitle(createValidate.getTitle());
|
||||
model.setImage(UrlUtils.toRelativeUrl(createValidate.getImage()));
|
||||
model.setIntro(createValidate.getIntro());
|
||||
model.setContent(createValidate.getContent());
|
||||
model.setSummary(createValidate.getSummary());
|
||||
model.setSort(createValidate.getSort());
|
||||
model.setIsShow(createValidate.getIsShow());
|
||||
model.setAuthor(createValidate.getAuthor());
|
||||
model.setVisit(createValidate.getVisit());
|
||||
model.setCreateTime(TimeUtils.timestamp());
|
||||
model.setUpdateTime(TimeUtils.timestamp());
|
||||
articleMapper.insert(model);
|
||||
|
|
@ -148,17 +145,14 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
Assert.notNull(model, "文章不存在!");
|
||||
|
||||
Assert.notNull(articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCategory>()
|
||||
new QueryWrapper<ArticleCate>()
|
||||
.eq("id", updateValidate.getCid())
|
||||
.eq("is_delete", 0)), "分类不存在");
|
||||
.isNull("delete_time")), "分类不存在");
|
||||
|
||||
model.setCid(updateValidate.getCid());
|
||||
model.setTitle(updateValidate.getTitle());
|
||||
model.setImage(UrlUtils.toRelativeUrl(updateValidate.getImage()));
|
||||
model.setIntro(updateValidate.getIntro());
|
||||
model.setContent(updateValidate.getContent());
|
||||
model.setSummary(updateValidate.getSummary());
|
||||
model.setVisit(updateValidate.getVisit());
|
||||
model.setIsShow(updateValidate.getIsShow());
|
||||
model.setAuthor(updateValidate.getAuthor());
|
||||
model.setSort(updateValidate.getSort());
|
||||
|
|
@ -181,8 +175,6 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
.eq("is_delete", 0));
|
||||
|
||||
Assert.notNull(article, "文章不存在!");
|
||||
|
||||
article.setIsDelete(1);
|
||||
article.setDeleteTime(TimeUtils.timestamp());
|
||||
articleMapper.updateById(article);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ public class DecoratePageServiceImpl implements IDecoratePageService {
|
|||
|
||||
DecoratePageVo vo = new DecoratePageVo();
|
||||
vo.setId(decoratePage.getId());
|
||||
vo.setPageType(decoratePage.getPageType());
|
||||
vo.setPageData(decoratePage.getPageData());
|
||||
vo.setPageType(decoratePage.getType());
|
||||
vo.setPageData(decoratePage.getData());
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ public class DecoratePageServiceImpl implements IDecoratePageService {
|
|||
DecoratePage decoratePage = decoratePageMapper.selectById(decoratePageValidate.getId());
|
||||
Assert.notNull(decoratePage, "数据不存在!");
|
||||
|
||||
decoratePage.setPageData(decoratePageValidate.getPageData());
|
||||
decoratePage.setData(decoratePageValidate.getPageData());
|
||||
decoratePage.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
decoratePageMapper.updateById(decoratePage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.mdd.common.entity.article;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -25,10 +27,12 @@ public class Article implements Serializable {
|
|||
private String title;
|
||||
|
||||
@ApiModelProperty("简介")
|
||||
private String intro;
|
||||
@TableField(value = "`desc`")
|
||||
private String desc;
|
||||
|
||||
@ApiModelProperty("摘要")
|
||||
private String summary;
|
||||
@TableField(value = "abstract")
|
||||
private String abstractField;
|
||||
|
||||
@ApiModelProperty("封面")
|
||||
private String image;
|
||||
|
|
@ -39,8 +43,11 @@ public class Article implements Serializable {
|
|||
@ApiModelProperty("作者")
|
||||
private String author;
|
||||
|
||||
@ApiModelProperty("浏览")
|
||||
private Integer visit;
|
||||
@ApiModelProperty("虚拟浏览量")
|
||||
private Integer clickVirtual;
|
||||
|
||||
@ApiModelProperty("实际浏览量")
|
||||
private Integer clickActual;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
private Integer sort;
|
||||
|
|
@ -48,9 +55,6 @@ public class Article implements Serializable {
|
|||
@ApiModelProperty("是否显示: [0=否, 1=是]")
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty("是否删除: [0=否, 1=是]")
|
||||
private Integer isDelete;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Long createTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.io.Serializable;
|
|||
|
||||
@Data
|
||||
@ApiModel("文章分类实体")
|
||||
public class ArticleCategory implements Serializable {
|
||||
public class ArticleCate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
@ -27,9 +27,6 @@ public class ArticleCategory implements Serializable {
|
|||
@ApiModelProperty("是否显示: [0=否, 1=是]")
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty("是否删除: [0=否, 1=是]")
|
||||
private Integer isDelete;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Long createTime;
|
||||
|
||||
|
|
@ -19,13 +19,16 @@ public class DecoratePage implements Serializable {
|
|||
private Integer id;
|
||||
|
||||
@ApiModelProperty("页面类型")
|
||||
private Integer pageType;
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("页面名称")
|
||||
private String pageName;
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("页面数据")
|
||||
private String pageData;
|
||||
private String data;
|
||||
|
||||
@ApiModelProperty("页面设置")
|
||||
private String meta;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Long createTime;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package com.mdd.common.mapper.article;
|
||||
|
||||
import com.mdd.common.core.basics.IBaseMapper;
|
||||
import com.mdd.common.entity.article.ArticleCategory;
|
||||
import com.mdd.common.entity.article.ArticleCate;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 文章分类
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArticleCategoryMapper extends IBaseMapper<ArticleCategory> {
|
||||
public interface ArticleCateMapper extends IBaseMapper<ArticleCate> {
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ public class ArticleController {
|
|||
IArticleService iArticleService;
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/category")
|
||||
@GetMapping("/cate")
|
||||
@ApiOperation(value="文章分类")
|
||||
public AjaxResult<List<ArticleCateVo>> category() {
|
||||
List<ArticleCateVo> list = iArticleService.category();
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/index")
|
||||
@RequestMapping("/api/pc")
|
||||
@Api(tags = "主页管理")
|
||||
public class IndexController {
|
||||
|
||||
|
|
|
|||
|
|
@ -24,41 +24,41 @@ import java.util.Map;
|
|||
@Api(tags = "电脑管理")
|
||||
public class PcController {
|
||||
|
||||
@Resource
|
||||
IPcService iPcService;
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/index")
|
||||
@ApiOperation(value="主页数据")
|
||||
public AjaxResult<Map<String,Object>> index() {
|
||||
Map<String, Object> index = iPcService.index();
|
||||
return AjaxResult.success(index);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/getConfig")
|
||||
@ApiOperation(value="公共配置")
|
||||
public AjaxResult<Map<String, Object>> getConfig() {
|
||||
Map<String, Object> config = iPcService.getConfig();
|
||||
return AjaxResult.success(config);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/articleCenter")
|
||||
@ApiOperation(value="资讯中心")
|
||||
public AjaxResult<List<PcArticleCenterVo>> articleCenter() {
|
||||
List<PcArticleCenterVo> list = iPcService.articleCenter();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/articleDetail")
|
||||
@ApiOperation(value="文章详情")
|
||||
public AjaxResult<PcArticleDetailVo> articleDetail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||
|
||||
PcArticleDetailVo vo = iPcService.articleDetail(id, userId);
|
||||
return AjaxResult.success(vo);
|
||||
}
|
||||
// @Resource
|
||||
// IPcService iPcService;
|
||||
//
|
||||
// @NotLogin
|
||||
// @GetMapping("/index")
|
||||
// @ApiOperation(value="主页数据")
|
||||
// public AjaxResult<Map<String,Object>> index() {
|
||||
// Map<String, Object> index = iPcService.index();
|
||||
// return AjaxResult.success(index);
|
||||
// }
|
||||
//
|
||||
// @NotLogin
|
||||
// @GetMapping("/getConfig")
|
||||
// @ApiOperation(value="公共配置")
|
||||
// public AjaxResult<Map<String, Object>> getConfig() {
|
||||
// Map<String, Object> config = iPcService.getConfig();
|
||||
// return AjaxResult.success(config);
|
||||
// }
|
||||
//
|
||||
// @NotLogin
|
||||
// @GetMapping("/articleCenter")
|
||||
// @ApiOperation(value="资讯中心")
|
||||
// public AjaxResult<List<PcArticleCenterVo>> articleCenter() {
|
||||
// List<PcArticleCenterVo> list = iPcService.articleCenter();
|
||||
// return AjaxResult.success(list);
|
||||
// }
|
||||
//
|
||||
// @NotLogin
|
||||
// @GetMapping("/articleDetail")
|
||||
// @ApiOperation(value="文章详情")
|
||||
// public AjaxResult<PcArticleDetailVo> articleDetail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
// Integer userId = LikeFrontThreadLocal.getUserId();
|
||||
//
|
||||
// PcArticleDetailVo vo = iPcService.articleDetail(id, userId);
|
||||
// return AjaxResult.success(vo);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import com.github.yulichang.query.MPJQueryWrapper;
|
|||
import com.mdd.common.config.GlobalConfig;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.entity.article.Article;
|
||||
import com.mdd.common.entity.article.ArticleCategory;
|
||||
import com.mdd.common.entity.article.ArticleCate;
|
||||
import com.mdd.common.entity.article.ArticleCollect;
|
||||
import com.mdd.common.mapper.article.ArticleCategoryMapper;
|
||||
import com.mdd.common.mapper.article.ArticleCateMapper;
|
||||
import com.mdd.common.mapper.article.ArticleCollectMapper;
|
||||
import com.mdd.common.mapper.article.ArticleMapper;
|
||||
import com.mdd.common.util.StringUtils;
|
||||
|
|
@ -41,7 +41,7 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
ArticleMapper articleMapper;
|
||||
|
||||
@Resource
|
||||
ArticleCategoryMapper articleCategoryMapper;
|
||||
ArticleCateMapper articleCategoryMapper;
|
||||
|
||||
@Resource
|
||||
ArticleCollectMapper articleCollectMapper;
|
||||
|
|
@ -54,15 +54,15 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
*/
|
||||
@Override
|
||||
public List<ArticleCateVo> category() {
|
||||
List<ArticleCategory> articleCateVos = articleCategoryMapper.selectList(
|
||||
new QueryWrapper<ArticleCategory>()
|
||||
List<ArticleCate> articleCateVos = articleCategoryMapper.selectList(
|
||||
new QueryWrapper<ArticleCate>()
|
||||
.select("id,name")
|
||||
.eq("is_show", 1)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.orderByDesc(Arrays.asList("sort", "id")));
|
||||
|
||||
List<ArticleCateVo> list = new LinkedList<>();
|
||||
for (ArticleCategory category: articleCateVos) {
|
||||
for (ArticleCate category: articleCateVos) {
|
||||
ArticleCateVo vo = new ArticleCateVo();
|
||||
BeanUtils.copyProperties(category, vo);
|
||||
list.add(vo);
|
||||
|
|
@ -177,7 +177,7 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
vo.setImage(UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(article.getCreateTime()));
|
||||
|
||||
article.setVisit(article.getVisit() + 1);
|
||||
article.setClickActual(article.getClickActual() + 1);
|
||||
articleMapper.updateById(article);
|
||||
|
||||
return vo;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class IndexServiceImpl implements IIndexService {
|
|||
List<Map<String, Object>> articleList = new LinkedList<>();
|
||||
List<Article> articles = articleMapper.selectList(new QueryWrapper<Article>()
|
||||
.eq("is_show", 1)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.orderByDesc("id")
|
||||
.last("limit 20"));
|
||||
|
||||
|
|
@ -61,17 +61,17 @@ public class IndexServiceImpl implements IIndexService {
|
|||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("id", article.getId());
|
||||
map.put("title", article.getTitle());
|
||||
map.put("intro", article.getIntro());
|
||||
map.put("summary", article.getSummary());
|
||||
map.put("intro", article.getContent());
|
||||
map.put("summary", article.getAbstractField());
|
||||
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||
map.put("author", article.getAuthor());
|
||||
map.put("visit", article.getVisit());
|
||||
map.put("visit", article.getClickActual());
|
||||
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
||||
articleList.add(map);
|
||||
}
|
||||
|
||||
response.put("domain", UrlUtils.domain());
|
||||
response.put("pages", decoratePage.getPageData());
|
||||
response.put("pages", decoratePage.getData());
|
||||
response.put("article", articleList);
|
||||
return response;
|
||||
}
|
||||
|
|
@ -93,9 +93,9 @@ public class IndexServiceImpl implements IIndexService {
|
|||
Assert.notNull(decoratePage, "数据不存在!");
|
||||
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
response.put("type", decoratePage.getPageType());
|
||||
response.put("name", decoratePage.getPageName());
|
||||
response.put("pages", decoratePage.getPageData());
|
||||
response.put("type", decoratePage.getType());
|
||||
response.put("name", decoratePage.getName());
|
||||
response.put("pages", decoratePage.getData());
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ package com.mdd.front.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mdd.common.config.GlobalConfig;
|
||||
import com.mdd.common.entity.article.ArticleCate;
|
||||
import com.mdd.common.entity.decorate.DecoratePage;
|
||||
import com.mdd.common.entity.article.Article;
|
||||
import com.mdd.common.entity.article.ArticleCategory;
|
||||
import com.mdd.common.entity.article.ArticleCollect;
|
||||
import com.mdd.common.exception.OperateException;
|
||||
import com.mdd.common.mapper.article.ArticleCateMapper;
|
||||
import com.mdd.common.mapper.decorate.DecoratePageMapper;
|
||||
import com.mdd.common.mapper.article.ArticleCategoryMapper;
|
||||
import com.mdd.common.mapper.article.ArticleCollectMapper;
|
||||
import com.mdd.common.mapper.article.ArticleMapper;
|
||||
import com.mdd.common.util.*;
|
||||
|
|
@ -28,7 +28,7 @@ public class PcServiceImpI implements IPcService {
|
|||
DecoratePageMapper decoratePageMapper;
|
||||
|
||||
@Resource
|
||||
ArticleCategoryMapper articleCategoryMapper;
|
||||
ArticleCateMapper articleCategoryMapper;
|
||||
|
||||
@Resource
|
||||
ArticleCollectMapper articleCollectMapper;
|
||||
|
|
@ -61,10 +61,10 @@ public class PcServiceImpI implements IPcService {
|
|||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("id", article.getId());
|
||||
map.put("title", article.getTitle());
|
||||
map.put("intro", article.getIntro());
|
||||
map.put("summary", article.getSummary());
|
||||
map.put("intro", article.getContent());
|
||||
map.put("summary", article.getAbstractField());
|
||||
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||
map.put("visit", article.getVisit());
|
||||
map.put("visit", article.getClickActual());
|
||||
map.put("author", article.getAuthor());
|
||||
map.put("sort", article.getSort());
|
||||
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
||||
|
|
@ -82,10 +82,10 @@ public class PcServiceImpI implements IPcService {
|
|||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("id", article.getId());
|
||||
map.put("title", article.getTitle());
|
||||
map.put("intro", article.getIntro());
|
||||
map.put("summary", article.getSummary());
|
||||
map.put("intro", article.getContent());
|
||||
map.put("summary", article.getAbstractField());
|
||||
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||
map.put("visit", article.getVisit());
|
||||
map.put("visit", article.getClickActual());
|
||||
map.put("sort", article.getSort());
|
||||
map.put("author", article.getAuthor());
|
||||
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
||||
|
|
@ -103,17 +103,17 @@ public class PcServiceImpI implements IPcService {
|
|||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("id", article.getId());
|
||||
map.put("title", article.getTitle());
|
||||
map.put("intro", article.getIntro());
|
||||
map.put("summary", article.getSummary());
|
||||
map.put("intro", article.getContent());
|
||||
map.put("summary", article.getAbstractField());
|
||||
map.put("image", UrlUtils.toAbsoluteUrl(article.getImage()));
|
||||
map.put("author", article.getAuthor());
|
||||
map.put("visit", article.getVisit());
|
||||
map.put("visit", article.getClickActual());
|
||||
map.put("sort", article.getSort());
|
||||
map.put("createTime", TimeUtils.timestampToDate(article.getCreateTime()));
|
||||
articlesHostList.add(map);
|
||||
}
|
||||
|
||||
indexData.put("pages", decoratePage.getPageData());
|
||||
indexData.put("pages", decoratePage.getData());
|
||||
indexData.put("all", articlesAllList);
|
||||
indexData.put("new", articlesNewList);
|
||||
indexData.put("hot", articlesHostList);
|
||||
|
|
@ -176,18 +176,18 @@ public class PcServiceImpI implements IPcService {
|
|||
*/
|
||||
@Override
|
||||
public List<PcArticleCenterVo> articleCenter() {
|
||||
List<ArticleCategory> articleCategoryList = articleCategoryMapper.selectList(
|
||||
new QueryWrapper<ArticleCategory>()
|
||||
List<ArticleCate> articleCategoryList = articleCategoryMapper.selectList(
|
||||
new QueryWrapper<ArticleCate>()
|
||||
.eq("is_show", 1)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.orderByDesc(Arrays.asList("sort", "id")));
|
||||
|
||||
List<PcArticleCenterVo> list = new LinkedList<>();
|
||||
for (ArticleCategory articleCategory : articleCategoryList) {
|
||||
for (ArticleCate articleCategory : articleCategoryList) {
|
||||
List<Article> articleList = articleMapper.selectList(new QueryWrapper<Article>()
|
||||
.eq("cid", articleCategory.getId())
|
||||
.eq("is_show", 1)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.orderByDesc(Arrays.asList("sort", "id"))
|
||||
.last("limit 10"));
|
||||
|
||||
|
|
@ -224,10 +224,9 @@ public class PcServiceImpI implements IPcService {
|
|||
Article article = articleMapper.selectOne(new QueryWrapper<Article>()
|
||||
.select(Article.class, info->
|
||||
!info.getColumn().equals("is_show") &&
|
||||
!info.getColumn().equals("is_delete") &&
|
||||
!info.getColumn().equals("delete_time"))
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.last("limit 1"));
|
||||
|
||||
if (StringUtils.isNull(article)) {
|
||||
|
|
@ -235,16 +234,16 @@ public class PcServiceImpI implements IPcService {
|
|||
}
|
||||
|
||||
// 分类名称
|
||||
ArticleCategory articleCategory = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCategory>()
|
||||
ArticleCate articleCategory = articleCategoryMapper.selectOne(
|
||||
new QueryWrapper<ArticleCate>()
|
||||
.eq("id", article.getCid())
|
||||
.eq("is_delete", 0));
|
||||
.isNull("delete_time"));
|
||||
|
||||
// 上一条记录
|
||||
Article prev = articleMapper.selectOne(new QueryWrapper<Article>()
|
||||
.select("id,title")
|
||||
.lt("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.orderByDesc(Arrays.asList("sort", "id"))
|
||||
.last("limit 1"));
|
||||
|
||||
|
|
@ -252,7 +251,7 @@ public class PcServiceImpI implements IPcService {
|
|||
Article next = articleMapper.selectOne(new QueryWrapper<Article>()
|
||||
.select("id,title")
|
||||
.gt("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.orderByDesc(Arrays.asList("sort", "id"))
|
||||
.last("limit 1"));
|
||||
|
||||
|
|
@ -260,14 +259,14 @@ public class PcServiceImpI implements IPcService {
|
|||
ArticleCollect collect = articleCollectMapper.selectOne(new QueryWrapper<ArticleCollect>()
|
||||
.eq("article_id", article.getId())
|
||||
.eq("user_id", userId)
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.last("limit 1"));
|
||||
|
||||
// 最新资讯
|
||||
List<Article> news = articleMapper.selectList(new QueryWrapper<Article>()
|
||||
.select("id,title,image,create_time,update_time")
|
||||
.eq("cid", article.getCid())
|
||||
.eq("is_delete", 0)
|
||||
.isNull("delete_time")
|
||||
.orderByDesc("id")
|
||||
.last("limit 8"));
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ spring:
|
|||
password: # Redis密码
|
||||
database: 0 # 数据库索引
|
||||
|
||||
|
||||
# Mybatis-plus配置 【是否开启SQL日志输出】
|
||||
#mybatis-plus:
|
||||
# configuration:
|
||||
|
|
|
|||
Loading…
Reference in New Issue