修改博客
parent
33be0d7c00
commit
b40d043645
|
|
@ -8,12 +8,15 @@ import com.zhangmeng.admin.manager.service.*;
|
||||||
import com.zhangmeng.admin.manager.utils.UserUtil;
|
import com.zhangmeng.admin.manager.utils.UserUtil;
|
||||||
import com.zhangmeng.model.base.baseController.BaseController;
|
import com.zhangmeng.model.base.baseController.BaseController;
|
||||||
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
||||||
|
import com.zhangmeng.model.dto.article.ArticleDto;
|
||||||
|
import com.zhangmeng.model.dto.article.ArticleModel;
|
||||||
import com.zhangmeng.model.dto.system.EncryptType;
|
import com.zhangmeng.model.dto.system.EncryptType;
|
||||||
import com.zhangmeng.model.dto.system.Menu;
|
import com.zhangmeng.model.dto.system.Menu;
|
||||||
import com.zhangmeng.model.dto.query.QueryParams;
|
import com.zhangmeng.model.dto.query.QueryParams;
|
||||||
import com.zhangmeng.model.dto.system.SysConstant;
|
import com.zhangmeng.model.dto.system.SysConstant;
|
||||||
import com.zhangmeng.model.entity.*;
|
import com.zhangmeng.model.entity.*;
|
||||||
import com.zhangmeng.model.vo.Result;
|
import com.zhangmeng.model.vo.Result;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cloud.client.ServiceInstance;
|
import org.springframework.cloud.client.ServiceInstance;
|
||||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||||
|
|
@ -30,8 +33,8 @@ import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangmeng
|
* @author zhangmeng
|
||||||
* @date 2021年11月9日09:06:23
|
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
* @date 2021年11月9日09:06:23
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class UrlRequestController extends BaseController {
|
public class UrlRequestController extends BaseController {
|
||||||
|
|
@ -152,6 +155,7 @@ public class UrlRequestController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户列表
|
* 用户列表
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -162,6 +166,7 @@ public class UrlRequestController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户添加
|
* 用户添加
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -172,6 +177,7 @@ public class UrlRequestController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户列表
|
* 用户列表
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -186,6 +192,7 @@ public class UrlRequestController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色列表
|
* 角色列表
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/role/index")
|
@GetMapping("/role/index")
|
||||||
|
|
@ -195,6 +202,7 @@ public class UrlRequestController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色添加
|
* 角色添加
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -216,6 +224,7 @@ public class UrlRequestController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权
|
* 授权
|
||||||
|
*
|
||||||
* @param model
|
* @param model
|
||||||
* @param roleId
|
* @param roleId
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -488,4 +497,25 @@ public class UrlRequestController extends BaseController {
|
||||||
String path = serviceInstance.getUri().toString();
|
String path = serviceInstance.getUri().toString();
|
||||||
return new RedirectView(path);
|
return new RedirectView(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 博客首页
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/blog/index")
|
||||||
|
public ModelAndView index(Model model, Integer pageNum, Integer pageSize) {
|
||||||
|
if (pageNum == null) {
|
||||||
|
pageNum = CommonUtil.pageNum;
|
||||||
|
}
|
||||||
|
if (pageSize == null) {
|
||||||
|
pageSize = CommonUtil.pageSize;
|
||||||
|
}
|
||||||
|
Map<String, Object> map = this.articleFeign.getListByPage(pageNum, pageSize);
|
||||||
|
model.addAllAttributes(map);
|
||||||
|
return this.jumpPage("blog/v1/index");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -159,4 +159,10 @@ public class UserController extends BaseController implements UserControllerApi
|
||||||
public User findByUserName(String username) {
|
public User findByUserName(String username) {
|
||||||
return this.userService.loadUserByUsername(username);
|
return this.userService.loadUserByUsername(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("findByUserId")
|
||||||
|
public User findByUserId(@RequestParam("userId") Long userId){
|
||||||
|
return this.userService.findById(userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.zhangmeng.admin.manager.feign;
|
package com.zhangmeng.admin.manager.feign;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.zhangmeng.model.dto.query.QueryParams;
|
||||||
import com.zhangmeng.model.dto.system.SysConstant;
|
import com.zhangmeng.model.dto.system.SysConstant;
|
||||||
import com.zhangmeng.model.entity.Article;
|
import com.zhangmeng.model.entity.Article;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
|
@ -8,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@FeignClient(value = SysConstant.mystyle_cloud_blog,contextId ="ArticleFeign")
|
@FeignClient(value = SysConstant.mystyle_cloud_blog,contextId ="ArticleFeign")
|
||||||
public interface ArticleFeign {
|
public interface ArticleFeign {
|
||||||
|
|
@ -23,4 +26,7 @@ public interface ArticleFeign {
|
||||||
|
|
||||||
@GetMapping("/article/findById")
|
@GetMapping("/article/findById")
|
||||||
Article findById(@RequestParam(value = "articleId") Long articleId);
|
Article findById(@RequestParam(value = "articleId") Long articleId);
|
||||||
|
|
||||||
|
@GetMapping("/article/getListByPage")
|
||||||
|
Map<String,Object> getListByPage(@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,9 @@ mapper:
|
||||||
enum-as-simple-type: true
|
enum-as-simple-type: true
|
||||||
identity: MYSQL
|
identity: MYSQL
|
||||||
check-example-entity-class: true
|
check-example-entity-class: true
|
||||||
|
|
||||||
mystyle:
|
mystyle:
|
||||||
security:
|
security:
|
||||||
open-api:
|
open-api:
|
||||||
- /
|
|
||||||
- /login
|
- /login
|
||||||
- /favicon.ico # 开放FAVICON
|
- /favicon.ico # 开放FAVICON
|
||||||
- /system/**
|
- /system/**
|
||||||
|
|
@ -73,6 +71,8 @@ mystyle:
|
||||||
- /webjars/**
|
- /webjars/**
|
||||||
- /actuator/**
|
- /actuator/**
|
||||||
- /instances/**
|
- /instances/**
|
||||||
|
- /blog/index
|
||||||
|
- /user/findByUserId
|
||||||
verification-code:
|
verification-code:
|
||||||
type: mysql
|
type: mysql
|
||||||
expiration-time: 300
|
expiration-time: 300
|
||||||
|
|
|
||||||
|
|
@ -35,4 +35,7 @@ public interface UserControllerApi {
|
||||||
|
|
||||||
@ApiOperation("根据用户名称查询用户")
|
@ApiOperation("根据用户名称查询用户")
|
||||||
public User findByUserName(String username);
|
public User findByUserName(String username);
|
||||||
|
|
||||||
|
@ApiOperation("根据用户id查询用户")
|
||||||
|
public User findByUserId(@RequestParam("userId") Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.zhangmeng.api.service.blog;
|
package com.zhangmeng.api.service.blog;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.zhangmeng.model.dto.query.QueryParams;
|
||||||
import com.zhangmeng.model.entity.Article;
|
import com.zhangmeng.model.entity.Article;
|
||||||
import com.zhangmeng.model.vo.Result;
|
import com.zhangmeng.model.vo.Result;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -35,4 +37,7 @@ public interface ArticleControllerApi {
|
||||||
|
|
||||||
@ApiOperation("根据id查询")
|
@ApiOperation("根据id查询")
|
||||||
public Article findById(@RequestParam Long articleId);
|
public Article findById(@RequestParam Long articleId);
|
||||||
|
|
||||||
|
@ApiOperation("查询文章")
|
||||||
|
Map<String,Object> getListByPage(@RequestParam Integer pageNum,@RequestParam Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import com.zhangmeng.blog.service.ArticleService;
|
||||||
import com.zhangmeng.blog.service.CategoryService;
|
import com.zhangmeng.blog.service.CategoryService;
|
||||||
import com.zhangmeng.model.base.baseController.BaseController;
|
import com.zhangmeng.model.base.baseController.BaseController;
|
||||||
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
import com.zhangmeng.model.base.baseUtil.CommonUtil;
|
||||||
|
import com.zhangmeng.model.dto.article.ArticleDto;
|
||||||
|
import com.zhangmeng.model.dto.article.ArticleModel;
|
||||||
import com.zhangmeng.model.dto.query.QueryParams;
|
import com.zhangmeng.model.dto.query.QueryParams;
|
||||||
import com.zhangmeng.model.entity.Article;
|
import com.zhangmeng.model.entity.Article;
|
||||||
import com.zhangmeng.model.entity.Category;
|
import com.zhangmeng.model.entity.Category;
|
||||||
|
|
@ -15,6 +17,7 @@ import com.zhangmeng.model.vo.Result;
|
||||||
import com.zhangmeng.model.vo.StatusCode;
|
import com.zhangmeng.model.vo.StatusCode;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -24,9 +27,7 @@ import tk.mybatis.mapper.entity.Condition;
|
||||||
import tk.mybatis.mapper.entity.Example;
|
import tk.mybatis.mapper.entity.Example;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -179,8 +180,40 @@ public class ArticleController extends BaseController implements ArticleControll
|
||||||
return this.articleService.findByCondition(new QueryParams(new Condition(Article.class)));
|
return this.articleService.findByCondition(new QueryParams(new Condition(Article.class)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@GetMapping("/findById")
|
@GetMapping("/findById")
|
||||||
public Article findById(@RequestParam Long articleId){
|
public Article findById(@RequestParam Long articleId){
|
||||||
return this.articleService.findById(articleId);
|
return this.articleService.findById(articleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("/getListByPage")
|
||||||
|
public Map<String,Object> getListByPage(@RequestParam Integer pageNum,@RequestParam Integer pageSize){
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
ArticleModel articleModel = new ArticleModel();
|
||||||
|
//文章总数
|
||||||
|
Condition article_condition = new Condition(Article.class);
|
||||||
|
Example.Criteria article_criteria = article_condition.createCriteria();
|
||||||
|
article_criteria.andEqualTo("deleteStatus", false);
|
||||||
|
//文章列表
|
||||||
|
PageInfo<Article> pageInfo = this.articleService.findByCondition(new QueryParams(pageNum, pageSize, article_condition, "addTime desc"), true);
|
||||||
|
articleModel.setPrePage(pageInfo.getPrePage());
|
||||||
|
articleModel.setNextPage(pageInfo.getNextPage());
|
||||||
|
articleModel.setPageNum(pageInfo.getPageNum());
|
||||||
|
articleModel.setPageSize(pageInfo.getPageSize());
|
||||||
|
List<ArticleDto> article_dto_list = new ArrayList<>();
|
||||||
|
if (pageInfo.getList().size() > 0) {
|
||||||
|
for (Article article : pageInfo.getList()) {
|
||||||
|
ArticleDto articleDto = new ArticleDto();
|
||||||
|
BeanUtils.copyProperties(article, articleDto);
|
||||||
|
Long user_id = article.getUser_id();
|
||||||
|
User user = this.userFeign.findByUserId(user_id);
|
||||||
|
articleDto.setAvatar(user.getAvatar());
|
||||||
|
article_dto_list.add(articleDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
articleModel.setArticleDto_list(article_dto_list);
|
||||||
|
map.put("articleModel", articleModel);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,14 @@ import com.zhangmeng.model.dto.system.SysConstant;
|
||||||
import com.zhangmeng.model.entity.User;
|
import com.zhangmeng.model.entity.User;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@FeignClient(SysConstant.mystyle_cloud_admin_manager)
|
@FeignClient(SysConstant.mystyle_cloud_admin_manager)
|
||||||
public interface UserFeign {
|
public interface UserFeign {
|
||||||
|
|
||||||
@GetMapping("/user/current")
|
@GetMapping("/user/current")
|
||||||
public User getCurrentUser();
|
public User getCurrentUser();
|
||||||
|
|
||||||
|
@GetMapping("/user/findByUserId")
|
||||||
|
public User findByUserId(@RequestParam("userId") Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ mystyle:
|
||||||
- /webjars/**
|
- /webjars/**
|
||||||
- /actuator/**
|
- /actuator/**
|
||||||
- /instances/**
|
- /instances/**
|
||||||
|
- /article/getListByPage
|
||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
web:
|
web:
|
||||||
|
|
@ -70,4 +71,3 @@ management:
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
name: ./logs/mystyle-cloud-blog.log
|
name: ./logs/mystyle-cloud-blog.log
|
||||||
level: debug
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.zhangmeng.gateway.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 转身的背影在心底里沉沦
|
||||||
|
* @date 2021年9月14日16:50:47
|
||||||
|
* @version 1.0
|
||||||
|
* */
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties("mystyle.security")
|
||||||
|
public class SecurityProperty {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 超级管理员不认证
|
||||||
|
* */
|
||||||
|
private boolean superAuthOpen;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不验证权限用户名
|
||||||
|
* */
|
||||||
|
private String superAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记住密码标识
|
||||||
|
* */
|
||||||
|
private String rememberKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开放接口列表
|
||||||
|
* */
|
||||||
|
private String[] openApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否允许多账号在线
|
||||||
|
* */
|
||||||
|
private Integer maximum = 1;
|
||||||
|
|
||||||
|
public boolean isSuperAuthOpen() {
|
||||||
|
return superAuthOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuperAuthOpen(boolean superAuthOpen) {
|
||||||
|
this.superAuthOpen = superAuthOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSuperAdmin() {
|
||||||
|
return superAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuperAdmin(String superAdmin) {
|
||||||
|
this.superAdmin = superAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRememberKey() {
|
||||||
|
return rememberKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRememberKey(String rememberKey) {
|
||||||
|
this.rememberKey = rememberKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getOpenApi() {
|
||||||
|
return openApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenApi(String[] openApi) {
|
||||||
|
this.openApi = openApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaximum() {
|
||||||
|
return maximum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaximum(Integer maximum) {
|
||||||
|
this.maximum = maximum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,9 +4,5 @@ package com.zhangmeng.gateway.feign;
|
||||||
* 系统常量
|
* 系统常量
|
||||||
*/
|
*/
|
||||||
public class SysConstant {
|
public class SysConstant {
|
||||||
|
|
||||||
public static final String mystyle_cloud_admin_manager = "mystyle-cloud-admin-manager";
|
|
||||||
|
|
||||||
public static final String mystyle_cloud_oauth = "mystyle-cloud-oauth";
|
public static final String mystyle_cloud_oauth = "mystyle-cloud-oauth";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.zhangmeng.gateway.filter;
|
package com.zhangmeng.gateway.filter;
|
||||||
|
|
||||||
|
import com.zhangmeng.gateway.config.SecurityProperty;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
|
|
@ -29,6 +31,9 @@ public class AuthorizeFilter implements GlobalFilter, Ordered {
|
||||||
|
|
||||||
private static final String AUTHORIZE_TOKEN = "Authorization";
|
private static final String AUTHORIZE_TOKEN = "Authorization";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SecurityProperty securityProperty;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||||
|
|
||||||
|
|
@ -36,25 +41,15 @@ public class AuthorizeFilter implements GlobalFilter, Ordered {
|
||||||
ServerHttpRequest request = exchange.getRequest();
|
ServerHttpRequest request = exchange.getRequest();
|
||||||
//2.获取响应对象
|
//2.获取响应对象
|
||||||
ServerHttpResponse response = exchange.getResponse();
|
ServerHttpResponse response = exchange.getResponse();
|
||||||
|
//3.开发端口直接放行
|
||||||
//3.判断 是否为登录的URL 如果是 放行
|
String[] openApi = this.securityProperty.getOpenApi();
|
||||||
if (request.getURI().getPath().startsWith("/mystyle-cloud-oauth/user/login")) {
|
if (openApi.length > 0 ){
|
||||||
|
for (String url : openApi) {
|
||||||
|
if (request.getURI().getPath().startsWith(url)){
|
||||||
return chain.filter(exchange);
|
return chain.filter(exchange);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.getURI().getPath().startsWith("/mystyle-cloud-admin-manager/login")) {
|
|
||||||
return chain.filter(exchange);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.getURI().getPath().startsWith("/mystyle-cloud-admin-manager/system")) {
|
|
||||||
return chain.filter(exchange);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//mystyle-cloud-admin-manager/verificationCode/generate 验证码
|
|
||||||
if (request.getURI().getPath().startsWith("/mystyle-cloud-admin-manager/verificationCode/generate")) {
|
|
||||||
return chain.filter(exchange);
|
|
||||||
}
|
|
||||||
|
|
||||||
//4.判断 是否为登录的URL 如果不是 权限校验
|
//4.判断 是否为登录的URL 如果不是 权限校验
|
||||||
//4.1 从头header中获取令牌数据
|
//4.1 从头header中获取令牌数据
|
||||||
String token = request.getHeaders().getFirst(AUTHORIZE_TOKEN);
|
String token = request.getHeaders().getFirst(AUTHORIZE_TOKEN);
|
||||||
|
|
@ -97,6 +92,7 @@ public class AuthorizeFilter implements GlobalFilter, Ordered {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取请求体中的字符串内容
|
* 获取请求体中的字符串内容
|
||||||
|
*
|
||||||
* @param serverHttpRequest
|
* @param serverHttpRequest
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,12 @@ spring:
|
||||||
- Path=/mystyle-cloud-admin-monitor/**
|
- Path=/mystyle-cloud-admin-monitor/**
|
||||||
filters:
|
filters:
|
||||||
- StripPrefix=1
|
- StripPrefix=1
|
||||||
|
- id: mystyle-cloud-blog-web
|
||||||
|
uri: lb://mystyle-cloud-admin-manager
|
||||||
|
predicates:
|
||||||
|
- Path=/mystyle-cloud-web-blog/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
web:
|
web:
|
||||||
|
|
@ -96,3 +102,13 @@ management:
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
name: ./logs/mystyle-cloud-gateway.log
|
name: ./logs/mystyle-cloud-gateway.log
|
||||||
|
#开放接口
|
||||||
|
mystyle:
|
||||||
|
security:
|
||||||
|
open-api:
|
||||||
|
- /mystyle-cloud-admin-manager/verificationCode/generate
|
||||||
|
- /mystyle-cloud-admin-manager/system
|
||||||
|
- /mystyle-cloud-admin-manager/login
|
||||||
|
- /mystyle-cloud-oauth/user/login
|
||||||
|
- /mystyle-cloud-web-blog/blog/index
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,9 +97,9 @@ public class CommonUtil {
|
||||||
|
|
||||||
private static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
private static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
private static Integer pageNum = 1;
|
public static Integer pageNum = 1;
|
||||||
|
|
||||||
private static Integer pageSize = 10;
|
public static Integer pageSize = 10;
|
||||||
|
|
||||||
private static String[] parsePatterns = {
|
private static String[] parsePatterns = {
|
||||||
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.zhangmeng.model.dto.article;
|
||||||
|
|
||||||
|
import com.zhangmeng.model.entity.Article;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ArticleDto extends Article implements Serializable {
|
||||||
|
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
private String username;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.zhangmeng.model.dto.article;
|
||||||
|
|
||||||
|
import com.zhangmeng.model.dto.comment.CommentModel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ArticleModel implements Serializable {
|
||||||
|
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
|
private List<ArticleDto> articleDto_list;
|
||||||
|
|
||||||
|
private List<ArticleDto> latest_article_list;//最新推荐
|
||||||
|
|
||||||
|
private String blog_title;
|
||||||
|
|
||||||
|
//当前页
|
||||||
|
private int pageNum;
|
||||||
|
|
||||||
|
//每页的数量
|
||||||
|
private int pageSize;
|
||||||
|
|
||||||
|
//前一页
|
||||||
|
private int prePage;
|
||||||
|
|
||||||
|
//下一页
|
||||||
|
private int nextPage;
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private String QQ;
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
private ArticleDto details;
|
||||||
|
|
||||||
|
List<CommentModel> commentModelList;//评论
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.zhangmeng.model.dto.comment;
|
||||||
|
|
||||||
|
import com.zhangmeng.model.entity.Comment;
|
||||||
|
import com.zhangmeng.model.entity.Reply;
|
||||||
|
import com.zhangmeng.model.entity.User;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CommentModel implements Serializable {
|
||||||
|
|
||||||
|
private Comment comment;
|
||||||
|
|
||||||
|
private Reply reply;
|
||||||
|
|
||||||
|
private User reply_user;//回复的博主信息
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue