Pre Merge pull request !420 from dianwp/dev
This commit is contained in:
commit
31b1687084
@ -1,3 +1,4 @@
|
||||
## 平台的简介
|
||||
<p align="center">
|
||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
|
||||
</p>
|
||||
|
@ -1,30 +1,55 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
}
|
||||
package com.ruoyi;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
//private static final Log logger = LogFactory.getLog(MethodHandles.lookup().lookupClass());
|
||||
private static final Logger syslog = LoggerFactory.getLogger(RuoYiApplication.class);
|
||||
public static void main(String[] args)
|
||||
{
|
||||
System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
ApplicationContext appc = SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
|
||||
// 打印应用启动环境信息
|
||||
Environment env = appc.getEnvironment();
|
||||
String ip = "localhost";
|
||||
try {
|
||||
ip = InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
syslog.info("\n----------------------------------------------------------\n\t" +
|
||||
"Application '{}' is running! Access URLs:\n\t" +
|
||||
"Local: \t\thttp://{}:{}\n\t" +
|
||||
"----------------------------------------------------------",
|
||||
env.getProperty("spring.profiles.active"),ip,
|
||||
env.getProperty("server.port"));
|
||||
syslog.info("程序启动完成!");
|
||||
}
|
||||
}
|
||||
|
133
ruoyi-admin/src/main/java/com/ruoyi/common/utils/ShopAuth.java
Normal file
133
ruoyi-admin/src/main/java/com/ruoyi/common/utils/ShopAuth.java
Normal file
@ -0,0 +1,133 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.text.CharsetKit;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* @author libiao
|
||||
* @version 1.0
|
||||
* @Description: 虾皮2.0授权工具类
|
||||
* @date 2021/10/24 21:12
|
||||
**/
|
||||
public class ShopAuth {
|
||||
public static final String AUTH_SIGN_METHOD = "HmacSHA256";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 虾皮测试环境
|
||||
String host = "https://partner.test-stable.shopeemobile.com";
|
||||
String path = "/api/v2/shop/auth_partner";
|
||||
//TODO 回跳到花生壳内网地址(转发到8080端口),需要补充URI
|
||||
String redirect_url = "http://4v4c570155.zicp.vip:47393/swagger-ui/index.html";
|
||||
// edterp 的 测试 Partner
|
||||
long partner_id = 1002192L;
|
||||
String partner_key = "8e8618dbb99923b4b298517d263b0b45df02a2ef8341d512539bdbacc76b0bb1";
|
||||
String authUrl = calculateShopAuthUrl(host, path, redirect_url, partner_id, partner_key);
|
||||
System.out.println(authUrl);
|
||||
|
||||
getTokenShopLevel("code123",partner_id,partner_key,"");
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 虾皮店铺授权链接生成
|
||||
* 1.拼接基础字符串,api path + partner_id + api path + timestamp
|
||||
* 2.基于基础字符串计算签名
|
||||
* @Author: libiao
|
||||
* @Date: 2021/10/24 21:56
|
||||
* @param host: 虾皮地址
|
||||
* @param path: 虾皮授权接口路径(授权:"/api/v2/shop/auth_partner",取消授权:"/api/v2/shop/cancel_auth_partner")
|
||||
* @param redirect_url: 授权成功后跳转地址,ERP的地址
|
||||
* @param partner_id: 开发者账号id
|
||||
* @param partner_key: 开发者账号key
|
||||
* @return: java.lang.String 授权链接
|
||||
**/
|
||||
public static String calculateShopAuthUrl(String host, String path, String redirect_url, long partner_id, String partner_key) {
|
||||
long timestamp = System.currentTimeMillis() / 1000L;
|
||||
String tmp_base_string = String.format("%s%s%s", partner_id, path, timestamp);
|
||||
byte[] partner_key_bytes;
|
||||
byte[] base_string_bytes;
|
||||
// 计算加密签名
|
||||
BigInteger sign = null;
|
||||
String sign_str = "";
|
||||
try {
|
||||
partner_key_bytes = partner_key.getBytes(CharsetKit.CHARSET_UTF_8);
|
||||
base_string_bytes = tmp_base_string.getBytes(CharsetKit.CHARSET_UTF_8);
|
||||
Mac mac = Mac.getInstance("HmacSHA256"); //"HmacSHA256"
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(partner_key_bytes, "HmacSHA256");
|
||||
mac.init(secretKeySpec);
|
||||
//sign = new BigInteger(mac.doFinal(base_string_bytes));
|
||||
byte[] sign_bytes = mac.doFinal(base_string_bytes);
|
||||
sign_str = byteArrayToHexString(sign_bytes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 拼接授权url
|
||||
//String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%032x&redirect=%s", partner_id, timestamp, sign, redirect_url);
|
||||
String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%s&redirect=%s", partner_id, timestamp, sign_str, redirect_url);
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 获取店铺级别接口鉴权access_token refresh_token
|
||||
* @Author: libiao
|
||||
* @Date: 2021/11/3 21:16
|
||||
* @param code: 店铺授权成功后返回的
|
||||
* @param partner_id: 开发者账号id
|
||||
* @param partner_key: 开发者账号key
|
||||
* @param shop_id: 店铺id(店铺授权成功后也会返回)
|
||||
* @return: void
|
||||
**/
|
||||
public static void getTokenShopLevel(String code, long partner_id, String partner_key, String shop_id){
|
||||
long timestamp = System.currentTimeMillis()/1000L;
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("code",code);
|
||||
body.put("shop_id",shop_id);
|
||||
body.put("partner_id", partner_id);
|
||||
|
||||
//String host = "https://partner.shopeemobile.com/api/v2/auth/token/get";
|
||||
String host = "https://partner.test-stable.shopeemobile.com";
|
||||
String path = "/api/v2/auth/token/get";
|
||||
String tmp_base_string = String.format("%s%s%s",partner_id,path,timestamp);
|
||||
|
||||
byte[] partner_key_bytes;
|
||||
byte[] base_string_bytes;
|
||||
|
||||
String sign = null;
|
||||
try {
|
||||
partner_key_bytes = partner_key.getBytes("UTF-8");
|
||||
base_string_bytes = tmp_base_string.getBytes("UTF-8");
|
||||
Mac mac = Mac.getInstance(AUTH_SIGN_METHOD); //"HmacSHA256"
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(partner_key_bytes,AUTH_SIGN_METHOD);
|
||||
mac.init(secretKeySpec);
|
||||
byte[] sign_bytes = mac.doFinal(base_string_bytes);
|
||||
sign = byteArrayToHexString(sign_bytes);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 拼接授权url
|
||||
String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%s",partner_id,timestamp,sign);
|
||||
// TODO http请求获取access_token和refresh_token
|
||||
System.out.println(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将加密后的字节数组转换成字符串
|
||||
*
|
||||
* @param b 字节数组
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String byteArrayToHexString(byte[] b) {
|
||||
StringBuilder hs = new StringBuilder();
|
||||
String stmp;
|
||||
for (int n = 0; b!=null && n < b.length; n++) {
|
||||
stmp = Integer.toHexString(b[n] & 0XFF);
|
||||
if (stmp.length() == 1)
|
||||
hs.append('0');
|
||||
hs.append(stmp);
|
||||
}
|
||||
return hs.toString().toLowerCase();
|
||||
}
|
||||
}
|
85
ruoyi-admin/src/main/java/com/ruoyi/common/utils/Test.java
Normal file
85
ruoyi-admin/src/main/java/com/ruoyi/common/utils/Test.java
Normal file
@ -0,0 +1,85 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import com.ruoyi.common.core.text.CharsetKit;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* @author libiao
|
||||
* @version 1.0
|
||||
* @Description: TODO
|
||||
* @date 2021/11/3 21:48
|
||||
**/
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
// 虾皮测试环境
|
||||
String host = "https://partner.test-stable.shopeemobile.com";
|
||||
String path = "/api/v2/shop/auth_partner";
|
||||
//TODO 回跳到花生壳内网地址(转发到8080端口),需要补充URI
|
||||
String redirect_url = "http://4v4c570155.zicp.vip:47393";
|
||||
// edterp 的 测试 Partner
|
||||
long partner_id = 1002192;
|
||||
String partner_key = "8e8618dbb99923b4b298517d263b0b45df02a2ef8341d512539bdbacc76b0bb1";
|
||||
String authUrl = calculateShopAuthUrl(host, path, redirect_url, partner_id, partner_key);
|
||||
System.out.println(authUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 虾皮店铺授权链接生成
|
||||
* 1.拼接基础字符串,api path + partner_id + api path + timestamp
|
||||
* 2.基于基础字符串计算签名
|
||||
* @Author: libiao
|
||||
* @Date: 2021/10/24 21:56
|
||||
* @param host: 虾皮地址
|
||||
* @param path: 虾皮授权接口路径(授权:"/api/v2/shop/auth_partner",取消授权:"/api/v2/shop/cancel_auth_partner")
|
||||
* @param redirect_url: 授权成功后跳转地址
|
||||
* @param partner_id: 开发者账号id
|
||||
* @param partner_key: 开发者账号key
|
||||
* @return: java.lang.String 授权链接
|
||||
**/
|
||||
public static String calculateShopAuthUrl(String host, String path, String redirect_url, long partner_id, String partner_key) {
|
||||
long timestamp = System.currentTimeMillis() / 1000L;
|
||||
String tmp_base_string = String.format("%s%s%s", partner_id, path, timestamp);
|
||||
byte[] partner_key_bytes;
|
||||
byte[] base_string_bytes;
|
||||
// 计算加密签名
|
||||
BigInteger sign = null;
|
||||
String sign_str = "";
|
||||
try {
|
||||
partner_key_bytes = partner_key.getBytes(CharsetKit.CHARSET_UTF_8);
|
||||
base_string_bytes = tmp_base_string.getBytes(CharsetKit.CHARSET_UTF_8);
|
||||
Mac mac = Mac.getInstance("HmacSHA256"); //"HmacSHA256"
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(partner_key_bytes, "HmacSHA256");
|
||||
mac.init(secretKeySpec);
|
||||
//sign = new BigInteger(mac.doFinal(base_string_bytes));
|
||||
byte[] sign_bytes = mac.doFinal(base_string_bytes);
|
||||
sign_str = byteArrayToHexString(sign_bytes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 拼接授权url
|
||||
//String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%032x&redirect=%s", partner_id, timestamp, sign, redirect_url);
|
||||
String url = host + path + String.format("?partner_id=%s×tamp=%s&sign=%s&redirect=%s", partner_id, timestamp, sign_str, redirect_url);
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将加密后的字节数组转换成字符串
|
||||
*
|
||||
* @param b 字节数组
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String byteArrayToHexString(byte[] b) {
|
||||
StringBuilder hs = new StringBuilder();
|
||||
String stmp;
|
||||
for (int n = 0; b!=null && n < b.length; n++) {
|
||||
stmp = Integer.toHexString(b[n] & 0XFF);
|
||||
if (stmp.length() == 1)
|
||||
hs.append('0');
|
||||
hs.append(stmp);
|
||||
}
|
||||
return hs.toString().toLowerCase();
|
||||
}
|
||||
}
|
@ -1,57 +1,57 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: password
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/shopee_erp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: shopee_erp
|
||||
password: shopee_erp123
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
20
ruoyi-admin/src/main/resources/application-shopee.yml
Normal file
20
ruoyi-admin/src/main/resources/application-shopee.yml
Normal file
@ -0,0 +1,20 @@
|
||||
shopee:
|
||||
partnerID: 845774
|
||||
secrret: ea6e399abcBb69eacbeBfe38bc89a9ef35Za8Ze48a92535211c2Ъ92e18Ba52d
|
||||
#回跳到系统
|
||||
redirectURL: http://www.edterp.com/shop/shop
|
||||
#shopee 认证
|
||||
authpartner_url: https://partner.shopeemobile.com/api/v1/shop/auth partner
|
||||
#
|
||||
cancel_auth_partner_url: https://partner.shopeemobile.com/api/v1/shop/cancel_auth_partner
|
||||
#shopee 消息推送到系统
|
||||
msgPushUrl: http://www.edterp.com/dev-dpi/orders/shop/verfiyPushMsg
|
||||
#shopee
|
||||
shopInfoApiUrl: https://partner.shopeemobile.com/api/v1/shop/get
|
||||
ordersApiUrl: https://partner.shopeemobile.com/api/v1/orders/basics
|
||||
#
|
||||
orderDetailApiUrl:https://partner.shopeemobile.com/api/v1/orders/detail
|
||||
#
|
||||
orderDetailUariationspiUrl1: https://partner.shopeemobile.com/api/v1/item/tier_var/get
|
||||
socketHost: 172.19.92.42
|
||||
socketPort: 10000
|
@ -1,93 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/home/ruoyi/logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="./logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
</configuration>
|
Loading…
x
Reference in New Issue
Block a user