.
This commit is contained in:
@@ -15,10 +15,7 @@ public class BaseService implements Service {
|
||||
|
||||
protected final int sessionExpireSeconds = 7 * 24 * 60 * 60;
|
||||
|
||||
protected final static RetResult RET_SUCCESS = RetResult.success();
|
||||
|
||||
/*@Resource(name = "SERVER_ROOT")
|
||||
protected File webroot;*/
|
||||
protected static final RetResult RET_SUCCESS = RetResult.success();
|
||||
|
||||
@Resource(name = "redbbs")
|
||||
protected DataSource dataSource;
|
||||
|
@@ -8,10 +8,12 @@ import net.tccn.bbs.content.ContentService;
|
||||
import net.tccn.bbs.user.UserInfo;
|
||||
import net.tccn.bbs.user.UserService;
|
||||
import net.tccn.bbs.vislog.entity.VisLog;
|
||||
import org.redkale.net.http.*;
|
||||
import org.redkale.net.http.HttpRequest;
|
||||
import org.redkale.net.http.HttpResponse;
|
||||
import org.redkale.net.http.HttpScope;
|
||||
import org.redkale.net.http.HttpServlet;
|
||||
import org.redkale.source.FilterExpress;
|
||||
import org.redkale.source.FilterNode;
|
||||
import org.redkale.util.AnyValue;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
@@ -42,22 +44,12 @@ public class BaseServlet extends HttpServlet {
|
||||
@Resource
|
||||
protected TaskQueue<VisLog> logQueue;
|
||||
|
||||
@Override
|
||||
public void init(HttpContext context, AnyValue config) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preExecute(HttpRequest request, HttpResponse response) throws IOException {
|
||||
/*if (true){
|
||||
response.finish(HttpScope.refer("404.html"));
|
||||
return;
|
||||
}*/
|
||||
|
||||
String sessionid = request.getSessionid(true);
|
||||
int currentid = 0;
|
||||
if (sessionid != null) {
|
||||
request.setCurrentUser(userService.current(sessionid));
|
||||
currentid = userService.currentUserid(sessionid);
|
||||
request.setCurrentUserid(currentid);
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import com.jfinal.template.Engine;
|
||||
import com.jfinal.template.Template;
|
||||
import net.tccn.bbs.base.util.EJ;
|
||||
import net.tccn.bbs.user.UserInfo;
|
||||
import net.tccn.bbs.user.UserService;
|
||||
import org.redkale.convert.Convert;
|
||||
import org.redkale.net.http.*;
|
||||
import org.redkale.util.AnyValue;
|
||||
@@ -21,6 +22,9 @@ public class TplRender implements HttpRender<HttpScope> {
|
||||
@Resource(name = "SERVER_ROOT")
|
||||
protected File webroot;
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
private static final Engine engine = new Engine();
|
||||
|
||||
@Override
|
||||
@@ -33,12 +37,16 @@ public class TplRender implements HttpRender<HttpScope> {
|
||||
|
||||
@Override
|
||||
public void renderTo(HttpRequest request, HttpResponse response, Convert convert, HttpScope scope) {
|
||||
UserInfo mine = request.currentUser();//当前登录人
|
||||
//UserInfo mine = request.currentUser();//当前登录人
|
||||
|
||||
Template template = engine.getTemplate(scope.getReferid());
|
||||
Map attr = scope.getAttributes();
|
||||
if (attr == null) attr = Kv.create();
|
||||
attr.put("mine", mine);
|
||||
if (attr == null) {
|
||||
attr = Kv.create();
|
||||
}
|
||||
|
||||
UserInfo userInfo = userService.find(request.currentUserid(int.class));
|
||||
attr.put("mine", userInfo);
|
||||
attr.put("token", request.getSessionid(false));
|
||||
|
||||
String str = template.renderToString(attr);
|
||||
|
@@ -169,7 +169,6 @@ public final class Utils {
|
||||
Kv row = Kv.of();
|
||||
for (int i = 1; i <= count; i++) {
|
||||
String columnTypeName = metaData.getColumnTypeName(i);
|
||||
//String columnName = metaData.getColumnName(i);
|
||||
String columnLabel = metaData.getColumnLabel(i);
|
||||
row.put(columnLabel, null);
|
||||
|
||||
|
Reference in New Issue
Block a user