|
@@ -15,9 +15,6 @@
|
|
|
*/
|
|
*/
|
|
|
package io.jpress.front.controller;
|
|
package io.jpress.front.controller;
|
|
|
|
|
|
|
|
-import java.math.BigInteger;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-
|
|
|
|
|
import io.jpress.Consts;
|
|
import io.jpress.Consts;
|
|
|
import io.jpress.core.BaseFrontController;
|
|
import io.jpress.core.BaseFrontController;
|
|
|
import io.jpress.core.cache.ActionCacheManager;
|
|
import io.jpress.core.cache.ActionCacheManager;
|
|
@@ -31,6 +28,9 @@ import io.jpress.router.RouterMapping;
|
|
|
import io.jpress.utils.CookieUtils;
|
|
import io.jpress.utils.CookieUtils;
|
|
|
import io.jpress.utils.StringUtils;
|
|
import io.jpress.utils.StringUtils;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigInteger;
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+
|
|
|
@RouterMapping(url = "/comment")
|
|
@RouterMapping(url = "/comment")
|
|
|
public class CommentController extends BaseFrontController {
|
|
public class CommentController extends BaseFrontController {
|
|
|
|
|
|
|
@@ -60,13 +60,15 @@ public class CommentController extends BaseFrontController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
BigInteger userId = StringUtils.toBigInteger(CookieUtils.get(this, Consts.COOKIE_LOGINED_USER), null);
|
|
BigInteger userId = StringUtils.toBigInteger(CookieUtils.get(this, Consts.COOKIE_LOGINED_USER), null);
|
|
|
|
|
+ BigInteger uuUserId = getParaToBigInteger("uuUserId");
|
|
|
|
|
|
|
|
// 允许未登录用户评论
|
|
// 允许未登录用户评论
|
|
|
Boolean comment_allow_not_login = OptionQuery.me().findValueAsBool("comment_allow_not_login");
|
|
Boolean comment_allow_not_login = OptionQuery.me().findValueAsBool("comment_allow_not_login");
|
|
|
|
|
|
|
|
// 允许未登录用户评论
|
|
// 允许未登录用户评论
|
|
|
if (comment_allow_not_login == null || comment_allow_not_login == false) {
|
|
if (comment_allow_not_login == null || comment_allow_not_login == false) {
|
|
|
- if (userId == null) {
|
|
|
|
|
|
|
+ //在不允许未登录用户评论,uuhelper只能在uuId和uuUserId都为空的情况下不准评论
|
|
|
|
|
+ if (userId == null && uuUserId == null) {
|
|
|
String redirect = Consts.ROUTER_USER_LOGIN;
|
|
String redirect = Consts.ROUTER_USER_LOGIN;
|
|
|
if (StringUtils.isNotBlank(gotoUrl)) {
|
|
if (StringUtils.isNotBlank(gotoUrl)) {
|
|
|
redirect += "?goto=" + StringUtils.urlEncode(gotoUrl);
|
|
redirect += "?goto=" + StringUtils.urlEncode(gotoUrl);
|
|
@@ -105,7 +107,13 @@ public class CommentController extends BaseFrontController {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ String uuUserAvatar = getPara("uu_user_avatar");
|
|
|
|
|
+
|
|
|
String author = getPara("author");
|
|
String author = getPara("author");
|
|
|
|
|
+ if (userId == null && uuUserId != null) {
|
|
|
|
|
+ author = getPara("uuUserName");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
String email = getPara("email");
|
|
String email = getPara("email");
|
|
|
|
|
|
|
|
String ip = getIPAddress();
|
|
String ip = getIPAddress();
|
|
@@ -141,6 +149,9 @@ public class CommentController extends BaseFrontController {
|
|
|
comment.setCreated(new Date());
|
|
comment.setCreated(new Date());
|
|
|
comment.setParentId(parentId);
|
|
comment.setParentId(parentId);
|
|
|
|
|
|
|
|
|
|
+ comment.setUuUserId(uuUserId);
|
|
|
|
|
+ comment.setUuUserAvatar(uuUserAvatar);
|
|
|
|
|
+
|
|
|
if (comment.save()) {
|
|
if (comment.save()) {
|
|
|
ActionCacheManager.clearCache();
|
|
ActionCacheManager.clearCache();
|
|
|
}
|
|
}
|