Compare commits
3 Commits
master-old
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d6950fb11 | ||
| 2a3ae4a376 | |||
| 92e818e370 |
37
.github/workflows/build.yml
vendored
37
.github/workflows/build.yml
vendored
@@ -1,20 +1,16 @@
|
|||||||
|
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
|
||||||
|
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
|
||||||
|
|
||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches:
|
||||||
paths-ignore:
|
- master
|
||||||
- "doc/**"
|
|
||||||
- "**/README.md"
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
paths-ignore:
|
|
||||||
- "doc/**"
|
|
||||||
- "**/README.md"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
if: "!contains(github.event.head_commit.message, '[skip ci]')" # 如果 commit 信息包含以下关键字则跳过该任务
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '.md')" # 如果 commit 信息包含以下关键字则跳过该任务
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
KEY: ${{ secrets.WEB_HOOK_ACCESS_KEY }}
|
KEY: ${{ secrets.WEB_HOOK_ACCESS_KEY }}
|
||||||
@@ -26,13 +22,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
|
|
||||||
- name: Cache local Maven repository
|
- name: Sync repository
|
||||||
uses: actions/cache@v2
|
uses: x-dr/sync-repo-to-gitee@v1.0
|
||||||
|
env:
|
||||||
|
# 在 Settings->Secrets 配置 GITEE_KEY
|
||||||
|
SSH_KEY: ${{ secrets.GITEE_KEY }}
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
# GitHub存储库的SSH URL.
|
||||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
github-repo: git@github.com:xiaohai2271/blog-backEnd.git
|
||||||
restore-keys: |
|
# Gitee存储库的SSH URL.
|
||||||
${{ runner.os }}-maven-
|
gitee-repo: git@gitee.com:xiaohai2271/blog-backEnd.git
|
||||||
|
|
||||||
- name: Unit Test
|
- name: Deploy
|
||||||
run: mvn package -B -pl blog-deploy -am
|
run: mvn -B test --file pom.xml && curl http://bt.celess.cn:2271/hook?access_key=$KEY
|
||||||
|
|||||||
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [master]
|
||||||
|
schedule:
|
||||||
|
- cron: '0 14 * * 2'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
# Override automatic language detection by changing the below list
|
||||||
|
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
|
||||||
|
language: ['java']
|
||||||
|
# Learn more...
|
||||||
|
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
# We must fetch at least the immediate parents so that if this is
|
||||||
|
# a pull request then we can checkout the head.
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
|
# If this run was triggered by a pull request event, then checkout
|
||||||
|
# the head of the pull request instead of the merge commit.
|
||||||
|
- run: git checkout HEAD^2
|
||||||
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
||||||
22
.github/workflows/sync.yml
vendored
22
.github/workflows/sync.yml
vendored
@@ -1,22 +0,0 @@
|
|||||||
name: Sync Repository Action
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
schedule:
|
|
||||||
# 每周一0:00
|
|
||||||
- cron: '0 0 * * 1'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Sync to Gitee
|
|
||||||
uses: x-dr/sync-repo-to-gitee@master
|
|
||||||
env:
|
|
||||||
# 在 Settings->Secrets 配置 GITEE_KEY
|
|
||||||
SSH_KEY: ${{ secrets.GITEE_KEY }}
|
|
||||||
with:
|
|
||||||
# GitHub存储库的SSH URL.
|
|
||||||
github-repo: git@github.com:xiaohai2271/blog-backEnd.git
|
|
||||||
# Gitee存储库的SSH URL.
|
|
||||||
gitee-repo: git@gitee.com:xiaohai2271/blog-backEnd.git
|
|
||||||
29
.github/workflows/test.yml
vendored
Normal file
29
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
|
||||||
|
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
|
||||||
|
|
||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '.md')" # 如果 commit 信息包含以下关键字则跳过该任务
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# APPLICATION_PROPERTIES_TEST: ${{ secrets.APPLICATION_PROPERTIES_TEST }}
|
||||||
|
# APPLICATION_PROPERTIES_PROD: ${{ secrets.APPLICATION_PROPERTIES_PROD }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: mvn -B test --file pom.xml
|
||||||
|
|
||||||
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,5 +4,5 @@
|
|||||||
target/
|
target/
|
||||||
|
|
||||||
# 本地项目的私有文件
|
# 本地项目的私有文件
|
||||||
blog-deploy/src/main/resources/application-dev.properties
|
src/main/resources/application-dev.properties
|
||||||
src/main/resources/application-prod.properties
|
src/main/resources/application-prod.properties
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-article</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
<version>${blog-common.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-user</artifactId>
|
|
||||||
<version>${blog-user.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--MarkDown 2 html -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.youbenzi</groupId>
|
|
||||||
<artifactId>MDTool</artifactId>
|
|
||||||
<version>1.2.4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.minidev</groupId>
|
|
||||||
<artifactId>json-smart</artifactId>
|
|
||||||
<version>2.4.7</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package cn.celess.article;
|
|
||||||
|
|
||||||
import cn.celess.common.CommonApplication;
|
|
||||||
import cn.celess.user.UserApplication;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackageClasses = {ArticleApplication.class, CommonApplication.class, UserApplication.class})
|
|
||||||
public class ArticleApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(ArticleApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _ _ _ _
|
|
||||||
| | | | (_) | _ \ | | /\ | | (_) | |
|
|
||||||
| |__| | _ | |_) | | | ___ __ _ ______ / \ _ __ | |_ _ ___ | | ___
|
|
||||||
| __ | | | | _ < | | / _ \ / _` | |______| / /\ \ | '__| | __| | | / __| | | / _ \
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| | / ____ \ | | | |_ | | | (__ | | | __/
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, | /_/ \_\ |_| \__| |_| \___| |_| \___|
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package cn.celess.article;
|
|
||||||
|
|
||||||
import cn.celess.common.test.BaseRedisTest;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@SpringBootTest(classes = {ArticleApplication.class})
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
public abstract class ArticleBaseTest extends BaseRedisTest {
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-categorytag</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
<version>${blog-common.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-user</artifactId>
|
|
||||||
<version>${blog-user.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package cn.celess.categorytag;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.celess.common.CommonApplication;
|
|
||||||
import cn.celess.user.UserApplication;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackageClasses = {CategoryTagApplication.class, CommonApplication.class, UserApplication.class})
|
|
||||||
public class CategoryTagApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(CategoryTagApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _ _______
|
|
||||||
| | | | (_) | _ \ | | |__ __|
|
|
||||||
| |__| | _ | |_) | | | ___ __ _ ______ | | __ _ __ _
|
|
||||||
| __ | | | | _ < | | / _ \ / _` | |______| | | / _` | / _` |
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| | | | | (_| | | (_| |
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, | |_| \__,_| \__, |
|
|
||||||
__/ | __/ |
|
|
||||||
|___/ |___/
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package cn.celess.categorytag;
|
|
||||||
|
|
||||||
import cn.celess.common.test.BaseTest;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@SpringBootTest(classes = {CategoryTagApplication.class})
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
public abstract class CategoryTagBaseTest extends BaseTest {
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-comment</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
<version>${blog-common.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-user</artifactId>
|
|
||||||
<version>${blog-user.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package cn.celess.comment;
|
|
||||||
|
|
||||||
import cn.celess.common.CommonApplication;
|
|
||||||
import cn.celess.user.UserApplication;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackageClasses = {CommentApplication.class, CommonApplication.class, UserApplication.class})
|
|
||||||
public class CommentApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(CommentApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _ _____ _
|
|
||||||
| | | | (_) | _ \ | | / ____| | |
|
|
||||||
| |__| | _ | |_) | | | ___ __ _ ______ | | ___ _ __ ___ _ __ ___ ___ _ __ | |_
|
|
||||||
| __ | | | | _ < | | / _ \ / _` | |______| | | / _ \ | '_ ` _ \ | '_ ` _ \ / _ \ | '_ \ | __|
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| | | |____ | (_) | | | | | | | | | | | | | | __/ | | | | | |_
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, | \_____| \___/ |_| |_| |_| |_| |_| |_| \___| |_| |_| \__|
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package cn.celess.comment;
|
|
||||||
|
|
||||||
import cn.celess.common.test.BaseTest;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@SpringBootTest(classes = {CommentApplication.class})
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
public abstract class CommentBaseTest extends BaseTest {
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-resource</artifactId>
|
|
||||||
<version>${blog-resource.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.kstyrc</groupId>
|
|
||||||
<artifactId>embedded-redis</artifactId>
|
|
||||||
<version>0.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid</artifactId>
|
|
||||||
<version>1.2.8</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.sun</groupId>
|
|
||||||
<artifactId>jconsole</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.sun</groupId>
|
|
||||||
<artifactId>tools</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- mybatis -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
|
||||||
<version>2.2.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- pageHelper -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.pagehelper</groupId>
|
|
||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
|
||||||
<version>1.4.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!--Email-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-mail</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- TODO: remove this -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.qiniu</groupId>
|
|
||||||
<artifactId>qiniu-java-sdk</artifactId>
|
|
||||||
<version>[7.2.0, 7.2.99]</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- redis -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.sourceforge.htmlunit</groupId>
|
|
||||||
<artifactId>htmlunit</artifactId>
|
|
||||||
<version>2.45.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- protostuff序列化依赖 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.dyuproject.protostuff</groupId>
|
|
||||||
<artifactId>protostuff-core</artifactId>
|
|
||||||
<version>1.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.dyuproject.protostuff</groupId>
|
|
||||||
<artifactId>protostuff-runtime</artifactId>
|
|
||||||
<version>1.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package cn.celess.common;
|
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.FilterType;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
|
|
||||||
|
|
||||||
@SpringBootApplication(
|
|
||||||
scanBasePackageClasses = {
|
|
||||||
CommonApplication.class
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.REGEX, pattern = "cn.celess.common.test.BaseRedisTest")})
|
|
||||||
@MapperScan("cn.celess.common.mapper")
|
|
||||||
public class CommonApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(CommonApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
package cn.celess.common.test;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import redis.embedded.RedisServer;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.PreDestroy;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author : xiaohai
|
|
||||||
* @date : 2020/08/14 16:20
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@Slf4j
|
|
||||||
public class BaseRedisTest extends BaseTest {
|
|
||||||
private static RedisServer redisServer;
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public static void startRedis() {
|
|
||||||
try {
|
|
||||||
if (redisServer == null) {
|
|
||||||
redisServer = new RedisServer(6380);
|
|
||||||
redisServer.start();
|
|
||||||
log.info("start Redis success");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("start Redis failed");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreDestroy()
|
|
||||||
public static void stopRedis() {
|
|
||||||
if (redisServer.isActive()) {
|
|
||||||
redisServer.stop();
|
|
||||||
log.info("stop Redis success");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package cn.celess.common.util;
|
|
||||||
|
|
||||||
import org.springframework.util.DigestUtils;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author : xiaohai
|
|
||||||
* @date : 2019/03/28 17:21
|
|
||||||
*/
|
|
||||||
public class StringUtil {
|
|
||||||
/**
|
|
||||||
* 从html中提取纯文本
|
|
||||||
*
|
|
||||||
* @param html html string
|
|
||||||
* @return 纯文本
|
|
||||||
*/
|
|
||||||
public static String getString(String html) {
|
|
||||||
//剔出<html>的标签
|
|
||||||
String txtcontent = html.replaceAll("</?[^>]+>", "");
|
|
||||||
//去除字符串中的空格,回车,换行符,制表符
|
|
||||||
txtcontent = txtcontent.replaceAll("<a>\\s*|\t|\r|\n</a>", "");
|
|
||||||
return txtcontent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成MD5
|
|
||||||
*
|
|
||||||
* @param str 源数据
|
|
||||||
* @return md5 内容
|
|
||||||
*/
|
|
||||||
public static String getMD5(String str) {
|
|
||||||
return DigestUtils.md5DigestAsHex(str.getBytes());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getCompleteUrlAndMethod(HttpServletRequest request) {
|
|
||||||
// like this : GET:/articles?page=1&count=5
|
|
||||||
return request.getMethod() + ":" + request.getRequestURI() +
|
|
||||||
(request.getQueryString() == null ? "" : "?" + request.getQueryString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
org.springframework.boot.env.EnvironmentPostProcessor=cn.celess.common.config.CommonEnvPostProcessor
|
|
||||||
org.springframework.context.ApplicationListener=cn.celess.common.config.CommonEnvPostProcessor
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _ _____
|
|
||||||
| | | | (_) | _ \ | | / ____|
|
|
||||||
| |__| | _ | |_) | | | ___ __ _ ______ | | ___ _ __ ___ _ __ ___ ___ _ __
|
|
||||||
| __ | | | | _ < | | / _ \ / _` | |______| | | / _ \ | '_ ` _ \ | '_ ` _ \ / _ \ | '_ \
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| | | |____ | (_) | | | | | | | | | | | | | | (_) | | | | |
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, | \_____| \___/ |_| |_| |_| |_| |_| |_| \___/ |_| |_|
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,11 +0,0 @@
|
|||||||
package cn.celess.common;
|
|
||||||
|
|
||||||
import cn.celess.common.test.BaseTest;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@SpringBootTest(classes = CommonApplication.class)
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
public abstract class CommonBaseTest extends BaseTest {
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package cn.celess.common.util;
|
|
||||||
|
|
||||||
import cn.celess.common.CommonBaseTest;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
public class StringUtilTest extends CommonBaseTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getMD5() {
|
|
||||||
assertEquals("25f9e794323b453885f5181f1b624d0b", StringUtil.getMD5("123456789"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-deploy</artifactId>
|
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
<!-- Swagger -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
|
||||||
<version>3.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
|
||||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
|
||||||
<version>1.9.6</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
<version>${blog-common.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-article</artifactId>
|
|
||||||
<version>${blog-article.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-categorytag</artifactId>
|
|
||||||
<version>${blog-categorytag.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-comment</artifactId>
|
|
||||||
<version>${blog-comment.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-extension</artifactId>
|
|
||||||
<version>${blog-extension.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-partnersite</artifactId>
|
|
||||||
<version>${blog-partnersite.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-siteinfo</artifactId>
|
|
||||||
<version>${blog-siteinfo.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-user</artifactId>
|
|
||||||
<version>${blog-user.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-visitor</artifactId>
|
|
||||||
<version>${blog-visitor.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<version>2.5.6</version>
|
|
||||||
<configuration>
|
|
||||||
<mainClass>cn.celess.BlogApplication</mainClass>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>repackage</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package cn.celess;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.FilterType;
|
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableAsync
|
|
||||||
@ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.REGEX, pattern = "cn.celess.common.test.BaseRedisTest")})
|
|
||||||
public class BlogApplication {
|
|
||||||
public static final Logger logger = LoggerFactory.getLogger(BlogApplication.class);
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(BlogApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
logger.info("启动完成!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package cn.celess.configuration;
|
|
||||||
|
|
||||||
import cn.celess.common.util.EnvironmentUtil;
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author : xiaohai
|
|
||||||
* @date : 2019/03/28 14:26
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class DruidConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public DruidDataSource druidDataSource() {
|
|
||||||
DruidDataSource dataSource = new DruidDataSource();
|
|
||||||
dataSource.setDriverClassName(EnvironmentUtil.getProperties("spring.datasource.driver-class-name"));
|
|
||||||
// 数据库基本信息
|
|
||||||
dataSource.setUrl(EnvironmentUtil.getProperties("spring.datasource.url"));
|
|
||||||
dataSource.setUsername(EnvironmentUtil.getProperties("spring.datasource.username"));
|
|
||||||
dataSource.setPassword(EnvironmentUtil.getProperties("spring.datasource.password"));
|
|
||||||
|
|
||||||
// 数据库连接池配置
|
|
||||||
dataSource.setInitialSize(10);
|
|
||||||
dataSource.setMinIdle(10);
|
|
||||||
dataSource.setMaxActive(100);
|
|
||||||
return dataSource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _
|
|
||||||
| | | | (_) | _ \ | |
|
|
||||||
| |__| | _ | |_) | | | ___ __ _
|
|
||||||
| __ | | | | _ < | | / _ \ / _` |
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| |
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, |
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package cn.celess;
|
|
||||||
|
|
||||||
import cn.celess.common.test.BaseTest;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@SpringBootTest(classes = {BlogApplication.class})
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
public abstract class DeployBaseTest extends BaseTest {
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-extension</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
<version>${blog-common.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-user</artifactId>
|
|
||||||
<version>${blog-user.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 七牛云SDK -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.qiniu</groupId>
|
|
||||||
<artifactId>qiniu-java-sdk</artifactId>
|
|
||||||
<version>[7.2.0, 7.2.99]</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--Email-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-mail</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package cn.celess.extension;
|
|
||||||
|
|
||||||
import cn.celess.common.CommonApplication;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackageClasses = {ExtensionApplication.class, CommonApplication.class})
|
|
||||||
public class ExtensionApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(ExtensionApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _ _ _
|
|
||||||
| | | | (_) | _ \ | | | | (_)
|
|
||||||
| |__| | _ | |_) | | | ___ __ _ ______ ___ __ __ | |_ ___ _ __ ___ _ ___ _ __
|
|
||||||
| __ | | | | _ < | | / _ \ / _` | |______| / _ \ \ \/ / | __| / _ \ | '_ \ / __| | | / _ \ | '_ \
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| | | __/ > < | |_ | __/ | | | | \__ \ | | | (_) | | | | |
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, | \___| /_/\_\ \__| \___| |_| |_| |___/ |_| \___/ |_| |_|
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-partnersite</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
<version>${blog-common.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-user</artifactId>
|
|
||||||
<version>${blog-user.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- OkHttp -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
<version>4.9.3</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.jetbrains.kotlin</groupId>-->
|
|
||||||
<!-- <artifactId>kotlin-stdlib</artifactId>-->
|
|
||||||
<!-- <version>1.4.20</version>-->
|
|
||||||
<!-- <scope>compile</scope>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.sourceforge.htmlunit</groupId>
|
|
||||||
<artifactId>htmlunit</artifactId>
|
|
||||||
<version>2.45.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package cn.celess.partnersite;
|
|
||||||
|
|
||||||
import cn.celess.common.CommonApplication;
|
|
||||||
import cn.celess.user.UserApplication;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackageClasses = {PartnerSiteApplication.class, CommonApplication.class, UserApplication.class})
|
|
||||||
public class PartnerSiteApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(PartnerSiteApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _ _ _ _
|
|
||||||
| | | | (_) | _ \ | | | | (_) | |
|
|
||||||
| |__| | _ | |_) | | | ___ __ _ ______ _ __ __ _ _ __ | |_ _ __ ___ _ __ ___ _ | |_ ___
|
|
||||||
| __ | | | | _ < | | / _ \ / _` | |______| | '_ \ / _` | | '__| | __| | '_ \ / _ \ | '__| / __| | | | __| / _ \
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| | | |_) | | (_| | | | | |_ | | | | | __/ | | \__ \ | | | |_ | __/
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, | | .__/ \__,_| |_| \__| |_| |_| \___| |_| |___/ |_| \__| \___|
|
|
||||||
__/ | | |
|
|
||||||
|___/ |_|
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package cn.celess.partnersite;
|
|
||||||
|
|
||||||
import cn.celess.common.test.BaseRedisTest;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@SpringBootTest(classes = PartnerSiteApplication.class)
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
public abstract class PartnerSiteBaseTest extends BaseRedisTest {
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-resource</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>13</maven.compiler.source>
|
|
||||||
<maven.compiler.target>13</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-siteinfo</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
<version>${blog-common.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-user</artifactId>
|
|
||||||
<version>${blog-user.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package cn.celess.siteinfo;
|
|
||||||
|
|
||||||
import cn.celess.common.CommonApplication;
|
|
||||||
import cn.celess.user.UserApplication;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackageClasses = {SiteInfoApplication.class, CommonApplication.class, UserApplication.class})
|
|
||||||
public class SiteInfoApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(SiteInfoApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _ _ _ _ __
|
|
||||||
| | | | (_) | _ \ | | (_) | | (_) / _|
|
|
||||||
| |__| | _ | |_) | | | ___ __ _ ______ ___ _ | |_ ___ _ _ __ | |_ ___
|
|
||||||
| __ | | | | _ < | | / _ \ / _` | |______| / __| | | | __| / _ \ | | | '_ \ | _| / _ \
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| | \__ \ | | | |_ | __/ | | | | | | | | | (_) |
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, | |___/ |_| \__| \___| |_| |_| |_| |_| \___/
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package cn.celess.siteinfo;
|
|
||||||
|
|
||||||
import cn.celess.common.test.BaseTest;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@SpringBootTest(classes = SiteInfoApplication.class)
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
public abstract class SiteInfoBaseTest extends BaseTest {
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-user</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
<version>${blog-common.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- JJwt -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
|
||||||
<artifactId>jjwt</artifactId>
|
|
||||||
<version>0.9.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.xml.bind</groupId>
|
|
||||||
<artifactId>jaxb-api</artifactId>
|
|
||||||
<version>2.3.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.xml.bind</groupId>
|
|
||||||
<artifactId>jaxb-impl</artifactId>
|
|
||||||
<version>3.0.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.xml.bind</groupId>
|
|
||||||
<artifactId>jaxb-core</artifactId>
|
|
||||||
<version>3.0.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.activation</groupId>
|
|
||||||
<artifactId>activation</artifactId>
|
|
||||||
<version>1.1.1</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package cn.celess.user;
|
|
||||||
|
|
||||||
import cn.celess.common.CommonApplication;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackageClasses = {UserApplication.class, CommonApplication.class})
|
|
||||||
public class UserApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(UserApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package cn.celess.user.config;
|
|
||||||
|
|
||||||
import cn.celess.user.filter.AuthenticationFilter;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: 小海
|
|
||||||
* @Date: 2019/10/18 14:19
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class AuthorizationInterceptorConfig implements WebMvcConfigurer {
|
|
||||||
@Override
|
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
|
||||||
registry.addInterceptor(authenticationFilter()).addPathPatterns("/**");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public AuthenticationFilter authenticationFilter() {
|
|
||||||
return new AuthenticationFilter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _ _ _
|
|
||||||
| | | | (_) | _ \ | | | | | |
|
|
||||||
| |__| | _ | |_) | | | ___ __ _ ______ | | | | ___ ___ _ __
|
|
||||||
| __ | | | | _ < | | / _ \ / _` | |______| | | | | / __| / _ \ | '__|
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| | | |__| | \__ \ | __/ | |
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, | \____/ |___/ \___| |_|
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package cn.celess.user;
|
|
||||||
|
|
||||||
import cn.celess.common.test.BaseRedisTest;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest
|
|
||||||
@Component
|
|
||||||
public abstract class UserBaseTest extends BaseRedisTest {
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>blog</artifactId>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>blog-visitor</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-common</artifactId>
|
|
||||||
<version>${blog-common.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-user</artifactId>
|
|
||||||
<version>${blog-user.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.celess</groupId>
|
|
||||||
<artifactId>blog-extension</artifactId>
|
|
||||||
<version>${blog-extension.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Ua解析-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>eu.bitwalker</groupId>
|
|
||||||
<artifactId>UserAgentUtils</artifactId>
|
|
||||||
<version>1.21</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.lionsoul</groupId>
|
|
||||||
<artifactId>ip2region</artifactId>
|
|
||||||
<version>1.7.2</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package cn.celess.visitor;
|
|
||||||
|
|
||||||
import cn.celess.common.CommonApplication;
|
|
||||||
import cn.celess.extension.ExtensionApplication;
|
|
||||||
import cn.celess.user.UserApplication;
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.core.SpringVersion;
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackageClasses = {
|
|
||||||
VisitorApplication.class,
|
|
||||||
CommonApplication.class,
|
|
||||||
ExtensionApplication.class,
|
|
||||||
UserApplication.class
|
|
||||||
})
|
|
||||||
public class VisitorApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
new SpringApplicationBuilder(VisitorApplication.class)
|
|
||||||
.main(SpringVersion.class)
|
|
||||||
.bannerMode(Banner.Mode.CONSOLE)
|
|
||||||
.run(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
${AnsiColor.BRIGHT_GREEN}
|
|
||||||
_ _ _ ____ _ _ _ _
|
|
||||||
| | | | (_) | _ \ | | (_) (_) | |
|
|
||||||
| |__| | _ | |_) | | | ___ __ _ ______ __ __ _ ___ _ | |_ ___ _ __
|
|
||||||
| __ | | | | _ < | | / _ \ / _` | |______| \ \ / / | | / __| | | | __| / _ \ | '__|
|
|
||||||
| | | | | | | |_) | | | | (_) | | (_| | \ V / | | \__ \ | | | |_ | (_) | | |
|
|
||||||
|_| |_| |_| |____/ |_| \___/ \__, | \_/ |_| |___/ |_| \__| \___/ |_|
|
|
||||||
__/ |
|
|
||||||
|___/
|
|
||||||
${AnsiColor.BRIGHT_RED}
|
|
||||||
Application Version: ${application.version}${application.formatted-version}
|
|
||||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package cn.celess.visitor;
|
|
||||||
|
|
||||||
import cn.celess.common.test.BaseRedisTest;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@SpringBootTest(classes = VisitorApplication.class)
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
public abstract class VisitorBaseTest extends BaseRedisTest {
|
|
||||||
}
|
|
||||||
@@ -15,12 +15,12 @@ git clone git@github.com:xiaohai2271/blog-backEnd.git
|
|||||||
|
|
||||||
### 3. maven构建
|
### 3. maven构建
|
||||||
```shell script
|
```shell script
|
||||||
mvn clean package -pl blog-deploy -am
|
mvn package
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. 运行
|
### 4. 运行
|
||||||
```shell script
|
```shell script
|
||||||
java -jar blog-deploy/target/blog-*.jar
|
java -jar target/blog-0.0.1-SNAPSHOT.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5. 其他命令
|
### 5. 其他命令
|
||||||
|
|||||||
228
pom.xml
228
pom.xml
@@ -2,72 +2,230 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>pom</packaging>
|
|
||||||
<modules>
|
|
||||||
<module>blog-common</module>
|
|
||||||
<module>blog-article</module>
|
|
||||||
<module>blog-categorytag</module>
|
|
||||||
<module>blog-user</module>
|
|
||||||
<module>blog-comment</module>
|
|
||||||
<module>blog-partnersite</module>
|
|
||||||
<module>blog-visitor</module>
|
|
||||||
<module>blog-siteinfo</module>
|
|
||||||
<module>blog-extension</module>
|
|
||||||
<module>blog-deploy</module>
|
|
||||||
<module>blog-resource</module>
|
|
||||||
</modules>
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.5.6</version>
|
<version>2.1.3.RELEASE</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>cn.celess</groupId>
|
<groupId>cn.celess</groupId>
|
||||||
<artifactId>blog</artifactId>
|
<artifactId>blog</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>blog</name>
|
<name>blog</name>
|
||||||
<description>personal blog system project for Spring Boot</description>
|
<description>personal blog system project for Spring Boot</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
|
||||||
<blog-common.version>1.0.0</blog-common.version>
|
|
||||||
<blog-article.version>1.0.0</blog-article.version>
|
|
||||||
<blog-categorytag.version>1.0.0</blog-categorytag.version>
|
|
||||||
<blog-user.version>1.0.0</blog-user.version>
|
|
||||||
<blog-comment.version>1.0.0</blog-comment.version>
|
|
||||||
<blog-partnersite.version>1.0.0</blog-partnersite.version>
|
|
||||||
<blog-visitor.version>1.0.0</blog-visitor.version>
|
|
||||||
<blog-siteinfo.version>1.0.0</blog-siteinfo.version>
|
|
||||||
<blog-extension.version>1.0.0</blog-extension.version>
|
|
||||||
<blog-resource.version>1.0.0</blog-resource.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--druid-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid</artifactId>
|
||||||
|
<version>1.2.6</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- lombok -->
|
<!-- lombok -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.22</version>
|
<version>1.18.20</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Swagger -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
<version>2.9.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||||
|
<version>1.9.6</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--MarkDown 2 html -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.youbenzi</groupId>
|
||||||
|
<artifactId>MDTool</artifactId>
|
||||||
|
<version>1.2.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.minidev</groupId>
|
||||||
|
<artifactId>json-smart</artifactId>
|
||||||
|
<version>2.4.7</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 七牛云SDK -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.qiniu</groupId>
|
||||||
|
<artifactId>qiniu-java-sdk</artifactId>
|
||||||
|
<version>[7.2.0, 7.2.99]</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--Email-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- redis -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- mybatis -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- pageHelper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- protostuff序列化依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.dyuproject.protostuff</groupId>
|
||||||
|
<artifactId>protostuff-core</artifactId>
|
||||||
|
<version>1.1.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.dyuproject.protostuff</groupId>
|
||||||
|
<artifactId>protostuff-runtime</artifactId>
|
||||||
|
<version>1.1.6</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Ua解析-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>eu.bitwalker</groupId>
|
||||||
|
<artifactId>UserAgentUtils</artifactId>
|
||||||
|
<version>1.21</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.13.2</version>
|
<version>4.13.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JJwt -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
<version>0.9.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- OkHttp -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.9.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.vintage</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>junit-vintage-engine</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>5.8.2</version>
|
<version>1.4.20</version>
|
||||||
<scope>test</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sourceforge.htmlunit</groupId>
|
||||||
|
<artifactId>htmlunit</artifactId>
|
||||||
|
<version>2.45.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<version>2.0.206</version>
|
<version>1.4.200</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.kstyrc</groupId>
|
||||||
|
<artifactId>embedded-redis</artifactId>
|
||||||
|
<version>0.6</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-impl</artifactId>
|
||||||
|
<version>4.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-core</artifactId>
|
||||||
|
<version>2.3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>activation</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lionsoul</groupId>
|
||||||
|
<artifactId>ip2region</artifactId>
|
||||||
|
<version>1.7.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-maven-plugin</artifactId>
|
||||||
|
<version>1.5.10</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>compile</id>
|
||||||
|
<phase>process-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
20
src/main/java/cn/celess/blog/BlogApplication.java
Normal file
20
src/main/java/cn/celess/blog/BlogApplication.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package cn.celess.blog;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableAsync
|
||||||
|
@MapperScan("cn.celess.blog.mapper")
|
||||||
|
public class BlogApplication {
|
||||||
|
public static final Logger logger = LoggerFactory.getLogger(BlogApplication.class);
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(BlogApplication.class, args);
|
||||||
|
logger.info("启动完成!");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.celess.common.config;
|
package cn.celess.blog.configuration;
|
||||||
|
|
||||||
import cn.celess.common.util.EnvironmentUtil;
|
import cn.celess.blog.util.EnvironmentUtil;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.env.EnvironmentPostProcessor;
|
import org.springframework.boot.env.EnvironmentPostProcessor;
|
||||||
import org.springframework.boot.logging.DeferredLog;
|
import org.springframework.boot.logging.DeferredLog;
|
||||||
@@ -12,11 +13,20 @@ import org.springframework.core.env.PropertiesPropertySource;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>date: 2022/12/02</P>
|
||||||
|
* <p>desc: </p>
|
||||||
|
* <p>mail: a@celess.cn</p>
|
||||||
|
*
|
||||||
|
* @author 禾几海
|
||||||
|
*/
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CommonEnvPostProcessor implements EnvironmentPostProcessor, ApplicationListener<ApplicationEvent>, Ordered {
|
public class CommonEnvPostProcessor implements EnvironmentPostProcessor, ApplicationListener<ApplicationEvent>, Ordered {
|
||||||
public static final DeferredLog log = new DeferredLog();
|
public static final DeferredLog log = new DeferredLog();
|
||||||
@@ -33,7 +43,7 @@ public class CommonEnvPostProcessor implements EnvironmentPostProcessor, Applica
|
|||||||
//获取环境变量
|
//获取环境变量
|
||||||
String homeEnv = EnvironmentUtil.getEnv("BLOG_HOME", EnvironmentUtil.getEnv("USERPROFILE"));
|
String homeEnv = EnvironmentUtil.getEnv("BLOG_HOME", EnvironmentUtil.getEnv("USERPROFILE"));
|
||||||
String configPath = (homeEnv + CONFIG_PATH).replaceAll("[\\|/]+", Matcher.quoteReplacement(File.separator));
|
String configPath = (homeEnv + CONFIG_PATH).replaceAll("[\\|/]+", Matcher.quoteReplacement(File.separator));
|
||||||
try (InputStream input = new FileInputStream(configPath)) {
|
try (InputStream input = Files.newInputStream(Paths.get(configPath))) {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.load(input);
|
properties.load(input);
|
||||||
PropertiesPropertySource propertySource = new PropertiesPropertySource(SOURCE_NAME, properties);
|
PropertiesPropertySource propertySource = new PropertiesPropertySource(SOURCE_NAME, properties);
|
||||||
@@ -45,7 +55,7 @@ public class CommonEnvPostProcessor implements EnvironmentPostProcessor, Applica
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ApplicationEvent event) {
|
public void onApplicationEvent(@NotNull ApplicationEvent event) {
|
||||||
log.replayTo(CommonEnvPostProcessor.class);
|
log.replayTo(CommonEnvPostProcessor.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,43 +1,45 @@
|
|||||||
package cn.celess.configuration;
|
package cn.celess.blog.configuration;
|
||||||
|
|
||||||
import cn.celess.common.util.EnvironmentUtil;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.cors.CorsConfiguration;
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
import org.springframework.web.filter.CorsFilter;
|
import org.springframework.web.filter.CorsFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/30 19:55
|
* @date : 2019/03/30 19:55
|
||||||
* 跨域
|
* 跨域
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class CorsConfig {
|
public class CorsConfig {
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
@Bean
|
private String activeModel;
|
||||||
public CorsFilter corsFilter() {
|
|
||||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
@Bean
|
||||||
CorsConfiguration config = new CorsConfiguration();
|
public CorsFilter corsFilter() {
|
||||||
config.addAllowedOrigin("http://celess.cn");
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
config.addAllowedOrigin("http://www.celess.cn");
|
CorsConfiguration config = new CorsConfiguration();
|
||||||
config.addAllowedOrigin("https://celess.cn");
|
config.addAllowedOrigin("http://celess.cn");
|
||||||
config.addAllowedOrigin("https://www.celess.cn");
|
config.addAllowedOrigin("http://www.celess.cn");
|
||||||
// 本地调试时的跨域
|
config.addAllowedOrigin("https://celess.cn");
|
||||||
if (!"prod".equals(EnvironmentUtil.getProperties("spring.profiles.active", "dev"))) {
|
config.addAllowedOrigin("https://www.celess.cn");
|
||||||
config.addAllowedOrigin("http://localhost:4200");
|
// 本地调试时的跨域
|
||||||
config.addAllowedOrigin("http://127.0.0.1:4200");
|
if (!"prod".equals(activeModel)) {
|
||||||
}
|
config.addAllowedOrigin("http://localhost:4200");
|
||||||
config.addAllowedHeader("*");
|
config.addAllowedOrigin("http://127.0.0.1:4200");
|
||||||
config.addAllowedMethod("OPTIONS");
|
}
|
||||||
config.addAllowedMethod("GET");
|
config.addAllowedHeader("*");
|
||||||
config.addAllowedMethod("POST");
|
config.addAllowedMethod("OPTIONS");
|
||||||
config.addAllowedMethod("PUT");
|
config.addAllowedMethod("GET");
|
||||||
config.addAllowedMethod("DELETE");
|
config.addAllowedMethod("POST");
|
||||||
config.addExposedHeader("Authorization");
|
config.addAllowedMethod("PUT");
|
||||||
config.setAllowCredentials(true);
|
config.addAllowedMethod("DELETE");
|
||||||
config.setMaxAge(10800L);
|
config.addExposedHeader("Authorization");
|
||||||
source.registerCorsConfiguration("/**", config);
|
config.setAllowCredentials(true);
|
||||||
return new CorsFilter(source);
|
config.setMaxAge(10800L);
|
||||||
}
|
source.registerCorsConfiguration("/**", config);
|
||||||
}
|
return new CorsFilter(source);
|
||||||
|
}
|
||||||
|
}
|
||||||
41
src/main/java/cn/celess/blog/configuration/DruidConfig.java
Normal file
41
src/main/java/cn/celess/blog/configuration/DruidConfig.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package cn.celess.blog.configuration;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : xiaohai
|
||||||
|
* @date : 2019/03/28 14:26
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class DruidConfig {
|
||||||
|
@Value("${spring.datasource.url}")
|
||||||
|
private String dbUrl;
|
||||||
|
|
||||||
|
@Value("${spring.datasource.username}")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Value("${spring.datasource.password}")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Value("${spring.datasource.driver-class-name}")
|
||||||
|
private String driverClassName;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DruidDataSource druidDataSource() {
|
||||||
|
DruidDataSource dataSource = new DruidDataSource();
|
||||||
|
dataSource.setDriverClassName(driverClassName);
|
||||||
|
// 数据库基本信息
|
||||||
|
dataSource.setUrl(dbUrl);
|
||||||
|
dataSource.setUsername(username);
|
||||||
|
dataSource.setPassword(password);
|
||||||
|
|
||||||
|
// 数据库连接池配置
|
||||||
|
dataSource.setInitialSize(10);
|
||||||
|
dataSource.setMinIdle(10);
|
||||||
|
dataSource.setMaxActive(100);
|
||||||
|
return dataSource;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +1,39 @@
|
|||||||
package cn.celess.configuration;
|
package cn.celess.blog.configuration;
|
||||||
|
|
||||||
import cn.celess.configuration.filter.MultipleSubmitFilter;
|
import cn.celess.blog.configuration.filter.AuthenticationFilter;
|
||||||
import cn.celess.configuration.filter.VisitorRecord;
|
import cn.celess.blog.configuration.filter.MultipleSubmitFilter;
|
||||||
import cn.celess.configuration.listener.SessionListener;
|
import cn.celess.blog.configuration.filter.VisitorRecord;
|
||||||
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
|
import cn.celess.blog.configuration.listener.SessionListener;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
/**
|
|
||||||
* @Author: 小海
|
/**
|
||||||
* @Date: 2019/10/18 14:19
|
* @Author: 小海
|
||||||
* @Description:
|
* @Date: 2019/10/18 14:19
|
||||||
*/
|
* @Description:
|
||||||
@Configuration
|
*/
|
||||||
public class DeployInterceptorConfig implements WebMvcConfigurer {
|
@Configuration
|
||||||
|
public class InterceptorConfig implements WebMvcConfigurer {
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
registry.addInterceptor(new MultipleSubmitFilter()).addPathPatterns("/**");
|
registry.addInterceptor(new MultipleSubmitFilter()).addPathPatterns("/**");
|
||||||
registry.addInterceptor(new VisitorRecord()).addPathPatterns("/**");
|
registry.addInterceptor(new VisitorRecord()).addPathPatterns("/**");
|
||||||
}
|
registry.addInterceptor(authenticationFilter()).addPathPatterns("/**");
|
||||||
|
}
|
||||||
@Bean
|
|
||||||
public ServletListenerRegistrationBean<SessionListener> servletListenerRegistrationBean() {
|
@Bean
|
||||||
// session listener register bean
|
public AuthenticationFilter authenticationFilter() {
|
||||||
ServletListenerRegistrationBean<SessionListener> slrBean = new ServletListenerRegistrationBean<SessionListener>();
|
return new AuthenticationFilter();
|
||||||
slrBean.setListener(new SessionListener());
|
}
|
||||||
return slrBean;
|
|
||||||
}
|
@Bean
|
||||||
}
|
public ServletListenerRegistrationBean<SessionListener> servletListenerRegistrationBean() {
|
||||||
|
// session listener register bean
|
||||||
|
ServletListenerRegistrationBean<SessionListener> slrBean = new ServletListenerRegistrationBean<SessionListener>();
|
||||||
|
slrBean.setListener(new SessionListener());
|
||||||
|
return slrBean;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,67 +1,69 @@
|
|||||||
package cn.celess.configuration;
|
package cn.celess.blog.configuration;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.cache.interceptor.KeyGenerator;
|
import org.springframework.cache.interceptor.KeyGenerator;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
/**
|
|
||||||
* @author : xiaohai
|
|
||||||
* @date : 2019/05/22 17:35
|
/**
|
||||||
*/
|
* @author : xiaohai
|
||||||
@Configuration
|
* @date : 2019/05/22 17:35
|
||||||
@EnableCaching
|
*/
|
||||||
public class RedisConfig extends CachingConfigurerSupport {
|
@Configuration
|
||||||
|
@EnableCaching
|
||||||
/**
|
public class RedisConfig extends CachingConfigurerSupport {
|
||||||
* 缓存的命名前缀
|
|
||||||
*
|
/**
|
||||||
* @return KeyGenerator
|
* 缓存的命名前缀
|
||||||
*/
|
*
|
||||||
@Override
|
* @return KeyGenerator
|
||||||
@Bean
|
*/
|
||||||
public KeyGenerator keyGenerator() {
|
@Override
|
||||||
return (target, method, params) -> {
|
@Bean
|
||||||
StringBuilder sb = new StringBuilder();
|
public KeyGenerator keyGenerator() {
|
||||||
String name = target.getClass().getName();
|
return (target, method, params) -> {
|
||||||
sb.append(name.substring(name.lastIndexOf(".") + 1));
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(":");
|
String name = target.getClass().getName();
|
||||||
sb.append(method.getName());
|
sb.append(name.substring(name.lastIndexOf(".") + 1));
|
||||||
for (Object obj : params) {
|
sb.append(":");
|
||||||
sb.append("-").append(obj.toString());
|
sb.append(method.getName());
|
||||||
}
|
for (Object obj : params) {
|
||||||
return sb.toString();
|
sb.append("-").append(obj.toString());
|
||||||
};
|
}
|
||||||
}
|
return sb.toString();
|
||||||
|
};
|
||||||
/**
|
}
|
||||||
* 配置redisTemplate
|
|
||||||
*
|
/**
|
||||||
* @param redisConnectionFactory redisConnectionFactory
|
* 配置redisTemplate
|
||||||
* @return redisTemplate
|
*
|
||||||
*/
|
* @param redisConnectionFactory redisConnectionFactory
|
||||||
@Bean
|
* @return redisTemplate
|
||||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
*/
|
||||||
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
|
@Bean
|
||||||
ObjectMapper om = new ObjectMapper();
|
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
|
||||||
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
ObjectMapper om = new ObjectMapper();
|
||||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||||
RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
|
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
||||||
template.setConnectionFactory(redisConnectionFactory);
|
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||||
template.setKeySerializer(jackson2JsonRedisSerializer);
|
RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
|
||||||
template.setValueSerializer(jackson2JsonRedisSerializer);
|
template.setConnectionFactory(redisConnectionFactory);
|
||||||
template.setHashKeySerializer(jackson2JsonRedisSerializer);
|
template.setKeySerializer(jackson2JsonRedisSerializer);
|
||||||
template.setHashValueSerializer(jackson2JsonRedisSerializer);
|
template.setValueSerializer(jackson2JsonRedisSerializer);
|
||||||
template.afterPropertiesSet();
|
template.setHashKeySerializer(jackson2JsonRedisSerializer);
|
||||||
return template;
|
template.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||||
}
|
template.afterPropertiesSet();
|
||||||
|
return template;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,43 +1,46 @@
|
|||||||
package cn.celess.configuration;
|
package cn.celess.blog.configuration;
|
||||||
|
|
||||||
import cn.celess.common.util.EnvironmentUtil;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
import springfox.documentation.service.ApiInfo;
|
import springfox.documentation.service.ApiInfo;
|
||||||
import springfox.documentation.service.Contact;
|
import springfox.documentation.service.Contact;
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/28 15:55
|
* @date : 2019/03/28 15:55
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableSwagger2
|
@EnableSwagger2
|
||||||
public class SwaggerConfig {
|
public class SwaggerConfig {
|
||||||
|
|
||||||
@Bean
|
@Value("${spring.profiles.active}")
|
||||||
public Docket createRestApi() {
|
private String environment;
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
|
||||||
.enable(!"prod".equals(EnvironmentUtil.getProperties("spring.profiles.active", "dev")))
|
@Bean
|
||||||
.apiInfo(apiInfo())
|
public Docket createRestApi() {
|
||||||
.select()
|
return new Docket(DocumentationType.SWAGGER_2)
|
||||||
.apis(RequestHandlerSelectors.basePackage("cn.celess"))
|
.enable(!"prod".equals(environment))
|
||||||
.paths(PathSelectors.any())
|
.apiInfo(apiInfo())
|
||||||
.build();
|
.select()
|
||||||
}
|
.apis(RequestHandlerSelectors.basePackage("cn.celess.blog"))
|
||||||
|
.paths(PathSelectors.any())
|
||||||
private ApiInfo apiInfo() {
|
.build();
|
||||||
return new ApiInfoBuilder()
|
}
|
||||||
.title("小海博客的APi")
|
|
||||||
.description("小海博客的APi")
|
private ApiInfo apiInfo() {
|
||||||
.contact(new Contact("小海", "https://www.celess.cn", "a@celess.cn"))
|
return new ApiInfoBuilder()
|
||||||
.version("1.0")
|
.title("小海博客的APi")
|
||||||
.build();
|
.description("小海博客的APi")
|
||||||
}
|
.contact(new Contact("小海", "https://www.celess.cn", "a@celess.cn"))
|
||||||
|
.version("1.0")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,92 +1,93 @@
|
|||||||
package cn.celess.user.filter;
|
package cn.celess.blog.configuration.filter;
|
||||||
|
|
||||||
|
import cn.celess.blog.enmu.ResponseEnum;
|
||||||
import cn.celess.common.constant.ResponseEnum;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.service.UserService;
|
||||||
import cn.celess.common.service.UserService;
|
import cn.celess.blog.util.JwtUtil;
|
||||||
import cn.celess.common.util.RedisUtil;
|
import cn.celess.blog.util.RedisUtil;
|
||||||
import cn.celess.user.util.JwtUtil;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import java.io.IOException;
|
||||||
import java.io.IOException;
|
|
||||||
|
/**
|
||||||
/**
|
* @Author: 小海
|
||||||
* @Author: 小海
|
* @Date: 2019/11/16 11:21
|
||||||
* @Date: 2019/11/16 11:21
|
* @Description: 鉴权拦截器
|
||||||
* @Description: 鉴权拦截器
|
*/
|
||||||
*/
|
public class AuthenticationFilter implements HandlerInterceptor {
|
||||||
public class AuthenticationFilter implements HandlerInterceptor {
|
private static final Logger logger = LoggerFactory.getLogger(AuthenticationFilter.class);
|
||||||
private static final Logger logger = LoggerFactory.getLogger(AuthenticationFilter.class);
|
private static final String USER_PREFIX = "/user";
|
||||||
private static final String USER_PREFIX = "/user";
|
private static final String ADMIN_PREFIX = "/admin";
|
||||||
private static final String ADMIN_PREFIX = "/admin";
|
private static final String ROLE_ADMIN = "admin";
|
||||||
private static final String ROLE_ADMIN = "admin";
|
private static final String ROLE_USER = "user";
|
||||||
private static final String ROLE_USER = "user";
|
@Autowired
|
||||||
@Autowired
|
JwtUtil jwtUtil;
|
||||||
RedisUtil redisUtil;
|
@Autowired
|
||||||
@Autowired
|
RedisUtil redisUtil;
|
||||||
UserService userService;
|
@Autowired
|
||||||
|
UserService userService;
|
||||||
@Override
|
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
@Override
|
||||||
String path = request.getRequestURI();
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
path = path.replaceAll("/+", "/");
|
String path = request.getRequestURI();
|
||||||
int indexOf = path.indexOf("/", 1);
|
path = path.replaceAll("/+", "/");
|
||||||
String rootPath = indexOf == -1 ? path : path.substring(0, indexOf);
|
int indexOf = path.indexOf("/", 1);
|
||||||
String jwtStr = request.getHeader("Authorization");
|
String rootPath = indexOf == -1 ? path : path.substring(0, indexOf);
|
||||||
if (jwtStr != null && !jwtStr.isEmpty() && !JwtUtil.isTokenExpired(jwtStr)) {
|
String jwtStr = request.getHeader("Authorization");
|
||||||
// 已登录 记录当前email
|
if (jwtStr != null && !jwtStr.isEmpty() && !jwtUtil.isTokenExpired(jwtStr)) {
|
||||||
request.getSession().setAttribute("email", JwtUtil.getUsernameFromToken(jwtStr));
|
// 已登录 记录当前email
|
||||||
}
|
request.getSession().setAttribute("email", jwtUtil.getUsernameFromToken(jwtStr));
|
||||||
// 不需要鉴权的路径
|
}
|
||||||
if (!USER_PREFIX.equalsIgnoreCase(rootPath) && !ADMIN_PREFIX.equalsIgnoreCase(rootPath)) {
|
// 不需要鉴权的路径
|
||||||
return true;
|
if (!USER_PREFIX.equals(rootPath.toLowerCase()) && !ADMIN_PREFIX.equals(rootPath.toLowerCase())) {
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
if (jwtStr == null || jwtStr.isEmpty()) {
|
|
||||||
return writeResponse(ResponseEnum.HAVE_NOT_LOG_IN, response, request);
|
if (jwtStr == null || jwtStr.isEmpty()) {
|
||||||
}
|
return writeResponse(ResponseEnum.HAVE_NOT_LOG_IN, response, request);
|
||||||
if (JwtUtil.isTokenExpired(jwtStr)) {
|
}
|
||||||
return writeResponse(ResponseEnum.LOGIN_EXPIRED, response, request);
|
if (jwtUtil.isTokenExpired(jwtStr)) {
|
||||||
}
|
return writeResponse(ResponseEnum.LOGIN_EXPIRED, response, request);
|
||||||
String email = JwtUtil.getUsernameFromToken(jwtStr);
|
}
|
||||||
if (JwtUtil.isTokenExpired(jwtStr)) {
|
String email = jwtUtil.getUsernameFromToken(jwtStr);
|
||||||
// 登陆过期
|
if (jwtUtil.isTokenExpired(jwtStr)) {
|
||||||
return writeResponse(ResponseEnum.LOGIN_EXPIRED, response, request);
|
// 登陆过期
|
||||||
}
|
return writeResponse(ResponseEnum.LOGIN_EXPIRED, response, request);
|
||||||
if (!redisUtil.hasKey(email + "-login")) {
|
}
|
||||||
return writeResponse(ResponseEnum.LOGOUT, response, request);
|
if (!redisUtil.hasKey(email + "-login")) {
|
||||||
}
|
return writeResponse(ResponseEnum.LOGOUT, response, request);
|
||||||
String role = userService.getUserRoleByEmail(email);
|
}
|
||||||
if (role.equals(ROLE_USER) || role.equals(ROLE_ADMIN)) {
|
String role = userService.getUserRoleByEmail(email);
|
||||||
// 更新token
|
if (role.equals(ROLE_USER) || role.equals(ROLE_ADMIN)) {
|
||||||
String token = JwtUtil.updateTokenDate(jwtStr);
|
// 更新token
|
||||||
response.setHeader("Authorization", token);
|
String token = jwtUtil.updateTokenDate(jwtStr);
|
||||||
}
|
response.setHeader("Authorization", token);
|
||||||
if (role.equals(ROLE_ADMIN)) {
|
}
|
||||||
// admin
|
if (role.equals(ROLE_ADMIN)) {
|
||||||
return true;
|
// admin
|
||||||
}
|
return true;
|
||||||
if (role.equals(ROLE_USER) && !rootPath.equals(ADMIN_PREFIX)) {
|
}
|
||||||
// user not admin page
|
if (role.equals(ROLE_USER) && !rootPath.equals(ADMIN_PREFIX)) {
|
||||||
return true;
|
// user not admin page
|
||||||
}
|
return true;
|
||||||
return writeResponse(ResponseEnum.PERMISSION_ERROR, response, request);
|
}
|
||||||
}
|
return writeResponse(ResponseEnum.PERMISSION_ERROR, response, request);
|
||||||
|
}
|
||||||
private boolean writeResponse(ResponseEnum e, HttpServletResponse response, HttpServletRequest request) {
|
|
||||||
response.setHeader("Content-Type", "application/json;charset=UTF-8");
|
private boolean writeResponse(ResponseEnum e, HttpServletResponse response, HttpServletRequest request) {
|
||||||
try {
|
response.setHeader("Content-Type", "application/json;charset=UTF-8");
|
||||||
logger.info("鉴权失败,[code:{},msg:{},path:{}]", e.getCode(), e.getMsg(), request.getRequestURI() + "?" + request.getQueryString());
|
try {
|
||||||
response.getWriter().println(new ObjectMapper().writeValueAsString(Response.response(e, null)));
|
logger.info("鉴权失败,[code:{},msg:{},path:{}]", e.getCode(), e.getMsg(), request.getRequestURI() + "?" + request.getQueryString());
|
||||||
} catch (IOException ex) {
|
response.getWriter().println(new ObjectMapper().writeValueAsString(Response.response(e, null)));
|
||||||
ex.printStackTrace();
|
} catch (IOException ex) {
|
||||||
}
|
ex.printStackTrace();
|
||||||
return false;
|
}
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,44 +1,44 @@
|
|||||||
package cn.celess.configuration.filter;
|
package cn.celess.blog.configuration.filter;
|
||||||
|
|
||||||
import cn.celess.common.constant.ResponseEnum;
|
import cn.celess.blog.enmu.ResponseEnum;
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.util.StringUtil;
|
import cn.celess.blog.util.RequestUtil;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 小海
|
* @Author: 小海
|
||||||
* @Date: 2019/10/18 13:46
|
* @Date: 2019/10/18 13:46
|
||||||
* @Description: 多次请求拦截器
|
* @Description: 多次请求拦截器
|
||||||
*/
|
*/
|
||||||
public class MultipleSubmitFilter implements HandlerInterceptor {
|
public class MultipleSubmitFilter implements HandlerInterceptor {
|
||||||
private static final int WAIT_TIME = 200;// 多次提交中间的间隔
|
private static final int WAIT_TIME = 200;// 多次提交中间的间隔
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
Long lastSubmitTime = (Long) request.getSession().getAttribute("lastSubmitTime");
|
Long lastSubmitTime = (Long) request.getSession().getAttribute("lastSubmitTime");
|
||||||
String completeUrl = (String) request.getSession().getAttribute("completeUrl&method");
|
String completeUrl = (String) request.getSession().getAttribute("completeUrl&method");
|
||||||
if (lastSubmitTime == null || completeUrl == null) {
|
if (lastSubmitTime == null || completeUrl == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (System.currentTimeMillis() - lastSubmitTime < WAIT_TIME && StringUtil.getCompleteUrlAndMethod(request).equals(completeUrl)) {
|
if (System.currentTimeMillis() - lastSubmitTime < WAIT_TIME && RequestUtil.getCompleteUrlAndMethod(request).equals(completeUrl)) {
|
||||||
// 请求参数和路径均相同 且请求时间间隔小于 WAIT_TIME
|
// 请求参数和路径均相同 且请求时间间隔小于 WAIT_TIME
|
||||||
response.setContentType("application/json");
|
response.setContentType("application/json");
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
Response result = new Response(ResponseEnum.FAILURE.getCode(), "重复请求", null);
|
Response result = new Response(ResponseEnum.FAILURE.getCode(), "重复请求", null);
|
||||||
response.getWriter().println(result);
|
response.getWriter().println(result.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
session.setAttribute("lastSubmitTime", System.currentTimeMillis());
|
session.setAttribute("lastSubmitTime", System.currentTimeMillis());
|
||||||
session.setAttribute("completeUrl&method", StringUtil.getCompleteUrlAndMethod(request));
|
session.setAttribute("completeUrl&method", RequestUtil.getCompleteUrlAndMethod(request));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,38 +1,38 @@
|
|||||||
package cn.celess.configuration.filter;
|
package cn.celess.blog.configuration.filter;
|
||||||
|
|
||||||
import cn.celess.common.util.StringUtil;
|
import cn.celess.blog.util.RequestUtil;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 小海
|
* @Author: 小海
|
||||||
* @Date: 2019/10/18 15:38
|
* @Date: 2019/10/18 15:38
|
||||||
* @Description: 记录访问情况
|
* @Description: 记录访问情况
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class VisitorRecord implements HandlerInterceptor {
|
public class VisitorRecord implements HandlerInterceptor {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
|
|
||||||
HashMap<String, Integer> visitDetail = (HashMap<String, Integer>) session.getAttribute("visitDetail");
|
HashMap<String, Integer> visitDetail = (HashMap<String, Integer>) session.getAttribute("visitDetail");
|
||||||
if (visitDetail == null) {
|
if (visitDetail == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 获取访问次数
|
// 获取访问次数
|
||||||
Integer count = visitDetail.get(StringUtil.getCompleteUrlAndMethod(request));
|
Integer count = visitDetail.get(RequestUtil.getCompleteUrlAndMethod(request));
|
||||||
// 自增
|
// 自增
|
||||||
count = count == null ? 1 : ++count;
|
count = count == null ? 1 : ++count;
|
||||||
// 更新
|
// 更新
|
||||||
visitDetail.put(StringUtil.getCompleteUrlAndMethod(request), count);
|
visitDetail.put(RequestUtil.getCompleteUrlAndMethod(request), count);
|
||||||
session.setAttribute("ip", request.getRemoteAddr());
|
session.setAttribute("ip", request.getRemoteAddr());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,49 +1,49 @@
|
|||||||
package cn.celess.configuration.listener;
|
package cn.celess.blog.configuration.listener;
|
||||||
|
|
||||||
import cn.celess.user.util.RedisUserUtil;
|
import cn.celess.blog.util.RedisUserUtil;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import javax.servlet.annotation.WebListener;
|
import javax.servlet.annotation.WebListener;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSessionEvent;
|
import javax.servlet.http.HttpSessionEvent;
|
||||||
import javax.servlet.http.HttpSessionListener;
|
import javax.servlet.http.HttpSessionListener;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 小海
|
* @Author: 小海
|
||||||
* @Date: 2019/10/18 15:33
|
* @Date: 2019/10/18 15:33
|
||||||
* @Description: 监听session的情况
|
* @Description: 监听session的情况
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@WebListener
|
@WebListener
|
||||||
public class SessionListener implements HttpSessionListener {
|
public class SessionListener implements HttpSessionListener {
|
||||||
@Autowired
|
@Autowired
|
||||||
RedisUserUtil redisUserUtil;
|
RedisUserUtil redisUserUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
HttpServletRequest request;
|
HttpServletRequest request;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sessionCreated(HttpSessionEvent se) {
|
public void sessionCreated(HttpSessionEvent se) {
|
||||||
se.getSession().setAttribute("visitDetail", new HashMap<String, Integer>());
|
se.getSession().setAttribute("visitDetail", new HashMap<String, Integer>());
|
||||||
// 10s for debug
|
// 10s for debug
|
||||||
// se.getSession().setMaxInactiveInterval(10);
|
// se.getSession().setMaxInactiveInterval(10);
|
||||||
// log.info("新增一个Session[{}]", se.getSession().getId());
|
// log.info("新增一个Session[{}]", se.getSession().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void sessionDestroyed(HttpSessionEvent se) {
|
public void sessionDestroyed(HttpSessionEvent se) {
|
||||||
HashMap<String, Integer> visitDetail = (HashMap<String, Integer>) se.getSession().getAttribute("visitDetail");
|
HashMap<String, Integer> visitDetail = (HashMap<String, Integer>) se.getSession().getAttribute("visitDetail");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("ip => ").append(se.getSession().getAttribute("ip"));
|
sb.append("ip => ").append(se.getSession().getAttribute("ip"));
|
||||||
if (visitDetail.size() == 0) {
|
if (visitDetail.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sb.append("\t登录情况 => ");
|
sb.append("\t登录情况 => ");
|
||||||
String email = (String) se.getSession().getAttribute("email");
|
String email = (String) se.getSession().getAttribute("email");
|
||||||
sb.append(email == null ? "游客访问" : email);
|
sb.append(email == null ? "游客访问" : email);
|
||||||
visitDetail.forEach((s, integer) -> sb.append("\n").append("Method:[").append(s.split(":")[1]).append("]\tTimes:[").append(integer).append("]\tPath:[").append(s.split(":")[0]).append("]"));
|
visitDetail.forEach((s, integer) -> sb.append("\n").append("Method:[").append(s.split(":")[1]).append("]\tTimes:[").append(integer).append("]\tPath:[").append(s.split(":")[0]).append("]"));
|
||||||
log.info(sb.toString());
|
log.info(sb.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,161 +1,163 @@
|
|||||||
package cn.celess.article.controller;
|
package cn.celess.blog.controller;
|
||||||
|
|
||||||
import cn.celess.article.util.SitemapGenerateUtil;
|
import cn.celess.blog.enmu.ResponseEnum;
|
||||||
import cn.celess.common.constant.ResponseEnum;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.model.ArticleModel;
|
||||||
import cn.celess.common.entity.dto.ArticleReq;
|
import cn.celess.blog.entity.request.ArticleReq;
|
||||||
import cn.celess.common.entity.vo.ArticleModel;
|
import cn.celess.blog.service.ArticleService;
|
||||||
import cn.celess.common.service.ArticleService;
|
import cn.celess.blog.util.RedisUserUtil;
|
||||||
import cn.celess.common.util.EnvironmentUtil;
|
import cn.celess.blog.util.SitemapGenerateUtil;
|
||||||
import cn.celess.user.util.RedisUserUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/28 15:18
|
* @date : 2019/03/28 15:18
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class ArticleController {
|
public class ArticleController {
|
||||||
@Autowired
|
@Autowired
|
||||||
ArticleService articleService;
|
ArticleService articleService;
|
||||||
@Autowired
|
@Autowired
|
||||||
SitemapGenerateUtil sitemapGenerateUtil;
|
SitemapGenerateUtil sitemapGenerateUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
RedisUserUtil redisUserUtil;
|
RedisUserUtil redisUserUtil;
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
/**
|
private String activeModel;
|
||||||
* 新建一篇文章
|
|
||||||
*
|
/**
|
||||||
* @param body 请求数据
|
* 新建一篇文章
|
||||||
* @return Response
|
*
|
||||||
*/
|
* @param body 请求数据
|
||||||
@PostMapping("/admin/article/create")
|
* @return Response
|
||||||
public Response create(@RequestBody ArticleReq body) {
|
*/
|
||||||
ArticleModel articleModel = articleService.create(body);
|
@PostMapping("/admin/article/create")
|
||||||
if ("prod".equals(EnvironmentUtil.getProperties("spring.profiles.active", "dev"))) {
|
public Response create(@RequestBody ArticleReq body) {
|
||||||
sitemapGenerateUtil.createSitemap();
|
ArticleModel articleModel = articleService.create(body);
|
||||||
}
|
if ("prod".equals(activeModel)) {
|
||||||
return Response.success(articleModel);
|
sitemapGenerateUtil.createSitemap();
|
||||||
}
|
}
|
||||||
|
return Response.success(articleModel);
|
||||||
/**
|
}
|
||||||
* 通过文章id 删除一篇文章
|
|
||||||
*
|
/**
|
||||||
* @param articleId 文章id
|
* 通过文章id 删除一篇文章
|
||||||
* @return Response
|
*
|
||||||
*/
|
* @param articleId 文章id
|
||||||
@DeleteMapping("/admin/article/del")
|
* @return Response
|
||||||
public Response delete(@RequestParam("articleID") long articleId) {
|
*/
|
||||||
boolean delete = articleService.delete(articleId);
|
@DeleteMapping("/admin/article/del")
|
||||||
if ("prod".equals(EnvironmentUtil.getProperties("spring.profiles.active", "dev"))) {
|
public Response delete(@RequestParam("articleID") long articleId) {
|
||||||
sitemapGenerateUtil.createSitemap();
|
boolean delete = articleService.delete(articleId);
|
||||||
}
|
if ("prod".equals(activeModel)) {
|
||||||
return Response.success(delete);
|
sitemapGenerateUtil.createSitemap();
|
||||||
}
|
}
|
||||||
|
return Response.success(delete);
|
||||||
/**
|
}
|
||||||
* 更新文章
|
|
||||||
*
|
/**
|
||||||
* @param body 请求数据
|
* 更新文章
|
||||||
* @return Response
|
*
|
||||||
*/
|
* @param body 请求数据
|
||||||
@PutMapping("/admin/article/update")
|
* @return Response
|
||||||
public Response update(@RequestBody ArticleReq body) {
|
*/
|
||||||
ArticleModel update = articleService.update(body);
|
@PutMapping("/admin/article/update")
|
||||||
if ("prod".equals(EnvironmentUtil.getProperties("spring.profiles.active", "dev"))) {
|
public Response update(@RequestBody ArticleReq body) {
|
||||||
sitemapGenerateUtil.createSitemap();
|
ArticleModel update = articleService.update(body);
|
||||||
}
|
if ("prod".equals(activeModel)) {
|
||||||
return Response.success(update);
|
sitemapGenerateUtil.createSitemap();
|
||||||
}
|
}
|
||||||
|
return Response.success(update);
|
||||||
/**
|
}
|
||||||
* 通过id查找一篇文章
|
|
||||||
* 公开 =>返回数据
|
/**
|
||||||
* 不公开
|
* 通过id查找一篇文章
|
||||||
* *** =>作者 返回数据
|
* 公开 =>返回数据
|
||||||
* *** =>其他 抛出错误
|
* 不公开
|
||||||
*
|
* *** =>作者 返回数据
|
||||||
* @param articleId 文章id
|
* *** =>其他 抛出错误
|
||||||
* @param is4update 是否是更新
|
*
|
||||||
* @return Response
|
* @param articleId 文章id
|
||||||
*/
|
* @param is4update 是否是更新
|
||||||
@GetMapping("/article/articleID/{articleID}")
|
* @return Response
|
||||||
public Response retrieveOneById(@PathVariable("articleID") long articleId,
|
*/
|
||||||
@RequestParam(value = "update", defaultValue = "false") boolean is4update,
|
@GetMapping("/article/articleID/{articleID}")
|
||||||
HttpServletRequest request) {
|
public Response retrieveOneById(@PathVariable("articleID") long articleId,
|
||||||
ArticleModel article = articleService.retrieveOneById(articleId, is4update);
|
@RequestParam(value = "update", defaultValue = "false") boolean is4update,
|
||||||
if (article.getOpen()) {
|
HttpServletRequest request) {
|
||||||
return Response.success(article);
|
ArticleModel article = articleService.retrieveOneById(articleId, is4update);
|
||||||
} else if (article.getAuthor().getId().equals(redisUserUtil.get().getId())) {
|
if (article.getOpen()) {
|
||||||
return Response.success(article);
|
return Response.success(article);
|
||||||
}
|
} else if (article.getAuthor().getId().equals(redisUserUtil.get().getId())) {
|
||||||
return Response.response(ResponseEnum.PERMISSION_ERROR, null);
|
return Response.success(article);
|
||||||
}
|
}
|
||||||
|
return Response.response(ResponseEnum.PERMISSION_ERROR, null);
|
||||||
/**
|
}
|
||||||
* 分页获取所有文章状态为开放的的文章
|
|
||||||
*
|
/**
|
||||||
* @param page 页码
|
* 分页获取所有文章状态为开放的的文章
|
||||||
* @param count 单页数据量
|
*
|
||||||
* @return Response
|
* @param page 页码
|
||||||
*/
|
* @param count 单页数据量
|
||||||
@GetMapping("/articles")
|
* @return Response
|
||||||
public Response articles(@RequestParam(name = "page", defaultValue = "1") int page,
|
*/
|
||||||
@RequestParam(name = "count", defaultValue = "5") int count) {
|
@GetMapping("/articles")
|
||||||
return Response.success(articleService.retrievePageForOpen(count, page));
|
public Response articles(@RequestParam(name = "page", defaultValue = "1") int page,
|
||||||
}
|
@RequestParam(name = "count", defaultValue = "5") int count) {
|
||||||
|
return Response.success(articleService.retrievePageForOpen(count, page));
|
||||||
/**
|
}
|
||||||
* 分页获取所有文章
|
|
||||||
*
|
/**
|
||||||
* @param page 页码
|
* 分页获取所有文章
|
||||||
* @param count 单页数据量
|
*
|
||||||
* @return Response
|
* @param page 页码
|
||||||
*/
|
* @param count 单页数据量
|
||||||
@GetMapping("/admin/articles")
|
* @return Response
|
||||||
public Response adminArticles(@RequestParam(name = "page", defaultValue = "1") int page,
|
*/
|
||||||
@RequestParam(name = "count", defaultValue = "10") int count,
|
@GetMapping("/admin/articles")
|
||||||
@RequestParam(name = "deleted", required = false) Boolean deleted) {
|
public Response adminArticles(@RequestParam(name = "page", defaultValue = "1") int page,
|
||||||
return Response.success(articleService.adminArticles(count, page, deleted));
|
@RequestParam(name = "count", defaultValue = "10") int count,
|
||||||
}
|
@RequestParam(name = "deleted", required = false) Boolean deleted) {
|
||||||
|
return Response.success(articleService.adminArticles(count, page, deleted));
|
||||||
/**
|
}
|
||||||
* 通过分类获取文章(文章摘要)
|
|
||||||
*
|
/**
|
||||||
* @param name 分类名
|
* 通过分类获取文章(文章摘要)
|
||||||
* @param page 页码
|
*
|
||||||
* @param count 单页数据量
|
* @param name 分类名
|
||||||
* @return Response
|
* @param page 页码
|
||||||
*/
|
* @param count 单页数据量
|
||||||
@GetMapping("/articles/category/{name}")
|
* @return Response
|
||||||
public Response findByCategory(@PathVariable("name") String name,
|
*/
|
||||||
@RequestParam(name = "page", defaultValue = "1") int page,
|
@GetMapping("/articles/category/{name}")
|
||||||
@RequestParam(name = "count", defaultValue = "10") int count) {
|
public Response findByCategory(@PathVariable("name") String name,
|
||||||
return Response.success(articleService.findByCategory(name, page, count));
|
@RequestParam(name = "page", defaultValue = "1") int page,
|
||||||
}
|
@RequestParam(name = "count", defaultValue = "10") int count) {
|
||||||
|
return Response.success(articleService.findByCategory(name, page, count));
|
||||||
/**
|
}
|
||||||
* 通过标签名获取文章(文章摘要)
|
|
||||||
*
|
/**
|
||||||
* @param name 标签名
|
* 通过标签名获取文章(文章摘要)
|
||||||
* @param page 页码
|
*
|
||||||
* @param count 单页数据量
|
* @param name 标签名
|
||||||
* @return Response
|
* @param page 页码
|
||||||
*/
|
* @param count 单页数据量
|
||||||
@GetMapping("/articles/tag/{name}")
|
* @return Response
|
||||||
public Response findByTag(@PathVariable("name") String name,
|
*/
|
||||||
@RequestParam(name = "page", defaultValue = "1") int page,
|
@GetMapping("/articles/tag/{name}")
|
||||||
@RequestParam(name = "count", defaultValue = "10") int count) {
|
public Response findByTag(@PathVariable("name") String name,
|
||||||
return Response.success(articleService.findByTag(name, page, count));
|
@RequestParam(name = "page", defaultValue = "1") int page,
|
||||||
}
|
@RequestParam(name = "count", defaultValue = "10") int count) {
|
||||||
|
return Response.success(articleService.findByTag(name, page, count));
|
||||||
|
}
|
||||||
@GetMapping("/createSitemap")
|
|
||||||
public Response createSitemap() {
|
|
||||||
sitemapGenerateUtil.createSitemap();
|
@GetMapping("/createSitemap")
|
||||||
return Response.success(null);
|
public Response createSitemap() {
|
||||||
}
|
sitemapGenerateUtil.createSitemap();
|
||||||
}
|
return Response.success(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,63 +1,63 @@
|
|||||||
package cn.celess.categorytag.controller;
|
package cn.celess.blog.controller;
|
||||||
|
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.service.CategoryService;
|
import cn.celess.blog.service.CategoryService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/30 20:36
|
* @date : 2019/03/30 20:36
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class CategoryController {
|
public class CategoryController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CategoryService categoryService;
|
CategoryService categoryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增一个分类
|
* 新增一个分类
|
||||||
*
|
*
|
||||||
* @param name 分类名
|
* @param name 分类名
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
@PostMapping("/admin/category/create")
|
@PostMapping("/admin/category/create")
|
||||||
public Response addOne(@RequestParam("name") String name) {
|
public Response addOne(@RequestParam("name") String name) {
|
||||||
return Response.success(categoryService.create(name));
|
return Response.success(categoryService.create(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除一个分类
|
* 删除一个分类
|
||||||
*
|
*
|
||||||
* @param id 分类id
|
* @param id 分类id
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/admin/category/del")
|
@DeleteMapping("/admin/category/del")
|
||||||
public Response deleteOne(@RequestParam("id") long id) {
|
public Response deleteOne(@RequestParam("id") long id) {
|
||||||
return Response.success(categoryService.delete(id));
|
return Response.success(categoryService.delete(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新一个分类
|
* 更新一个分类
|
||||||
*
|
*
|
||||||
* @param id 分类id
|
* @param id 分类id
|
||||||
* @param name 更新后的名字
|
* @param name 更新后的名字
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
@PutMapping("/admin/category/update")
|
@PutMapping("/admin/category/update")
|
||||||
public Response updateOne(@RequestParam("id") Long id,
|
public Response updateOne(@RequestParam("id") Long id,
|
||||||
@RequestParam("name") String name) {
|
@RequestParam("name") String name) {
|
||||||
return Response.success(categoryService.update(id, name));
|
return Response.success(categoryService.update(id, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有的分类
|
* 获取所有的分类
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
@GetMapping("/categories")
|
@GetMapping("/categories")
|
||||||
public Response getPage(@RequestParam(name = "page", defaultValue = "1") int page,
|
public Response getPage(@RequestParam(name = "page", defaultValue = "1") int page,
|
||||||
@RequestParam(name = "count", defaultValue = "1000") int count) {
|
@RequestParam(name = "count", defaultValue = "1000") int count) {
|
||||||
return Response.success(categoryService.retrievePage(page, count));
|
return Response.success(categoryService.retrievePage(page, count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,119 +1,119 @@
|
|||||||
package cn.celess.comment.controller;
|
package cn.celess.blog.controller;
|
||||||
|
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.entity.dto.CommentReq;
|
import cn.celess.blog.entity.request.CommentReq;
|
||||||
import cn.celess.common.service.CommentService;
|
import cn.celess.blog.service.CommentService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/30 20:37
|
* @date : 2019/03/30 20:37
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class CommentController {
|
public class CommentController {
|
||||||
@Autowired
|
@Autowired
|
||||||
CommentService commentService;
|
CommentService commentService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增一条评论数据
|
* 新增一条评论数据
|
||||||
*
|
*
|
||||||
* @param reqBody 请求数据
|
* @param reqBody 请求数据
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
@PostMapping("/user/comment/create")
|
@PostMapping("/user/comment/create")
|
||||||
public Response addOne(@RequestBody CommentReq reqBody) {
|
public Response addOne(@RequestBody CommentReq reqBody) {
|
||||||
return Response.success(commentService.create(reqBody));
|
return Response.success(commentService.create(reqBody));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/user/comment/del")
|
@DeleteMapping("/user/comment/del")
|
||||||
public Response delete(@RequestParam("id") long id) {
|
public Response delete(@RequestParam("id") long id) {
|
||||||
return Response.success(commentService.delete(id));
|
return Response.success(commentService.delete(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/user/comment/update")
|
@PutMapping("/user/comment/update")
|
||||||
public Response update(@RequestBody CommentReq reqBody) {
|
public Response update(@RequestBody CommentReq reqBody) {
|
||||||
return Response.success(commentService.update(reqBody));
|
return Response.success(commentService.update(reqBody));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有的评论
|
* 获取所有的评论
|
||||||
*
|
*
|
||||||
* @param pagePath pagePath
|
* @param pagePath pagePath
|
||||||
* @param count 单页数据量
|
* @param count 单页数据量
|
||||||
* @param page 页码
|
* @param page 页码
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
@GetMapping("/comments/{pagePath}/{pid}")
|
@GetMapping("/comments/{pagePath}/{pid}")
|
||||||
public Response commentsOfArticle(@PathVariable("pagePath") String pagePath, @PathVariable(value = "pid") long pid,
|
public Response commentsOfArticle(@PathVariable("pagePath") String pagePath, @PathVariable(value = "pid") long pid,
|
||||||
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
||||||
String path = "";
|
String path = "";
|
||||||
if (pagePath.contains("article+")) {
|
if (pagePath.contains("article+")) {
|
||||||
path = "article/" + pagePath.split("\\+", 2)[1];
|
path = "article/" + pagePath.split("\\+", 2)[1];
|
||||||
} else {
|
} else {
|
||||||
path = pagePath;
|
path = pagePath;
|
||||||
}
|
}
|
||||||
if ("*".equals(pagePath)) {
|
if ("*".equals(pagePath)) {
|
||||||
path = null;
|
path = null;
|
||||||
}
|
}
|
||||||
return Response.success(commentService.retrievePageByPageAndPid(path, pid, page, count));
|
return Response.success(commentService.retrievePageByPageAndPid(path, pid, page, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过pid获取数据
|
* 通过pid获取数据
|
||||||
*
|
*
|
||||||
* @param pagePath pagePath
|
* @param pagePath pagePath
|
||||||
* @param count count
|
* @param count count
|
||||||
* @param page page
|
* @param page page
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
@GetMapping("/comment/pagePath/{pagePath}")
|
@GetMapping("/comment/pagePath/{pagePath}")
|
||||||
public Response retrievePage(@PathVariable("pagePath") String pagePath,
|
public Response retrievePage(@PathVariable("pagePath") String pagePath,
|
||||||
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
||||||
String path = "";
|
String path = "";
|
||||||
if (pagePath.contains("article+")) {
|
if (pagePath.contains("article+")) {
|
||||||
path = "article/" + pagePath.split("\\+", 2)[1];
|
path = "article/" + pagePath.split("\\+", 2)[1];
|
||||||
} else {
|
} else {
|
||||||
path = pagePath;
|
path = pagePath;
|
||||||
}
|
}
|
||||||
if ("*".equals(pagePath)) {
|
if ("*".equals(pagePath)) {
|
||||||
path = null;
|
path = null;
|
||||||
}
|
}
|
||||||
return Response.success(commentService.retrievePage(path, page, count));
|
return Response.success(commentService.retrievePage(path, page, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/user/comment/pagePath/{pagePath}")
|
@GetMapping("/user/comment/pagePath/{pagePath}")
|
||||||
public Response userComment(@PathVariable("pagePath") String pagePath,
|
public Response userComment(@PathVariable("pagePath") String pagePath,
|
||||||
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
||||||
String path = "";
|
String path = "";
|
||||||
if (pagePath.contains("article+")) {
|
if (pagePath.contains("article+")) {
|
||||||
path = "article/" + pagePath.split("\\+", 2)[1];
|
path = "article/" + pagePath.split("\\+", 2)[1];
|
||||||
} else {
|
} else {
|
||||||
path = pagePath;
|
path = pagePath;
|
||||||
}
|
}
|
||||||
if ("*".equals(pagePath)) {
|
if ("*".equals(pagePath)) {
|
||||||
path = null;
|
path = null;
|
||||||
}
|
}
|
||||||
return Response.success(commentService.retrievePageByAuthor(path, page, count));
|
return Response.success(commentService.retrievePageByAuthor(path, page, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/admin/comment/pagePath/{pagePath}")
|
@GetMapping("/admin/comment/pagePath/{pagePath}")
|
||||||
public Response adminComment(@PathVariable("pagePath") String pagePath,
|
public Response adminComment(@PathVariable("pagePath") String pagePath,
|
||||||
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
|
||||||
String path = "";
|
String path = "";
|
||||||
if (pagePath.contains("article+")) {
|
if (pagePath.contains("article+")) {
|
||||||
path = "article/" + pagePath.split("\\+", 2)[1];
|
path = "article/" + pagePath.split("\\+", 2)[1];
|
||||||
} else {
|
} else {
|
||||||
path = pagePath;
|
path = pagePath;
|
||||||
}
|
}
|
||||||
if ("*".equals(pagePath)) {
|
if ("*".equals(pagePath)) {
|
||||||
path = null;
|
path = null;
|
||||||
}
|
}
|
||||||
return Response.success(commentService.retrievePageByPage(path, page, count));
|
return Response.success(commentService.retrievePageByPage(path, page, count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
package cn.celess.extension.controller;
|
package cn.celess.blog.controller;
|
||||||
|
|
||||||
import cn.celess.common.constant.ResponseEnum;
|
import cn.celess.blog.enmu.ResponseEnum;
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.entity.vo.QiniuResponse;
|
import cn.celess.blog.entity.model.QiniuResponse;
|
||||||
import cn.celess.common.exception.BlogResponseException;
|
import cn.celess.blog.exception.MyException;
|
||||||
import cn.celess.common.service.CountService;
|
import cn.celess.blog.service.CountService;
|
||||||
import cn.celess.common.service.QiniuService;
|
import cn.celess.blog.service.QiniuService;
|
||||||
import cn.celess.common.util.HttpUtil;
|
import cn.celess.blog.util.HttpUtil;
|
||||||
import cn.celess.common.util.RedisUtil;
|
import cn.celess.blog.util.RedisUserUtil;
|
||||||
import cn.celess.common.util.VeriCodeUtil;
|
import cn.celess.blog.util.RedisUtil;
|
||||||
import cn.celess.user.util.RedisUserUtil;
|
import cn.celess.blog.util.VeriCodeUtil;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -37,7 +36,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* @date : 2019/04/02 22:03
|
* @date : 2019/04/02 22:03
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class ExtensionController {
|
public class CommonController {
|
||||||
public static final Logger logger = LoggerFactory.getLogger(Object.class);
|
public static final Logger logger = LoggerFactory.getLogger(Object.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -46,7 +45,7 @@ public class ExtensionController {
|
|||||||
QiniuService qiniuService;
|
QiniuService qiniuService;
|
||||||
@Autowired
|
@Autowired
|
||||||
RedisUtil redisUtil;
|
RedisUtil redisUtil;
|
||||||
@Resource
|
@Autowired
|
||||||
RedisUserUtil redisUserUtil;
|
RedisUserUtil redisUserUtil;
|
||||||
|
|
||||||
|
|
||||||
@@ -112,10 +111,10 @@ public class ExtensionController {
|
|||||||
request.getSession().setAttribute("verImgCodeStatus", false);
|
request.getSession().setAttribute("verImgCodeStatus", false);
|
||||||
String codeStr = (String) request.getSession().getAttribute("code");
|
String codeStr = (String) request.getSession().getAttribute("code");
|
||||||
if (code == null) {
|
if (code == null) {
|
||||||
throw new BlogResponseException(ResponseEnum.PARAMETERS_ERROR);
|
throw new MyException(ResponseEnum.PARAMETERS_ERROR);
|
||||||
}
|
}
|
||||||
if (codeStr == null) {
|
if (codeStr == null) {
|
||||||
throw new BlogResponseException(ResponseEnum.IMG_CODE_TIMEOUT);
|
throw new MyException(ResponseEnum.IMG_CODE_TIMEOUT);
|
||||||
}
|
}
|
||||||
code = code.toLowerCase();
|
code = code.toLowerCase();
|
||||||
codeStr = codeStr.toLowerCase();
|
codeStr = codeStr.toLowerCase();
|
||||||
@@ -147,7 +146,7 @@ public class ExtensionController {
|
|||||||
uploadTimes = Integer.parseInt(uploadTimesStr);
|
uploadTimes = Integer.parseInt(uploadTimesStr);
|
||||||
}
|
}
|
||||||
if (uploadTimes == 10) {
|
if (uploadTimes == 10) {
|
||||||
throw new BlogResponseException(ResponseEnum.FAILURE.getCode(), "上传次数已达10次,请2小时后在上传");
|
throw new MyException(ResponseEnum.FAILURE.getCode(), "上传次数已达10次,请2小时后在上传");
|
||||||
}
|
}
|
||||||
request.setCharacterEncoding("utf-8");
|
request.setCharacterEncoding("utf-8");
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
@@ -160,8 +159,8 @@ public class ExtensionController {
|
|||||||
String fileName = file.getOriginalFilename();
|
String fileName = file.getOriginalFilename();
|
||||||
assert fileName != null;
|
assert fileName != null;
|
||||||
String mime = fileName.substring(fileName.lastIndexOf("."));
|
String mime = fileName.substring(fileName.lastIndexOf("."));
|
||||||
if (".png".equalsIgnoreCase(mime) || ".jpg".equalsIgnoreCase(mime) ||
|
if (".png".equals(mime.toLowerCase()) || ".jpg".equals(mime.toLowerCase()) ||
|
||||||
".jpeg".equalsIgnoreCase(mime) || ".bmp".equalsIgnoreCase(mime)) {
|
".jpeg".equals(mime.toLowerCase()) || ".bmp".equals(mime.toLowerCase())) {
|
||||||
QiniuResponse qiniuResponse = qiniuService.uploadFile(file.getInputStream(), "img_" + System.currentTimeMillis() + mime);
|
QiniuResponse qiniuResponse = qiniuService.uploadFile(file.getInputStream(), "img_" + System.currentTimeMillis() + mime);
|
||||||
map.put("success", 1);
|
map.put("success", 1);
|
||||||
map.put("message", "上传成功");
|
map.put("message", "上传成功");
|
||||||
@@ -180,7 +179,7 @@ public class ExtensionController {
|
|||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
JsonNode root;
|
JsonNode root;
|
||||||
try {
|
try {
|
||||||
root = mapper.readTree(HttpUtil.getHttpResponse("https://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=zh-CN"));
|
root = mapper.readTree(HttpUtil.get("https://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=zh-CN"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return Response.failure(null);
|
return Response.failure(null);
|
||||||
}
|
}
|
||||||
@@ -197,10 +196,10 @@ public class ExtensionController {
|
|||||||
uploadTimes = Integer.parseInt(uploadTimesStr);
|
uploadTimes = Integer.parseInt(uploadTimesStr);
|
||||||
}
|
}
|
||||||
if (uploadTimes == 10) {
|
if (uploadTimes == 10) {
|
||||||
throw new BlogResponseException(ResponseEnum.FAILURE.getCode(), "上传次数已达10次,请2小时后在上传");
|
throw new MyException(ResponseEnum.FAILURE.getCode(), "上传次数已达10次,请2小时后在上传");
|
||||||
}
|
}
|
||||||
if (files.length == 0) {
|
if (files.length == 0) {
|
||||||
throw new BlogResponseException(ResponseEnum.NO_FILE);
|
throw new MyException(ResponseEnum.NO_FILE);
|
||||||
}
|
}
|
||||||
for (MultipartFile file : files) {
|
for (MultipartFile file : files) {
|
||||||
Map<String, Object> resp = new HashMap<>(4);
|
Map<String, Object> resp = new HashMap<>(4);
|
||||||
@@ -1,70 +1,69 @@
|
|||||||
package cn.celess.partnersite.controller;
|
package cn.celess.blog.controller;
|
||||||
|
|
||||||
|
import cn.celess.blog.entity.PartnerSite;
|
||||||
import cn.celess.common.entity.PartnerSite;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.request.LinkApplyReq;
|
||||||
import cn.celess.common.entity.dto.LinkApplyReq;
|
import cn.celess.blog.entity.request.LinkReq;
|
||||||
import cn.celess.common.entity.dto.LinkReq;
|
import cn.celess.blog.service.MailService;
|
||||||
import cn.celess.common.service.MailService;
|
import cn.celess.blog.service.PartnerSiteService;
|
||||||
import cn.celess.common.service.PartnerSiteService;
|
import cn.celess.blog.util.RedisUtil;
|
||||||
import cn.celess.common.util.RedisUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import java.util.List;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
/**
|
||||||
/**
|
* @author : xiaohai
|
||||||
* @author : xiaohai
|
* @date : 2019/05/12 13:26
|
||||||
* @date : 2019/05/12 13:26
|
*/
|
||||||
*/
|
@RestController
|
||||||
@RestController
|
public class LinksController {
|
||||||
public class PartnerSiteController {
|
@Autowired
|
||||||
@Autowired
|
PartnerSiteService partnerSiteService;
|
||||||
PartnerSiteService partnerSiteService;
|
@Autowired
|
||||||
@Autowired
|
MailService mailService;
|
||||||
MailService mailService;
|
@Autowired
|
||||||
@Autowired
|
RedisUtil redisUtil;
|
||||||
RedisUtil redisUtil;
|
@Autowired
|
||||||
@Autowired
|
HttpServletRequest request;
|
||||||
HttpServletRequest request;
|
|
||||||
|
@PostMapping("/admin/links/create")
|
||||||
@PostMapping("/admin/links/create")
|
public Response create(@RequestBody LinkReq reqBody) {
|
||||||
public Response create(@RequestBody LinkReq reqBody) {
|
return Response.success(partnerSiteService.create(reqBody));
|
||||||
return Response.success(partnerSiteService.create(reqBody));
|
}
|
||||||
}
|
|
||||||
|
@DeleteMapping("/admin/links/del/{id}")
|
||||||
@DeleteMapping("/admin/links/del/{id}")
|
public Response del(@PathVariable("id") long id) {
|
||||||
public Response del(@PathVariable("id") long id) {
|
return Response.success(partnerSiteService.del(id));
|
||||||
return Response.success(partnerSiteService.del(id));
|
}
|
||||||
}
|
|
||||||
|
@PutMapping("/admin/links/update")
|
||||||
@PutMapping("/admin/links/update")
|
public Response update(@RequestBody LinkReq reqBody) {
|
||||||
public Response update(@RequestBody LinkReq reqBody) {
|
return Response.success(partnerSiteService.update(reqBody));
|
||||||
return Response.success(partnerSiteService.update(reqBody));
|
}
|
||||||
}
|
|
||||||
|
@GetMapping("/links")
|
||||||
@GetMapping("/links")
|
public Response allForOpen() {
|
||||||
public Response allForOpen() {
|
List<PartnerSite> sites = partnerSiteService.findAll().stream().peek(partnerSite -> partnerSite.setOpen(null)).collect(Collectors.toList());
|
||||||
List<PartnerSite> sites = partnerSiteService.findAll().stream().peek(partnerSite -> partnerSite.setOpen(null)).collect(Collectors.toList());
|
return Response.success(sites);
|
||||||
return Response.success(sites);
|
}
|
||||||
}
|
|
||||||
|
@GetMapping("/admin/links")
|
||||||
@GetMapping("/admin/links")
|
public Response all(@RequestParam("page") int page,
|
||||||
public Response all(@RequestParam("page") int page,
|
@RequestParam("count") int count,
|
||||||
@RequestParam("count") int count,
|
@RequestParam(value = "deleted", required = false) Boolean deleted) {
|
||||||
@RequestParam(value = "deleted", required = false) Boolean deleted) {
|
return Response.success(partnerSiteService.partnerSitePages(page, count, deleted));
|
||||||
return Response.success(partnerSiteService.partnerSitePages(page, count, deleted));
|
}
|
||||||
}
|
|
||||||
|
@PostMapping("/apply")
|
||||||
@PostMapping("/apply")
|
public Response apply(@RequestBody() LinkApplyReq linkApplyReq) {
|
||||||
public Response apply(@RequestBody() LinkApplyReq linkApplyReq) {
|
return Response.success(partnerSiteService.apply(linkApplyReq));
|
||||||
return Response.success(partnerSiteService.apply(linkApplyReq));
|
}
|
||||||
}
|
|
||||||
|
@PostMapping("/reapply")
|
||||||
@PostMapping("/reapply")
|
public Response reapply(@RequestParam("key") String key) {
|
||||||
public Response reapply(@RequestParam("key") String key) {
|
return Response.success(partnerSiteService.reapply(key));
|
||||||
return Response.success(partnerSiteService.reapply(key));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,59 +1,59 @@
|
|||||||
package cn.celess.categorytag.controller;
|
package cn.celess.blog.controller;
|
||||||
|
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.entity.vo.TagModel;
|
import cn.celess.blog.entity.model.TagModel;
|
||||||
import cn.celess.common.service.TagService;
|
import cn.celess.blog.service.TagService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/30 20:36
|
* @date : 2019/03/30 20:36
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class TagController {
|
public class TagController {
|
||||||
@Autowired
|
@Autowired
|
||||||
TagService tagService;
|
TagService tagService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/admin/tag/create")
|
@PostMapping("/admin/tag/create")
|
||||||
public Response addOne(@RequestParam("name") String name) {
|
public Response addOne(@RequestParam("name") String name) {
|
||||||
return Response.success(tagService.create(name));
|
return Response.success(tagService.create(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/admin/tag/del")
|
@DeleteMapping("/admin/tag/del")
|
||||||
public Response delOne(@RequestParam("id") long id) {
|
public Response delOne(@RequestParam("id") long id) {
|
||||||
return Response.success(tagService.delete(id));
|
return Response.success(tagService.delete(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PutMapping("/admin/tag/update")
|
@PutMapping("/admin/tag/update")
|
||||||
public Response updateOne(@RequestParam("id") Long id, @RequestParam("name") String name) {
|
public Response updateOne(@RequestParam("id") Long id, @RequestParam("name") String name) {
|
||||||
return Response.success(tagService.update(id, name));
|
return Response.success(tagService.update(id, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/tags")
|
@GetMapping("/tags")
|
||||||
public Response getPage(@RequestParam(required = false, defaultValue = "10", value = "count") int count,
|
public Response getPage(@RequestParam(required = false, defaultValue = "10", value = "count") int count,
|
||||||
@RequestParam(required = false, defaultValue = "1", value = "page") int page) {
|
@RequestParam(required = false, defaultValue = "1", value = "page") int page) {
|
||||||
return Response.success(tagService.retrievePage(page, count));
|
return Response.success(tagService.retrievePage(page, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/tags/nac")
|
@GetMapping("/tags/nac")
|
||||||
public Response getTagNameAndCount() {
|
public Response getTagNameAndCount() {
|
||||||
List<Map<String, Object>> nameAndCount = new ArrayList<>();
|
List<Map<String, Object>> nameAndCount = new ArrayList<>();
|
||||||
List<TagModel> all = tagService.findAll();
|
List<TagModel> all = tagService.findAll();
|
||||||
for (TagModel t : all) {
|
for (TagModel t : all) {
|
||||||
Map<String, Object> map = new HashMap<>(2);
|
Map<String, Object> map = new HashMap<>(2);
|
||||||
map.put("name", t.getName());
|
map.put("name", t.getName());
|
||||||
map.put("size", t.getArticles().size());
|
map.put("size", t.getArticles().size());
|
||||||
nameAndCount.add(map);
|
nameAndCount.add(map);
|
||||||
}
|
}
|
||||||
return Response.success(nameAndCount);
|
return Response.success(nameAndCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,129 +1,129 @@
|
|||||||
package cn.celess.user.controller;
|
package cn.celess.blog.controller;
|
||||||
|
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.entity.dto.LoginReq;
|
import cn.celess.blog.entity.request.LoginReq;
|
||||||
import cn.celess.common.entity.dto.UserReq;
|
import cn.celess.blog.entity.request.UserReq;
|
||||||
import cn.celess.common.service.UserService;
|
import cn.celess.blog.service.UserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/30 20:37
|
* @date : 2019/03/30 20:37
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class UserController {
|
public class UserController {
|
||||||
@Autowired
|
@Autowired
|
||||||
UserService userService;
|
UserService userService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public Response login(@RequestBody LoginReq loginReq) {
|
public Response login(@RequestBody LoginReq loginReq) {
|
||||||
return Response.success(userService.login(loginReq));
|
return Response.success(userService.login(loginReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/registration")
|
@PostMapping("/registration")
|
||||||
public Response registration(@RequestParam("email") String email,
|
public Response registration(@RequestParam("email") String email,
|
||||||
@RequestParam("password") String password) {
|
@RequestParam("password") String password) {
|
||||||
return Response.success(userService.registration(email, password));
|
return Response.success(userService.registration(email, password));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/logout")
|
@GetMapping("/logout")
|
||||||
public Response logout() {
|
public Response logout() {
|
||||||
return Response.success(userService.logout());
|
return Response.success(userService.logout());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/user/userInfo/update")
|
@PutMapping("/user/userInfo/update")
|
||||||
public Response updateInfo(String desc, String displayName) {
|
public Response updateInfo(String desc, String displayName) {
|
||||||
return Response.success(userService.update(desc, displayName));
|
return Response.success(userService.update(desc, displayName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/user/userInfo")
|
@GetMapping("/user/userInfo")
|
||||||
public Response getUserInfo() {
|
public Response getUserInfo() {
|
||||||
return Response.success(userService.getUserInfoBySession());
|
return Response.success(userService.getUserInfoBySession());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新头像
|
* 更新头像
|
||||||
*
|
*
|
||||||
* @param file file
|
* @param file file
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@PostMapping("/user/imgUpload")
|
@PostMapping("/user/imgUpload")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Response upload(@RequestParam("file") MultipartFile file) throws IOException {
|
public Response upload(@RequestParam("file") MultipartFile file) throws IOException {
|
||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
return Response.failure("上传失败,请选择文件");
|
return Response.failure("上传失败,请选择文件");
|
||||||
}
|
}
|
||||||
String fileName = file.getOriginalFilename();
|
String fileName = file.getOriginalFilename();
|
||||||
String mime = fileName.substring(fileName.lastIndexOf("."));
|
String mime = fileName.substring(fileName.lastIndexOf("."));
|
||||||
if (".png".equalsIgnoreCase(mime) || ".jpg".equalsIgnoreCase(mime) ||
|
if (".png".equals(mime.toLowerCase()) || ".jpg".equals(mime.toLowerCase()) ||
|
||||||
".jpeg".equalsIgnoreCase(mime) || ".bmp".equalsIgnoreCase(mime)) {
|
".jpeg".equals(mime.toLowerCase()) || ".bmp".equals(mime.toLowerCase())) {
|
||||||
return (Response) userService.updateUserAavatarImg(file.getInputStream(), mime);
|
return (Response) userService.updateUserAavatarImg(file.getInputStream(), mime);
|
||||||
}
|
}
|
||||||
return Response.failure("请上传图片文件");
|
return Response.failure("请上传图片文件");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/sendResetPwdEmail")
|
@PostMapping("/sendResetPwdEmail")
|
||||||
public Response sendResetPwdEmail(@RequestParam("email") String email) {
|
public Response sendResetPwdEmail(@RequestParam("email") String email) {
|
||||||
return Response.success(userService.sendResetPwdEmail(email));
|
return Response.success(userService.sendResetPwdEmail(email));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/sendVerifyEmail")
|
@PostMapping("/sendVerifyEmail")
|
||||||
public Response sendVerifyEmail(@RequestParam("email") String email) {
|
public Response sendVerifyEmail(@RequestParam("email") String email) {
|
||||||
return Response.success(userService.sendVerifyEmail(email));
|
return Response.success(userService.sendVerifyEmail(email));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/emailVerify")
|
@PostMapping("/emailVerify")
|
||||||
public Response emailVerify(@RequestParam("verifyId") String verifyId,
|
public Response emailVerify(@RequestParam("verifyId") String verifyId,
|
||||||
@RequestParam("email") String mail) {
|
@RequestParam("email") String mail) {
|
||||||
return Response.success(userService.verifyEmail(verifyId, mail));
|
return Response.success(userService.verifyEmail(verifyId, mail));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/resetPwd")
|
@PostMapping("/resetPwd")
|
||||||
public Response resetPwd(@RequestParam("verifyId") String verifyId,
|
public Response resetPwd(@RequestParam("verifyId") String verifyId,
|
||||||
@RequestParam("email") String email,
|
@RequestParam("email") String email,
|
||||||
@RequestParam("pwd") String pwd) {
|
@RequestParam("pwd") String pwd) {
|
||||||
return Response.success(userService.reSetPwd(verifyId, email, pwd));
|
return Response.success(userService.reSetPwd(verifyId, email, pwd));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/user/setPwd")
|
@PostMapping("/user/setPwd")
|
||||||
public Response setPwd(@RequestParam("pwd") String pwd,
|
public Response setPwd(@RequestParam("pwd") String pwd,
|
||||||
@RequestParam("newPwd") String newPwd,
|
@RequestParam("newPwd") String newPwd,
|
||||||
@RequestParam("confirmPwd") String confirmPwd) {
|
@RequestParam("confirmPwd") String confirmPwd) {
|
||||||
return Response.success(userService.setPwd(pwd, newPwd, confirmPwd));
|
return Response.success(userService.setPwd(pwd, newPwd, confirmPwd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@DeleteMapping("/admin/user/delete")
|
@DeleteMapping("/admin/user/delete")
|
||||||
public Response multipleDelete(@RequestBody Integer[] ids) {
|
public Response multipleDelete(@RequestBody Integer[] ids) {
|
||||||
return Response.success(userService.deleteUser(ids));
|
return Response.success(userService.deleteUser(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/admin/user/delete/{id}")
|
@DeleteMapping("/admin/user/delete/{id}")
|
||||||
public Response delete(@PathVariable("id") Integer id) {
|
public Response delete(@PathVariable("id") Integer id) {
|
||||||
return Response.success(userService.deleteUser(new Integer[]{id}));
|
return Response.success(userService.deleteUser(new Integer[]{id}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/admin/user")
|
@PutMapping("/admin/user")
|
||||||
public Response updateInfoByAdmin(@RequestBody UserReq user) {
|
public Response updateInfoByAdmin(@RequestBody UserReq user) {
|
||||||
return Response.success(userService.adminUpdate(user));
|
return Response.success(userService.adminUpdate(user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/admin/users")
|
@GetMapping("/admin/users")
|
||||||
public Response getAllUser(@RequestParam("page") int pageNum, @RequestParam("count") int count, @RequestParam(name = "status", required = false) Integer status) {
|
public Response getAllUser(@RequestParam("page") int pageNum, @RequestParam("count") int count, @RequestParam(name = "status", required = false) Integer status) {
|
||||||
return Response.success(userService.getUserList(pageNum, count, status));
|
return Response.success(userService.getUserList(pageNum, count, status));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/emailStatus/{email}")
|
@GetMapping("/emailStatus/{email}")
|
||||||
public Response getEmailStatus(@PathVariable("email") String email) {
|
public Response getEmailStatus(@PathVariable("email") String email) {
|
||||||
return Response.success(userService.getStatusOfEmail(email));
|
return Response.success(userService.getStatusOfEmail(email));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,59 +1,59 @@
|
|||||||
package cn.celess.visitor.controller;
|
package cn.celess.blog.controller;
|
||||||
|
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.service.CountService;
|
import cn.celess.blog.service.CountService;
|
||||||
import cn.celess.common.service.VisitorService;
|
import cn.celess.blog.service.VisitorService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/04/02 23:09
|
* @date : 2019/04/02 23:09
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class VisitorController {
|
public class VisitorController {
|
||||||
@Autowired
|
@Autowired
|
||||||
VisitorService visitorService;
|
VisitorService visitorService;
|
||||||
@Autowired
|
@Autowired
|
||||||
CountService countService;
|
CountService countService;
|
||||||
|
|
||||||
@GetMapping("/visitor/count")
|
@GetMapping("/visitor/count")
|
||||||
public Response getVisitorCount() {
|
public Response getVisitorCount() {
|
||||||
return Response.success(countService.getVisitorCount());
|
return Response.success(countService.getVisitorCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/admin/visitor/page")
|
@GetMapping("/admin/visitor/page")
|
||||||
public Response page(@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
public Response page(@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||||
@RequestParam(value = "showLocation", required = false, defaultValue = "true") boolean showLocation) {
|
@RequestParam(value = "showLocation", required = false, defaultValue = "true") boolean showLocation) {
|
||||||
return Response.success(visitorService.visitorPage(page, count, showLocation));
|
return Response.success(visitorService.visitorPage(page, count, showLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/visit")
|
@PostMapping("/visit")
|
||||||
public Response add(HttpServletRequest request) {
|
public Response add(HttpServletRequest request) {
|
||||||
return Response.success(visitorService.addVisitor(request));
|
return Response.success(visitorService.addVisitor(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/dayVisitCount")
|
@GetMapping("/dayVisitCount")
|
||||||
public Response dayVisitCount() {
|
public Response dayVisitCount() {
|
||||||
return Response.success(countService.getDayVisitCount());
|
return Response.success(countService.getDayVisitCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/ip/{ip}")
|
@GetMapping("/ip/{ip}")
|
||||||
public Response ipLocation(@PathVariable("ip") String ip) {
|
public Response ipLocation(@PathVariable("ip") String ip) {
|
||||||
return Response.success(visitorService.location(ip));
|
return Response.success(visitorService.location(ip));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取本地访问者的ip
|
* 获取本地访问者的ip
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/ip")
|
@GetMapping("/ip")
|
||||||
public Response getIp(HttpServletRequest request) {
|
public Response getIp(HttpServletRequest request) {
|
||||||
return Response.success(request.getRemoteAddr());
|
return Response.success(request.getRemoteAddr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,48 +1,48 @@
|
|||||||
package cn.celess.siteinfo.controller;
|
package cn.celess.blog.controller;
|
||||||
|
|
||||||
import cn.celess.common.entity.Response;
|
import cn.celess.blog.entity.Response;
|
||||||
import cn.celess.common.service.WebUpdateInfoService;
|
import cn.celess.blog.service.WebUpdateInfoService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/05/12 13:09
|
* @date : 2019/05/12 13:09
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class WebUpdateInfoController {
|
public class WebUpdateInfoController {
|
||||||
@Autowired
|
@Autowired
|
||||||
WebUpdateInfoService webUpdateInfoService;
|
WebUpdateInfoService webUpdateInfoService;
|
||||||
|
|
||||||
@PostMapping("/admin/webUpdate/create")
|
@PostMapping("/admin/webUpdate/create")
|
||||||
public Response create(@RequestParam("info") String info) {
|
public Response create(@RequestParam("info") String info) {
|
||||||
return Response.success(webUpdateInfoService.create(info));
|
return Response.success(webUpdateInfoService.create(info));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/admin/webUpdate/del/{id}")
|
@DeleteMapping("/admin/webUpdate/del/{id}")
|
||||||
public Response del(@PathVariable("id") long id) {
|
public Response del(@PathVariable("id") long id) {
|
||||||
return Response.success(webUpdateInfoService.del(id));
|
return Response.success(webUpdateInfoService.del(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/admin/webUpdate/update")
|
@PutMapping("/admin/webUpdate/update")
|
||||||
public Response update(@RequestParam("id") long id, @RequestParam("info") String info) {
|
public Response update(@RequestParam("id") long id, @RequestParam("info") String info) {
|
||||||
return Response.success(webUpdateInfoService.update(id, info));
|
return Response.success(webUpdateInfoService.update(id, info));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/webUpdate")
|
@GetMapping("/webUpdate")
|
||||||
public Response findAll() {
|
public Response findAll() {
|
||||||
return Response.success(webUpdateInfoService.findAll());
|
return Response.success(webUpdateInfoService.findAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/webUpdate/pages")
|
@GetMapping("/webUpdate/pages")
|
||||||
public Response page(@RequestParam("page") int page, @RequestParam("count") int count) {
|
public Response page(@RequestParam("page") int page, @RequestParam("count") int count) {
|
||||||
return Response.success(webUpdateInfoService.pages(count, page));
|
return Response.success(webUpdateInfoService.pages(count, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/lastestUpdate")
|
@GetMapping("/lastestUpdate")
|
||||||
public Response lastestUpdateTime() {
|
public Response lastestUpdateTime() {
|
||||||
return Response.success(webUpdateInfoService.getLastestUpdateTime());
|
return Response.success(webUpdateInfoService.getLastestUpdateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cn.celess.common.constant;
|
package cn.celess.blog.enmu;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -1,96 +1,96 @@
|
|||||||
package cn.celess.common.constant;
|
package cn.celess.blog.enmu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/28 15:37
|
* @date : 2019/03/28 15:37
|
||||||
*/
|
*/
|
||||||
public enum ResponseEnum {
|
public enum ResponseEnum {
|
||||||
// Response enum
|
// Response enum
|
||||||
|
|
||||||
SUCCESS(0, "成功"),
|
SUCCESS(0, "成功"),
|
||||||
FAILURE(-1, "失败"),
|
FAILURE(-1, "失败"),
|
||||||
ERROR(-2, "错误"),
|
ERROR(-2, "错误"),
|
||||||
|
|
||||||
DATA_IS_DELETED(1000, "数据已被删除"),
|
DATA_IS_DELETED(1000, "数据已被删除"),
|
||||||
|
|
||||||
//文章类
|
//文章类
|
||||||
ARTICLE_NOT_EXIST(2010, "文章不存在"),
|
ARTICLE_NOT_EXIST(2010, "文章不存在"),
|
||||||
ARTICLE_HAS_EXIST(2020, "文章已存在"),
|
ARTICLE_HAS_EXIST(2020, "文章已存在"),
|
||||||
ARTICLE_NOT_PUBLIC(2030, "文章暂未公开"),
|
ARTICLE_NOT_PUBLIC(2030, "文章暂未公开"),
|
||||||
ARTICLE_NOT_BELONG_YOU(2040, "无权限操作别人的文章"),
|
ARTICLE_NOT_BELONG_YOU(2040, "无权限操作别人的文章"),
|
||||||
|
|
||||||
//用户类
|
//用户类
|
||||||
HAVE_NOT_LOG_IN(3010, "还未登录"),
|
HAVE_NOT_LOG_IN(3010, "还未登录"),
|
||||||
PERMISSION_ERROR(3020, "没有此权限"),
|
PERMISSION_ERROR(3020, "没有此权限"),
|
||||||
USER_NOT_EXIST(3030, "用户不存在"),
|
USER_NOT_EXIST(3030, "用户不存在"),
|
||||||
USERNAME_HAS_EXIST(3040, "用户名已存在"),
|
USERNAME_HAS_EXIST(3040, "用户名已存在"),
|
||||||
USERNAME_TOO_SHORT(3050, "用户名太短"),
|
USERNAME_TOO_SHORT(3050, "用户名太短"),
|
||||||
PASSWORD_TOO_SHORT_OR_LONG(3060, "密码长度过长或者过短"),
|
PASSWORD_TOO_SHORT_OR_LONG(3060, "密码长度过长或者过短"),
|
||||||
LOGIN_FAILURE(3100, "登录失败,用户名/密码不正确"),
|
LOGIN_FAILURE(3100, "登录失败,用户名/密码不正确"),
|
||||||
USEREMAIL_NULL(3310, "未设置邮箱"),
|
USEREMAIL_NULL(3310, "未设置邮箱"),
|
||||||
USEREMAIL_NOT_VERIFY(3320, "邮箱未验证"),
|
USEREMAIL_NOT_VERIFY(3320, "邮箱未验证"),
|
||||||
LOGIN_LATER(3500, "错误次数已达5次,请稍后再试"),
|
LOGIN_LATER(3500, "错误次数已达5次,请稍后再试"),
|
||||||
PWD_SAME(3601, "新密码与原密码相同"),
|
PWD_SAME(3601, "新密码与原密码相同"),
|
||||||
PWD_NOT_SAME(3602, "新密码与原密码不相同"),
|
PWD_NOT_SAME(3602, "新密码与原密码不相同"),
|
||||||
LOGIN_EXPIRED(3700, "登陆过期"),
|
LOGIN_EXPIRED(3700, "登陆过期"),
|
||||||
LOGOUT(3710, "账户已注销"),
|
LOGOUT(3710, "账户已注销"),
|
||||||
CAN_NOT_USE(3711, "账户不可用"),
|
CAN_NOT_USE(3711, "账户不可用"),
|
||||||
PWD_WRONG(3800, "密码不正确"),
|
PWD_WRONG(3800, "密码不正确"),
|
||||||
|
|
||||||
JWT_EXPIRED(3810, "Token过期"),
|
JWT_EXPIRED(3810, "Token过期"),
|
||||||
JWT_MALFORMED(3820, "Token格式不对"),
|
JWT_MALFORMED(3820, "Token格式不对"),
|
||||||
JWT_SIGNATURE(3830, "Token签名错误"),
|
JWT_SIGNATURE(3830, "Token签名错误"),
|
||||||
JWT_NOT_SUPPORT(3840, "不支持的Token"),
|
JWT_NOT_SUPPORT(3840, "不支持的Token"),
|
||||||
|
|
||||||
//标签
|
//标签
|
||||||
TAG_NOT_EXIST(4010, "标签不存在"),
|
TAG_NOT_EXIST(4010, "标签不存在"),
|
||||||
TAG_HAS_EXIST(4020, "标签已存在"),
|
TAG_HAS_EXIST(4020, "标签已存在"),
|
||||||
|
|
||||||
//分类
|
//分类
|
||||||
CATEGORY_NOT_EXIST(5010, "分类不存在"),
|
CATEGORY_NOT_EXIST(5010, "分类不存在"),
|
||||||
CATEGORY_HAS_EXIST(5020, "分类已存在"),
|
CATEGORY_HAS_EXIST(5020, "分类已存在"),
|
||||||
|
|
||||||
//评论/留言
|
//评论/留言
|
||||||
COMMENT_NOT_EXIST(6010, "评论/留言不存在"),
|
COMMENT_NOT_EXIST(6010, "评论/留言不存在"),
|
||||||
COMMENT_HAS_EXIST(6020, "评论/留言已存在,请不要重复提交"),
|
COMMENT_HAS_EXIST(6020, "评论/留言已存在,请不要重复提交"),
|
||||||
|
|
||||||
//webUdpateInfo amd PartnerSite
|
//webUdpateInfo amd PartnerSite
|
||||||
DATA_NOT_EXIST(7010, "数据不存在"),
|
DATA_NOT_EXIST(7010, "数据不存在"),
|
||||||
DATA_HAS_EXIST(7020, "数据已存在"),
|
DATA_HAS_EXIST(7020, "数据已存在"),
|
||||||
|
|
||||||
//其他
|
//其他
|
||||||
APPLY_LINK_NO_ADD_THIS_SITE(7200, "暂未在您的网站中抓取到本站链接"),
|
APPLY_LINK_NO_ADD_THIS_SITE(7200, "暂未在您的网站中抓取到本站链接"),
|
||||||
DATA_EXPIRED(7300, "数据过期"),
|
DATA_EXPIRED(7300, "数据过期"),
|
||||||
CANNOT_GET_DATA(7400, "暂无法获取到数据"),
|
CANNOT_GET_DATA(7400, "暂无法获取到数据"),
|
||||||
NO_FILE(7500, "未选择文件,请重新选择"),
|
NO_FILE(7500, "未选择文件,请重新选择"),
|
||||||
|
|
||||||
|
|
||||||
//提交更新之前,没有获取数据/,
|
//提交更新之前,没有获取数据/,
|
||||||
DID_NOT_GET_THE_DATA(8020, "非法访问"),
|
DID_NOT_GET_THE_DATA(8020, "非法访问"),
|
||||||
IMG_CODE_TIMEOUT(8100, "验证码已失效"),
|
IMG_CODE_TIMEOUT(8100, "验证码已失效"),
|
||||||
IMG_CODE_DIDNOTVERIFY(8200, "请先验证验证码"),
|
IMG_CODE_DIDNOTVERIFY(8200, "请先验证验证码"),
|
||||||
VERIFY_ERROR(8300, "验证失败"),
|
VERIFY_ERROR(8300, "验证失败"),
|
||||||
PARAMETERS_ERROR(8500, "参数错误"),
|
PARAMETERS_ERROR(8500, "参数错误"),
|
||||||
PARAMETERS_URL_ERROR(8510, "链接格式错误"),
|
PARAMETERS_URL_ERROR(8510, "链接格式错误"),
|
||||||
PARAMETERS_EMAIL_ERROR(8520, "邮箱格式错误"),
|
PARAMETERS_EMAIL_ERROR(8520, "邮箱格式错误"),
|
||||||
PARAMETERS_PHONE_ERROR(8530, "手机格式错误"),
|
PARAMETERS_PHONE_ERROR(8530, "手机格式错误"),
|
||||||
PARAMETERS_QQ_ERROR(8540, "QQ格式错误"),
|
PARAMETERS_QQ_ERROR(8540, "QQ格式错误"),
|
||||||
PARAMETERS_PWD_ERROR(8550, "密码格式错误"),
|
PARAMETERS_PWD_ERROR(8550, "密码格式错误"),
|
||||||
VERIFY_OUT(8400, "已经验证过了");
|
VERIFY_OUT(8400, "已经验证过了");
|
||||||
private final int code;
|
private final int code;
|
||||||
private final String msg;
|
private final String msg;
|
||||||
|
|
||||||
|
|
||||||
ResponseEnum(int code, String msg) {
|
ResponseEnum(int code, String msg) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCode() {
|
public int getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMsg() {
|
public String getMsg() {
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cn.celess.common.constant;
|
package cn.celess.blog.enmu;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cn.celess.common.constant;
|
package cn.celess.blog.enmu;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
@@ -1,64 +1,63 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.util.Date;
|
||||||
import java.util.Date;
|
import java.util.List;
|
||||||
import java.util.List;
|
|
||||||
|
/**
|
||||||
/**
|
* @author : xiaohai
|
||||||
* @author : xiaohai
|
* @date : 2019/03/28 14:51
|
||||||
* @date : 2019/03/28 14:51
|
*/
|
||||||
*/
|
@Data
|
||||||
@Data
|
public class Article {
|
||||||
public class Article implements Serializable {
|
private Long id;
|
||||||
private Long id;
|
|
||||||
|
/**
|
||||||
/**
|
* 标题
|
||||||
* 标题
|
*/
|
||||||
*/
|
private String title;
|
||||||
private String title;
|
|
||||||
|
/**
|
||||||
/**
|
* 摘要
|
||||||
* 摘要
|
*/
|
||||||
*/
|
private String summary;
|
||||||
private String summary;
|
|
||||||
|
/**
|
||||||
/**
|
* Markdown正文
|
||||||
* Markdown正文
|
*/
|
||||||
*/
|
private String mdContent;
|
||||||
private String mdContent;
|
|
||||||
|
/**
|
||||||
/**
|
* 文章类型 true(1)为原创 false(0)为转载
|
||||||
* 文章类型 true(1)为原创 false(0)为转载
|
*/
|
||||||
*/
|
private Boolean type;
|
||||||
private Boolean type;
|
|
||||||
|
/**
|
||||||
/**
|
* 若为转载 则为转载文章的url
|
||||||
* 若为转载 则为转载文章的url
|
*/
|
||||||
*/
|
private String url = null;
|
||||||
private String url = null;
|
|
||||||
|
private Date publishDate;
|
||||||
private Date publishDate;
|
|
||||||
|
private Date updateDate = null;
|
||||||
private Date updateDate = null;
|
|
||||||
|
private Long readingNumber;
|
||||||
private Long readingNumber;
|
|
||||||
|
/**
|
||||||
/**
|
* 文章的状态 true:公开 false:不公开
|
||||||
* 文章的状态 true:公开 false:不公开
|
*/
|
||||||
*/
|
private Boolean open;
|
||||||
private Boolean open;
|
|
||||||
|
private Category category;
|
||||||
private Category category;
|
|
||||||
|
private List<Tag> tags;
|
||||||
private List<Tag> tags;
|
|
||||||
|
private Integer likeCount;
|
||||||
private Integer likeCount;
|
|
||||||
|
private Integer dislikeCount;
|
||||||
private Integer dislikeCount;
|
|
||||||
|
private User user;
|
||||||
private User user;
|
|
||||||
|
private boolean deleted = false;
|
||||||
private boolean deleted = false;
|
}
|
||||||
}
|
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 小海
|
* @Author: 小海
|
||||||
* @Date: 2020-05-24 14:52
|
* @Date: 2020-05-24 14:52
|
||||||
@@ -14,7 +12,7 @@ import java.io.Serializable;
|
|||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class ArticleTag implements Serializable {
|
public class ArticleTag {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
private Article article;
|
private Article article;
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/28 22:18
|
* @date : 2019/03/28 22:18
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class Category extends TagCategory implements Serializable {
|
public class Category extends TagCategory {
|
||||||
public Category(String name) {
|
public Category(String name) {
|
||||||
super.setName(name);
|
super.setName(name);
|
||||||
}
|
}
|
||||||
@@ -1,35 +1,34 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.util.Date;
|
||||||
import java.util.Date;
|
|
||||||
|
/**
|
||||||
/**
|
* @author : xiaohai
|
||||||
* @author : xiaohai
|
* @date : 2019/03/29 16:47
|
||||||
* @date : 2019/03/29 16:47
|
*/
|
||||||
*/
|
|
||||||
|
@Data
|
||||||
@Data
|
public class Comment {
|
||||||
public class Comment implements Serializable {
|
|
||||||
|
private Long id;
|
||||||
private Long id;
|
|
||||||
|
private int status;
|
||||||
private int status;
|
|
||||||
|
private String pagePath;
|
||||||
private String pagePath;
|
|
||||||
|
private String content;
|
||||||
private String content;
|
|
||||||
|
private Date date;
|
||||||
private Date date;
|
|
||||||
|
private User fromUser;
|
||||||
private User fromUser;
|
|
||||||
|
private User toUser;
|
||||||
private User toUser;
|
/**
|
||||||
/**
|
* 评论的父ID
|
||||||
* 评论的父ID
|
*/
|
||||||
*/
|
private Long pid;
|
||||||
private Long pid;
|
|
||||||
|
// private boolean delete;
|
||||||
// private boolean delete;
|
}
|
||||||
}
|
|
||||||
@@ -1,42 +1,40 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
/**
|
||||||
|
* 友链
|
||||||
/**
|
*
|
||||||
* 友链
|
* @author : xiaohai
|
||||||
*
|
* @date : 2019/05/12 11:33
|
||||||
* @author : xiaohai
|
*/
|
||||||
* @date : 2019/05/12 11:33
|
@Data
|
||||||
*/
|
public class PartnerSite {
|
||||||
@Data
|
|
||||||
public class PartnerSite implements Serializable {
|
private Long id;
|
||||||
|
|
||||||
private Long id;
|
private String name;
|
||||||
|
|
||||||
private String name;
|
private String url;
|
||||||
|
|
||||||
private String url;
|
private Boolean open;
|
||||||
|
|
||||||
private Boolean open;
|
private String iconPath;
|
||||||
|
|
||||||
private String iconPath;
|
private String desc;
|
||||||
|
|
||||||
private String desc;
|
private Boolean delete = false;
|
||||||
|
|
||||||
private Boolean delete = false;
|
private String email;
|
||||||
|
|
||||||
private String email;
|
private Boolean notification = true;
|
||||||
|
|
||||||
private Boolean notification = true;
|
public PartnerSite() {
|
||||||
|
}
|
||||||
public PartnerSite() {
|
|
||||||
}
|
public PartnerSite(String name, String url, Boolean open) {
|
||||||
|
this.name = name;
|
||||||
public PartnerSite(String name, String url, Boolean open) {
|
this.url = url;
|
||||||
this.name = name;
|
this.open = open;
|
||||||
this.url = url;
|
}
|
||||||
this.open = open;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +1,65 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import cn.celess.common.constant.ResponseEnum;
|
import cn.celess.blog.enmu.ResponseEnum;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/28 15:24
|
* @date : 2019/03/28 15:24
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class Response<T> implements Serializable {
|
public class Response<T> implements Serializable {
|
||||||
private int code;
|
private int code;
|
||||||
private String msg;
|
private String msg;
|
||||||
private T result;
|
private T result;
|
||||||
|
|
||||||
public Response() {
|
public Response() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Response(int code, String msg, T result) {
|
public Response(int code, String msg, T result) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.msg = msg;
|
this.msg = msg;
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成功相应
|
* 成功相应
|
||||||
*
|
*
|
||||||
* @param result 结果
|
* @param result 结果
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public static <T> Response<T> success(T result) {
|
public static <T> Response<T> success(T result) {
|
||||||
return new Response<T>(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getMsg(), result);
|
return new Response<T>(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getMsg(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 失败的响应
|
* 失败的响应
|
||||||
*
|
*
|
||||||
* @param result 结果
|
* @param result 结果
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public static Response<String> failure(String result) {
|
public static Response<String> failure(String result) {
|
||||||
return new Response<String>(ResponseEnum.FAILURE.getCode(), ResponseEnum.FAILURE.getMsg(), result);
|
return new Response<String>(ResponseEnum.FAILURE.getCode(), ResponseEnum.FAILURE.getMsg(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他的响应
|
* 其他的响应
|
||||||
*
|
*
|
||||||
* @param r 枚举常量
|
* @param r 枚举常量
|
||||||
* @param result 结果
|
* @param result 结果
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public static <T> Response<T> response(ResponseEnum r, T result) {
|
public static <T> Response<T> response(ResponseEnum r, T result) {
|
||||||
return new Response<T>(r.getCode(), r.getMsg(), result);
|
return new Response<T>(r.getCode(), r.getMsg(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ObjectMapper().writeValueAsString(this);
|
return new ObjectMapper().writeValueAsString(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : xiaohai
|
* @author : xiaohai
|
||||||
* @date : 2019/03/28 22:19
|
* @date : 2019/03/28 22:19
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class Tag extends TagCategory implements Serializable {
|
public class Tag extends TagCategory {
|
||||||
|
|
||||||
public Tag(String name) {
|
public Tag(String name) {
|
||||||
super.setName(name);
|
super.setName(name);
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 小海
|
* @Author: 小海
|
||||||
* @Date: 2020-05-24 14:03
|
* @Date: 2020-05-24 14:03
|
||||||
* @Desc:
|
* @Desc:
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class TagCategory implements Serializable {
|
public class TagCategory {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
@@ -1,54 +1,53 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.util.Date;
|
||||||
import java.util.Date;
|
|
||||||
|
/**
|
||||||
/**
|
* @author : xiaohai
|
||||||
* @author : xiaohai
|
* @date : 2019/03/28 14:52
|
||||||
* @date : 2019/03/28 14:52
|
*/
|
||||||
*/
|
@Data
|
||||||
@Data
|
@NoArgsConstructor
|
||||||
@NoArgsConstructor
|
public class User {
|
||||||
public class User implements Serializable {
|
private Long id;
|
||||||
private Long id;
|
|
||||||
|
/**
|
||||||
/**
|
* 邮箱
|
||||||
* 邮箱
|
*/
|
||||||
*/
|
private String email;
|
||||||
private String email;
|
|
||||||
|
/**
|
||||||
/**
|
* 密码
|
||||||
* 密码
|
*/
|
||||||
*/
|
@JsonIgnore
|
||||||
@JsonIgnore
|
private String pwd;
|
||||||
private String pwd;
|
|
||||||
|
/**
|
||||||
/**
|
* 昵称
|
||||||
* 昵称
|
*/
|
||||||
*/
|
private String displayName;
|
||||||
private String displayName;
|
|
||||||
|
private Boolean emailStatus = false;
|
||||||
private Boolean emailStatus = false;
|
|
||||||
|
/**
|
||||||
/**
|
* 头像地址
|
||||||
* 头像地址
|
*/
|
||||||
*/
|
private String avatarImgUrl;
|
||||||
private String avatarImgUrl;
|
|
||||||
|
private String desc;
|
||||||
private String desc;
|
|
||||||
|
private Date recentlyLandedDate;
|
||||||
private Date recentlyLandedDate;
|
|
||||||
|
private String role = "user";
|
||||||
private String role = "user";
|
|
||||||
|
private int status;
|
||||||
private int status;
|
|
||||||
|
public User(String email, String pwd) {
|
||||||
public User(String email, String pwd) {
|
this.email = email;
|
||||||
this.email = email;
|
this.pwd = pwd;
|
||||||
this.pwd = pwd;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,29 +1,28 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.util.Date;
|
||||||
import java.util.Date;
|
|
||||||
|
/**
|
||||||
/**
|
* @author : xiaohai
|
||||||
* @author : xiaohai
|
* @date : 2019/04/02 22:14
|
||||||
* @date : 2019/04/02 22:14
|
*/
|
||||||
*/
|
@Data
|
||||||
@Data
|
public class Visitor {
|
||||||
public class Visitor implements Serializable {
|
|
||||||
|
private long id;
|
||||||
private long id;
|
private String ip;
|
||||||
private String ip;
|
private Date date;
|
||||||
private Date date;
|
private String ua;
|
||||||
private String ua;
|
private boolean delete;
|
||||||
private boolean delete;
|
|
||||||
|
public Visitor(String ip, Date date, String ua) {
|
||||||
public Visitor(String ip, Date date, String ua) {
|
this.ip = ip;
|
||||||
this.ip = ip;
|
this.date = date;
|
||||||
this.date = date;
|
this.ua = ua;
|
||||||
this.ua = ua;
|
}
|
||||||
}
|
|
||||||
|
public Visitor() {
|
||||||
public Visitor() {
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,29 +1,28 @@
|
|||||||
package cn.celess.common.entity;
|
package cn.celess.blog.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.util.Date;
|
||||||
import java.util.Date;
|
|
||||||
|
/**
|
||||||
/**
|
* @author : xiaohai
|
||||||
* @author : xiaohai
|
* @date : 2019/05/12 11:29
|
||||||
* @date : 2019/05/12 11:29
|
*/
|
||||||
*/
|
@Data
|
||||||
@Data
|
public class WebUpdate {
|
||||||
public class WebUpdate implements Serializable {
|
|
||||||
|
private long id;
|
||||||
private long id;
|
|
||||||
|
private String updateInfo;
|
||||||
private String updateInfo;
|
|
||||||
|
private Date updateTime;
|
||||||
private Date updateTime;
|
|
||||||
|
private boolean delete;
|
||||||
private boolean delete;
|
|
||||||
|
public WebUpdate() {
|
||||||
public WebUpdate() {
|
}
|
||||||
}
|
|
||||||
|
public WebUpdate(String updateInfo) {
|
||||||
public WebUpdate(String updateInfo) {
|
this.updateInfo = updateInfo;
|
||||||
this.updateInfo = updateInfo;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,88 +1,87 @@
|
|||||||
package cn.celess.common.entity.vo;
|
package cn.celess.blog.entity.model;
|
||||||
|
|
||||||
import cn.celess.common.entity.Tag;
|
import cn.celess.blog.entity.Tag;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.util.List;
|
||||||
import java.util.List;
|
|
||||||
|
/**
|
||||||
/**
|
* @author : xiaohai
|
||||||
* @author : xiaohai
|
* @date : 2019/04/23 12:02
|
||||||
* @date : 2019/04/23 12:02
|
*/
|
||||||
*/
|
@Getter
|
||||||
@Getter
|
@Setter
|
||||||
@Setter
|
public class ArticleModel {
|
||||||
public class ArticleModel implements Serializable {
|
private Long id;
|
||||||
private Long id;
|
|
||||||
|
/**
|
||||||
/**
|
* 标题
|
||||||
* 标题
|
*/
|
||||||
*/
|
private String title;
|
||||||
private String title;
|
|
||||||
|
/**
|
||||||
/**
|
* 摘要
|
||||||
* 摘要
|
*/
|
||||||
*/
|
private String summary;
|
||||||
private String summary;
|
|
||||||
|
/**
|
||||||
/**
|
* Markdown正文
|
||||||
* Markdown正文
|
*/
|
||||||
*/
|
private String mdContent;
|
||||||
private String mdContent;
|
|
||||||
|
/**
|
||||||
/**
|
* 文章类型 true(1)为原创 false(0)为转载
|
||||||
* 文章类型 true(1)为原创 false(0)为转载
|
*/
|
||||||
*/
|
private Boolean original;
|
||||||
private Boolean original;
|
|
||||||
|
/**
|
||||||
/**
|
* 若为转载 则为转载文章的url
|
||||||
* 若为转载 则为转载文章的url
|
*/
|
||||||
*/
|
private String url;
|
||||||
private String url;
|
|
||||||
|
/**
|
||||||
/**
|
* 发布时间
|
||||||
* 发布时间
|
*/
|
||||||
*/
|
private String publishDateFormat;
|
||||||
private String publishDateFormat;
|
|
||||||
|
/**
|
||||||
/**
|
* 更新时间
|
||||||
* 更新时间
|
*/
|
||||||
*/
|
private String updateDateFormat;
|
||||||
private String updateDateFormat;
|
|
||||||
|
/**
|
||||||
/**
|
* 分类
|
||||||
* 分类
|
*/
|
||||||
*/
|
private String category;
|
||||||
private String category;
|
|
||||||
|
/**
|
||||||
/**
|
* 标签
|
||||||
* 标签
|
*/
|
||||||
*/
|
private List<Tag> tags;
|
||||||
private List<Tag> tags;
|
|
||||||
|
/**
|
||||||
/**
|
* 作者
|
||||||
* 作者
|
*/
|
||||||
*/
|
private UserModel author;
|
||||||
private UserModel author;
|
|
||||||
|
private ArticleModel preArticle;
|
||||||
private ArticleModel preArticle;
|
|
||||||
|
private ArticleModel nextArticle;
|
||||||
private ArticleModel nextArticle;
|
|
||||||
|
/**
|
||||||
/**
|
* 阅读数
|
||||||
* 阅读数
|
*/
|
||||||
*/
|
private Long readingNumber;
|
||||||
private Long readingNumber;
|
|
||||||
|
private Integer likeCount;
|
||||||
private Integer likeCount;
|
|
||||||
|
private Integer dislikeCount;
|
||||||
private Integer dislikeCount;
|
|
||||||
|
/**
|
||||||
/**
|
* 文章的状态 true:公开 false:不公开
|
||||||
* 文章的状态 true:公开 false:不公开
|
*/
|
||||||
*/
|
private Boolean open;
|
||||||
private Boolean open;
|
|
||||||
|
private boolean deleted;
|
||||||
private boolean deleted;
|
}
|
||||||
}
|
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package cn.celess.common.entity.vo;
|
package cn.celess.blog.entity.model;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +14,7 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CategoryModel implements Serializable {
|
public class CategoryModel {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
@@ -1,45 +1,44 @@
|
|||||||
package cn.celess.common.entity.vo;
|
package cn.celess.blog.entity.model;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.util.List;
|
||||||
import java.util.List;
|
|
||||||
|
/**
|
||||||
/**
|
* @author : xiaohai
|
||||||
* @author : xiaohai
|
* @date : 2019/04/22 21:50
|
||||||
* @date : 2019/04/22 21:50
|
*/
|
||||||
*/
|
@Setter
|
||||||
@Setter
|
@Getter
|
||||||
@Getter
|
public class CommentModel {
|
||||||
public class CommentModel implements Serializable {
|
private long id;
|
||||||
private long id;
|
|
||||||
|
private UserModel fromUser;
|
||||||
private UserModel fromUser;
|
|
||||||
|
private UserModel toUser;
|
||||||
private UserModel toUser;
|
|
||||||
|
/**
|
||||||
/**
|
* 内容
|
||||||
* 内容
|
*/
|
||||||
*/
|
private String content;
|
||||||
private String content;
|
|
||||||
|
/**
|
||||||
/**
|
* 文章标题
|
||||||
* 文章标题
|
*/
|
||||||
*/
|
private String pagePath;
|
||||||
private String pagePath;
|
|
||||||
|
/**
|
||||||
/**
|
* 发布日期
|
||||||
* 发布日期
|
*/
|
||||||
*/
|
private String date;
|
||||||
private String date;
|
|
||||||
|
/**
|
||||||
/**
|
* 评论的父ID
|
||||||
* 评论的父ID
|
*/
|
||||||
*/
|
private Long pid;
|
||||||
private Long pid;
|
|
||||||
|
private List<CommentModel> respComment;
|
||||||
private List<CommentModel> respComment;
|
|
||||||
|
private int status;
|
||||||
private int status;
|
}
|
||||||
}
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
package cn.celess.common.entity.vo;
|
package cn.celess.blog.entity.model;
|
||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,7 +15,7 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class PageData<T> implements Serializable {
|
public class PageData<T> {
|
||||||
|
|
||||||
private List<T> list;
|
private List<T> list;
|
||||||
|
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
package cn.celess.common.entity.vo;
|
package cn.celess.blog.entity.model;
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
/**
|
||||||
|
* @author : xiaohai
|
||||||
/**
|
* @date : 2019/04/21 22:43
|
||||||
* @author : xiaohai
|
*/
|
||||||
* @date : 2019/04/21 22:43
|
public class QiniuResponse {
|
||||||
*/
|
public String key;
|
||||||
public class QiniuResponse implements Serializable {
|
public String hash;
|
||||||
public String key;
|
public String bucket;
|
||||||
public String hash;
|
public long fsize;
|
||||||
public String bucket;
|
}
|
||||||
public long fsize;
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package cn.celess.common.entity.vo;
|
package cn.celess.blog.entity.model;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +14,7 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TagModel implements Serializable {
|
public class TagModel {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
@@ -1,45 +1,43 @@
|
|||||||
package cn.celess.common.entity.vo;
|
package cn.celess.blog.entity.model;
|
||||||
|
|
||||||
import cn.celess.common.constant.UserAccountStatusEnum;
|
import cn.celess.blog.enmu.UserAccountStatusEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
/**
|
||||||
|
* @author : xiaohai
|
||||||
/**
|
* @date : 2019/04/22 23:13
|
||||||
* @author : xiaohai
|
*/
|
||||||
* @date : 2019/04/22 23:13
|
@Getter
|
||||||
*/
|
@Setter
|
||||||
@Getter
|
public class UserModel {
|
||||||
@Setter
|
|
||||||
public class UserModel implements Serializable {
|
private Long id;
|
||||||
|
|
||||||
private Long id;
|
/**
|
||||||
|
* 邮箱
|
||||||
/**
|
*/
|
||||||
* 邮箱
|
private String email;
|
||||||
*/
|
|
||||||
private String email;
|
/**
|
||||||
|
* 昵称
|
||||||
/**
|
*/
|
||||||
* 昵称
|
private String displayName;
|
||||||
*/
|
|
||||||
private String displayName;
|
private Boolean emailStatus = false;
|
||||||
|
|
||||||
private Boolean emailStatus = false;
|
/**
|
||||||
|
* 头像地址
|
||||||
/**
|
*/
|
||||||
* 头像地址
|
private String avatarImgUrl;
|
||||||
*/
|
|
||||||
private String avatarImgUrl;
|
private String desc;
|
||||||
|
|
||||||
private String desc;
|
private String recentlyLandedDate;
|
||||||
|
|
||||||
private String recentlyLandedDate;
|
private String role = "user";
|
||||||
|
|
||||||
private String role = "user";
|
private String token;
|
||||||
|
|
||||||
private String token;
|
private UserAccountStatusEnum status;
|
||||||
|
}
|
||||||
private UserAccountStatusEnum status;
|
|
||||||
}
|
|
||||||
@@ -1,26 +1,24 @@
|
|||||||
package cn.celess.common.entity.vo;
|
package cn.celess.blog.entity.model;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
/**
|
||||||
|
* @author : xiaohai
|
||||||
/**
|
* @date : 2019/05/05 16:05
|
||||||
* @author : xiaohai
|
*/
|
||||||
* @date : 2019/05/05 16:05
|
@Data
|
||||||
*/
|
public class VisitorModel {
|
||||||
@Data
|
private long id;
|
||||||
public class VisitorModel implements Serializable {
|
|
||||||
private long id;
|
private String ip;
|
||||||
|
|
||||||
private String ip;
|
private String date;
|
||||||
|
|
||||||
private String date;
|
private String browserName;
|
||||||
|
|
||||||
private String browserName;
|
private String browserVersion;
|
||||||
|
|
||||||
private String browserVersion;
|
private String OSName;
|
||||||
|
|
||||||
private String OSName;
|
private String location;
|
||||||
|
}
|
||||||
private String location;
|
|
||||||
}
|
|
||||||
@@ -1,28 +1,26 @@
|
|||||||
package cn.celess.common.entity.vo;
|
package cn.celess.blog.entity.model;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
/**
|
||||||
|
* @author : xiaohai
|
||||||
/**
|
* @date : 2019/05/12 11:32
|
||||||
* @author : xiaohai
|
*/
|
||||||
* @date : 2019/05/12 11:32
|
@Data
|
||||||
*/
|
@NoArgsConstructor
|
||||||
@Data
|
public class WebUpdateModel {
|
||||||
@NoArgsConstructor
|
private long id;
|
||||||
public class WebUpdateModel implements Serializable {
|
|
||||||
private long id;
|
private String info;
|
||||||
|
|
||||||
private String info;
|
private String time;
|
||||||
|
|
||||||
private String time;
|
public WebUpdateModel(long id, String info, String time) {
|
||||||
|
this.id = id;
|
||||||
public WebUpdateModel(long id, String info, String time) {
|
this.info = info;
|
||||||
this.id = id;
|
this.time = time;
|
||||||
this.info = info;
|
}
|
||||||
this.time = time;
|
|
||||||
}
|
private boolean deleted;
|
||||||
|
}
|
||||||
private boolean deleted;
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user