20173 月23
1、wx_config 实体类添加三个字段,对应的表结构也要手动修改:
@Column
@Comment("access_token")
@ColDefine(type = ColType.VARCHAR, width = 255)
private String access_token;
@Column
@Comment("access_token_expires")
@ColDefine(type = ColType.INT)
private Integer access_token_expires;
@Column
@Comment("access_token_lastat")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String access_token_lastat;
get set ...方法生成出来
2、nutzwx版本升级为1.r.61-SNAPSHOT
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutzwx</artifactId>
<version>1.r.61-SNAPSHOT</version>
</dependency>
3、nutz版本升级为1.r.60
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz</artifactId>
<version>1.r.60</version>
</dependency>
4、WxConfigService 类getWxApi2替换为如下代码(主要是DaoAccessTokenStore从数据库取access_token)
public WxApi2 getWxApi2(String wxid) {
Wx_config appInfo = this.fetch(Cnd.where("id", "=", wxid));
DaoAccessTokenStore myDaoAccessTokenStore = new DaoAccessTokenStore(dao());
Map<String, Object> params = new HashMap<>();
params.put("id", appInfo.getId());
myDaoAccessTokenStore.setTableAccessToken("access_token");
myDaoAccessTokenStore.setTableAccessTokenExpires("access_token_expires");
myDaoAccessTokenStore.setTableAccessTokenLastat("access_token_lastat");
myDaoAccessTokenStore.setFetch("select access_token,access_token_expires,access_token_lastat from wx_config where id=@id");
myDaoAccessTokenStore.setUpdate("update wx_config set access_token=@access_token, access_token_expires=@access_token_expires, access_token_lastat=@access_token_lastat where id=@id");
myDaoAccessTokenStore.setParams(params);
WxApi2Impl wxApi2 = new WxApi2Impl();
wxApi2.setAppid(appInfo.getAppid());
wxApi2.setAppsecret(appInfo.getAppsecret());
wxApi2.setEncodingAesKey(appInfo.getEncodingAESKey());
wxApi2.setToken(appInfo.getToken());
wxApi2.setAccessTokenStore(myDaoAccessTokenStore);
return wxApi2;
}
20173 月17
pom.xml
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.logback-extensions</groupId>
<artifactId>logback-ext-spring</artifactId>
<version>0.1.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
排除其他包的log4j引用,特别是dubbo的、shiro的
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.8.4</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>1.3.2</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.3.2</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<!-- For assistance related to logback-translator or configuration -->
<!-- files in general, please contact the logback user mailing list -->
<!-- at http://www.qos.ch/mailman/listinfo/logback-user -->
<!-- -->
<!-- For professional support please see -->
<!-- http://www.qos.ch/shop/products/professionalSupport -->
<!-- -->
<configuration>
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<file>/monitor.log</file>
<!-- Policy定义如何滚动,按文件大小滚动生成日志 -->
<!-- 如果是按文件大小滚动生成日志,前面的file标签可省略,而使用fileNamePattern标签定义的名字 -->
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>/monitor.%i.log.gz
</fileNamePattern>
<!-- 归档日志的下标,替换fileNamePattern的%i,最多3个归档文件 -->
<minIndex>1</minIndex>
<maxIndex>5</maxIndex>
</rollingPolicy>
<!-- triggeringPolicy定义什么时候滚动,下面是定义了文件大小超过100M的时候产生归档文件 -->
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>300MB</maxFileSize>
</triggeringPolicy>
<!-- append是否接着上次写文件结尾继续写,默认为true -->
<append>true</append>
<encoding>GBK</encoding>
<!-- layout,定义格式 -->
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>[%-5level] %d{HH:mm:ss.SSS} [%thread] %logger %caller{2} - %msg%n</pattern>
</layout>
</appender>
<logger name="org.springframework" level="info"/>
<logger name="org.nutz.dao" level="debug"/>
<logger name="net.sf.ehcache" level="info"/>
<logger name="druid.sql" level="info"/>
<logger name="com.alibaba.druid" level="info"/>
<logger name="org.apache.shiro" level="info"/>
<logger name="org.quartz" level="info"/>
<root level="debug">
<appender-ref ref="Console"/>
</root>
</configuration>
20173 月8
“医生,你得救救我们啊,我们在一起三年了都没有怀孕,父母还等着抱孙子呢!”医生:“这我也没办法啊,这都是你们自己的问题。”“不行啊,医生你帮帮我们吧。”医生:“首先,你们得各自找个女朋友。”