2018-03-30 20:20
Service层里业务需要手动调取:
ApiConfigKit.setThreadLocalAppId(appId); 手动绑定到当前线程
AccessTokenApi.getAccessTokenStr() 返回值
ApiConfigKit.removeThreadLocalAppId();手动释放
通过URL API控制器调取:
只要@Before(ApiInterceptor.class 就能自动根据URL挂参appId(默认可修改)=xxx
Controller 自动绑定 ApiConfig 对象到当前线程, 和释放
所以后面代码能直接调用 AccessTokenApi.getAccessTokenStr()
2018-03-23 22:19
默认JFinalJson工具转 model 时 是不支持自定义属性的,
if (value instanceof Model) {
Map map = com.jfinal.plugin.activerecord.CPI.getAttrs((Model)value);
return mapToJson(map, depth);
}
if (value instanceof Record) {
Map map = ((Record)value).getColumns();
return mapToJson(map, depth);
}
/** com.jfinal.plugin.activerecord.CPI.getAttrs
* Return the attributes map of the model
* @param model the model extends from class Model
* @return the attributes map of the model
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public static final Map<String, Object> getAttrs(Model model) {
return model._getAttrs();
}
public class Node extends BaseNode<Node> {
public String getDeviceChannel() {
return get("deviceChannel");
}
public void setDeviceChannel(String deviceChannel) {
put("deviceChannel ", deviceChannel)
}
}
2018-03-22 21:41
@AndrewTseng 分享的一个小玩意 JFinal使用技巧-Enjoy导出XLS
2018-03-21 22:37
不贴代码 .. 能猜出来才怪.... 提问题时还是需要站在别人的角度看下吧 ..
我猜有可能是你 tomcat 配的有问题 :
JFinal 部署在 Tomcat 下推荐方法
"记住第一点,永远不要将项目放在 TOMCAT_HOME/webapps 目录下面"