|
|
@@ -75,6 +75,29 @@ public class CmsInformationController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 文章排序
|
|
|
+ */
|
|
|
+ @PutMapping("/sorted")
|
|
|
+ public Result<String> sortedInformation(@RequestBody Information information) {
|
|
|
+ if (information.getId() == null) {
|
|
|
+ throw BusinessRuntimeException.getInstance("请指定要排序的文章");
|
|
|
+ }
|
|
|
+ Integer sorted = information.getSorted();
|
|
|
+ if (sorted != null && sorted >= 0) {
|
|
|
+ Information byId = informationService.getById(information.getId());
|
|
|
+ if (byId != null && byId.getSorted() != sorted) {
|
|
|
+ byId.setSorted(sorted);
|
|
|
+ informationService.updateById(byId);
|
|
|
+ Set<String> keys = redisService.keys(RedisService.key.INFORMATION_KEY.getName() + "*");
|
|
|
+ redisService.del(keys.toArray(String[]::new));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取文章
|
|
|
*/
|