From 4585c824b79c7ca1f5b0a8bc1f79f3be653e6355 Mon Sep 17 00:00:00 2001 From: zk Date: Fri, 10 Jul 2026 11:44:17 +0800 Subject: [PATCH] =?UTF-8?q?admin=20=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/pom.xml | 54 +++++++++++++ .../java/org/jiayunet/AdminApplication.java | 22 ++++++ .../admin/controller/PageController.java | 27 +++++++ admin/src/main/resources/application-dev.yml | 67 ++++++++++++++++ admin/src/main/resources/application-prod.yml | 64 +++++++++++++++ admin/src/main/resources/application-test.yml | 64 +++++++++++++++ admin/src/main/resources/application.yml | 77 +++++++++++++++++++ admin/src/main/resources/static/.gitkeep | 0 admin/src/main/resources/templates/index.html | 12 +++ admin/src/main/resources/templates/login.html | 12 +++ pom.xml | 1 + 11 files changed, 400 insertions(+) create mode 100644 admin/pom.xml create mode 100644 admin/src/main/java/org/jiayunet/AdminApplication.java create mode 100644 admin/src/main/java/org/jiayunet/admin/controller/PageController.java create mode 100644 admin/src/main/resources/application-dev.yml create mode 100644 admin/src/main/resources/application-prod.yml create mode 100644 admin/src/main/resources/application-test.yml create mode 100644 admin/src/main/resources/application.yml create mode 100644 admin/src/main/resources/static/.gitkeep create mode 100644 admin/src/main/resources/templates/index.html create mode 100644 admin/src/main/resources/templates/login.html diff --git a/admin/pom.xml b/admin/pom.xml new file mode 100644 index 0000000..0559700 --- /dev/null +++ b/admin/pom.xml @@ -0,0 +1,54 @@ + + 4.0.0 + + org.jiayunet + back_end + 1.0-SNAPSHOT + + + admin + 1.0-SNAPSHOT + + + + org.jiayunet + manager + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + + admin + + + org.apache.maven.plugins + maven-compiler-plugin + + 17 + 17 + + + + org.springframework.boot + spring-boot-maven-plugin + 2.6.13 + + true + + + + + repackage + + + + + + + + diff --git a/admin/src/main/java/org/jiayunet/AdminApplication.java b/admin/src/main/java/org/jiayunet/AdminApplication.java new file mode 100644 index 0000000..2007315 --- /dev/null +++ b/admin/src/main/java/org/jiayunet/AdminApplication.java @@ -0,0 +1,22 @@ +package org.jiayunet; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.scheduling.annotation.EnableScheduling; + +/** + * B 端管理后台启动类 + * + * @author zk + */ +@SpringBootApplication(scanBasePackages = "org.jiayunet") +@MapperScan("org.jiayunet.**.mapper") +@EnableScheduling +@EnableAspectJAutoProxy +public class AdminApplication { + public static void main(String[] args) { + SpringApplication.run(AdminApplication.class, args); + } +} diff --git a/admin/src/main/java/org/jiayunet/admin/controller/PageController.java b/admin/src/main/java/org/jiayunet/admin/controller/PageController.java new file mode 100644 index 0000000..245aebf --- /dev/null +++ b/admin/src/main/java/org/jiayunet/admin/controller/PageController.java @@ -0,0 +1,27 @@ +package org.jiayunet.admin.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * 页面路由控制器(返回 Thymeleaf 视图名,不走 UnifiedResponseBodyAdvice) + * + * @author zk + */ +@Controller +@RequestMapping("/page") +public class PageController { + + /** 登录页 */ + @GetMapping("/login") + public String login() { + return "login"; + } + + /** 管理后台首页(需登录) */ + @GetMapping("/index") + public String index() { + return "index"; + } +} diff --git a/admin/src/main/resources/application-dev.yml b/admin/src/main/resources/application-dev.yml new file mode 100644 index 0000000..adccec3 --- /dev/null +++ b/admin/src/main/resources/application-dev.yml @@ -0,0 +1,67 @@ +# tomcat 端口配置 +server: + port: 8081 +# 数据源配置 +spring: + datasource: + url: jdbc:mysql://${MYSQL_HOST:192.168.31.105}:${MYSQL_PORT:3306}/${DB_NAME:offerpie}?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true + username: ${MYSQL_USERNAME:root} + password: ${MYSQL_PASSWORD:123456} + driver-class-name: com.mysql.cj.jdbc.Driver + redis: + host: ${REDIS_HOST:192.168.31.105} + password: ${REDIS_PASSWORD:123456} + port: ${REDIS_PORT:6379} + timeout: 8s + database: 0 + # 开发环境关闭模板缓存,方便调试 + thymeleaf: + cache: false + +# 电子邮箱 +email: + status: close + account: ${EMAIL_ACCOUNT:xxx@163.com} + authorization: ${EMAIL_AUTHORIZATION:123456} + +# 微信支付 +wx_pay: + status: close + +# 支付宝支付 +alipay: + status: close + +app: + # 加密秘钥配置 + secret: + token: ${SECRET_TOKEN:Aa123123} + + # 登陆配置 + login: + token: + exceed_time: 5184000 + device_online_quantity: 3 + + # 短信 + sms: + service_provider: aliyun + aliyun: + access_key_id: LTAI5tJBVUUJhB7yp14UDzVf + access_key_secret: Opf0iO5FKNrdwI63DPhXazW7utAGTj + + oss: + service_provider: aliyun + aliyun: + access_key_id: LTAI5tEdLKKQUKhTyUpfH5Mk + access_key_secret: RjUdTrq0V5qA4b3BUElNhXqs3ZLp5k + + # 防刷配置 + prevent_replay: + if_open: false + interval_time: 20 + limit_number: 20 + + # 开放接口(登录页面 + 静态资源 + 登录接口) + ignore: + urls: "/public/**,/page/**,/static/**,/css/**,/js/**,/img/**,/favicon.ico" diff --git a/admin/src/main/resources/application-prod.yml b/admin/src/main/resources/application-prod.yml new file mode 100644 index 0000000..a481237 --- /dev/null +++ b/admin/src/main/resources/application-prod.yml @@ -0,0 +1,64 @@ +# tomcat 端口配置 +server: + port: 8081 +# 数据源配置 +spring: + datasource: + url: jdbc:mysql://${MYSQL_HOST:8.163.14.142}:${MYSQL_PORT:30006}/${DB_NAME:offerpie}?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true + username: ${MYSQL_USERNAME:root} + password: ${MYSQL_PASSWORD:^CgDatabase2020} + driver-class-name: com.mysql.cj.jdbc.Driver + redis: + host: ${REDIS_HOST:8.163.14.142} + password: ${REDIS_PASSWORD:#8kPCdAsser} + port: ${REDIS_PORT:30089} + timeout: 10s + database: 0 + +# 电子邮箱 +email: + status: close + account: ${EMAIL_ACCOUNT:xxx@163.com} + authorization: ${EMAIL_AUTHORIZATION:123456} + +# 微信支付 +wx_pay: + status: close + +# 支付宝支付 +alipay: + status: close + +app: + # 加密秘钥配置 + secret: + token: ${SECRET_TOKEN:Aa123123} + + # 登陆配置 + login: + token: + exceed_time: 5184000 + device_online_quantity: 3 + + # 短信 + sms: + service_provider: aliyun + aliyun: + access_key_id: LTAI5tJBVUUJhB7yp14UDzVf + access_key_secret: Opf0iO5FKNrdwI63DPhXazW7utAGTj + + oss: + service_provider: aliyun + aliyun: + access_key_id: LTAI5tEdLKKQUKhTyUpfH5Mk + access_key_secret: RjUdTrq0V5qA4b3BUElNhXqs3ZLp5k + + # 防刷配置 + prevent_replay: + if_open: false + interval_time: 20 + limit_number: 20 + + # 开放接口 + ignore: + urls: "/public/**,/page/**,/static/**,/css/**,/js/**,/img/**,/favicon.ico" diff --git a/admin/src/main/resources/application-test.yml b/admin/src/main/resources/application-test.yml new file mode 100644 index 0000000..e5c1344 --- /dev/null +++ b/admin/src/main/resources/application-test.yml @@ -0,0 +1,64 @@ +# tomcat 端口配置 +server: + port: 8081 +# 数据源配置 +spring: + datasource: + url: jdbc:mysql://${MYSQL_HOST:8.163.14.142}:${MYSQL_PORT:30006}/${DB_NAME:offerpie_test}?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true + username: ${MYSQL_USERNAME:root} + password: ${MYSQL_PASSWORD:^CgDatabase2020} + driver-class-name: com.mysql.cj.jdbc.Driver + redis: + host: ${REDIS_HOST:8.163.14.142} + password: ${REDIS_PASSWORD:#8kPCdAsser} + port: ${REDIS_PORT:30089} + timeout: 10s + database: 1 + +# 电子邮箱 +email: + status: close + account: ${EMAIL_ACCOUNT:xxx@163.com} + authorization: ${EMAIL_AUTHORIZATION:123456} + +# 微信支付 +wx_pay: + status: close + +# 支付宝支付 +alipay: + status: close + +app: + # 加密秘钥配置 + secret: + token: ${SECRET_TOKEN:Aa123123} + + # 登陆配置 + login: + token: + exceed_time: 5184000 + device_online_quantity: 3 + + # 短信 + sms: + service_provider: aliyun + aliyun: + access_key_id: LTAI5tJBVUUJhB7yp14UDzVf + access_key_secret: Opf0iO5FKNrdwI63DPhXazW7utAGTj + + oss: + service_provider: aliyun + aliyun: + access_key_id: LTAI5tEdLKKQUKhTyUpfH5Mk + access_key_secret: RjUdTrq0V5qA4b3BUElNhXqs3ZLp5k + + # 防刷配置 + prevent_replay: + if_open: false + interval_time: 20 + limit_number: 20 + + # 开放接口 + ignore: + urls: "/public/**,/page/**,/static/**,/css/**,/js/**,/img/**,/favicon.ico" diff --git a/admin/src/main/resources/application.yml b/admin/src/main/resources/application.yml new file mode 100644 index 0000000..2f0946d --- /dev/null +++ b/admin/src/main/resources/application.yml @@ -0,0 +1,77 @@ +# tomcat config +server: + tomcat: + accept-count: 100 + threads: + max: 200 + min-spare: 10 + servlet: + context-path: /admin +# spring config +spring: + application: + name: admin + profiles: + active: ${PROFILES_ACTIVE:dev} + datasource: + hikari: + maximum-pool-size: 50 + minimum-idle: 20 + connection-timeout: 5000 + idle-timeout: 300000 + max-lifetime: 900000 + servlet: + multipart: + max-file-size: 4MB + max-request-size: 20MB + # Thymeleaf 配置 + thymeleaf: + prefix: classpath:/templates/ + suffix: .html + mode: HTML + encoding: UTF-8 + # 开启静态资源映射 + web: + resources: + add-mappings: true + static-locations: classpath:/static/ + cache: + redis: + cache-null-values: true + key-prefix: "${spring.application.name}:" + time-to-live: 24h + jackson: + default-property-inclusion: non_null + property-naming-strategy: LOWER_CAMEL_CASE + serialization: + fail-on-empty-beans: false + write-date-keys-as-timestamps: true + write-date-timestamps-as-nanoseconds: false + write-dates-as-timestamps: true + deserialization: + fail-on-unknown-properties: false + fail-on-numbers-for-enums: true + read-date-timestamps-as-nanoseconds: false +# mybatis plus config +mybatis-plus: + mapper-locations: classpath*:mapper/**/*.xml + global-config: + db-config: + id-type: assign_id + insert-strategy: not_null + update-strategy: not_null + logic-delete-field: isDelete + logic-delete-value: '1' + logic-not-delete-value: '0' + configuration: + map-underscore-to-camel-case: true + auto-mapping-unknown-column-behavior: warning + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +# 日志 +logging: + level: + org: + mybatis: info diff --git a/admin/src/main/resources/static/.gitkeep b/admin/src/main/resources/static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/admin/src/main/resources/templates/index.html b/admin/src/main/resources/templates/index.html new file mode 100644 index 0000000..e0a32ac --- /dev/null +++ b/admin/src/main/resources/templates/index.html @@ -0,0 +1,12 @@ + + + + + + OfferPie 管理后台 + + +

OfferPie 管理后台 - 首页

+

管理后台首页占位 - 待实现

+ + diff --git a/admin/src/main/resources/templates/login.html b/admin/src/main/resources/templates/login.html new file mode 100644 index 0000000..d58ffa5 --- /dev/null +++ b/admin/src/main/resources/templates/login.html @@ -0,0 +1,12 @@ + + + + + + OfferPie 管理后台 - 登录 + + +

OfferPie 管理后台

+

登录页面占位 - 待实现

+ + diff --git a/pom.xml b/pom.xml index c09b070..23ee757 100644 --- a/pom.xml +++ b/pom.xml @@ -14,6 +14,7 @@ common client-api manager + admin