This commit is contained in:
lxyer 2018-01-07 09:27:41 +08:00
parent b5e2569d7c
commit 7756345053
11 changed files with 35 additions and 22 deletions

View File

@ -26,5 +26,5 @@
<!--<rewrite type="location" match="^/([^-]+)-[^-\.]+\.png(.*)" forward="/$1.png"/>--> <!--<rewrite type="location" match="^/([^-]+)-[^-\.]+\.png(.*)" forward="/$1.png"/>-->
</resource-servlet> </resource-servlet>
</server> </server>
</application> </application>

View File

@ -5,10 +5,10 @@
<persistence-unit name="redbbs" transaction-type="RESOURCE_LOCAL"> <persistence-unit name="redbbs" transaction-type="RESOURCE_LOCAL">
<shared-cache-mode>ALL</shared-cache-mode> <shared-cache-mode>ALL</shared-cache-mode>
<properties> <properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://558cfc37a10ef.sh.cdb.myqcloud.com:3817/db_art_red?autoReconnect=true&amp;characterEncoding=utf8"/> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://dbserver:3306/redbbs?autoReconnect=true&amp;characterEncoding=utf8"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/> <property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="cdb_outerroot"/> <property name="javax.persistence.jdbc.user" value="guest"/>
<property name="javax.persistence.jdbc.password" value="l237809796"/> <property name="javax.persistence.jdbc.password" value="hello"/>
</properties> </properties>
</persistence-unit> </persistence-unit>

View File

@ -161,7 +161,10 @@
<!--最新加入--> <!--最新加入-->
<div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank"> <div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
<h3 class="fly-panel-title">最新加入</h3> <h3 class="fly-panel-title">
最新加入|
总用户:<span id="user_count">0</span>
</h3>
<dl> <dl>
<!--<i class="layui-icon fly-loading">&#xe63d;</i>--> <!--<i class="layui-icon fly-loading">&#xe63d;</i>-->
#for(x : lastReg.rows??) #for(x : lastReg.rows??)
@ -231,6 +234,9 @@
,base: '../res/mods/' //这里实际使用时,建议改成绝对路径 ,base: '../res/mods/' //这里实际使用时,建议改成绝对路径
}).extend({ }).extend({
fly: 'index' fly: 'index'
}).use('fly'); }).use('fly',function () {
var fly = layui.fly;
fly.userstat();
});
</script> </script>
#end #end

View File

@ -309,6 +309,12 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'face'], f
} }
return arguments.callee; return arguments.callee;
} }
,userstat: function () {
$.getJSON("/os/user/stat",{},function (data) {
$("#user_count").html(data.count);
});
}
}; };

View File

@ -4,14 +4,12 @@ import org.redkale.convert.json.JsonConvert;
import org.redkale.source.FilterBean; import org.redkale.source.FilterBean;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* @author lxyer * @author lxyer
*/ */
@Table(catalog = "db_redbbs", name = "act_log")
public class ActLogBean implements Serializable, FilterBean { public class ActLogBean implements Serializable, FilterBean {
@Column(comment = "[日志id]") @Column(comment = "[日志id]")

View File

@ -9,7 +9,7 @@ import javax.persistence.*;
* @author lxyer * @author lxyer
*/ */
@Cacheable @Cacheable
@Table(catalog = "db_redbbs", name = "act_log") @Table(catalog = "redbbs", name = "act_log")
public class ActLog implements java.io.Serializable { public class ActLog implements java.io.Serializable {
@Id @Id

View File

@ -12,7 +12,7 @@ import javax.persistence.Table;
* @author lxyer * @author lxyer
*/ */
@Cacheable(interval = 5*60) @Cacheable(interval = 5*60)
@Table(catalog = "db_art_red", name = "dyna_attr", comment = "[动态属性表]") @Table(catalog = "redbbs", name = "dyna_attr", comment = "[动态属性表]")
public class DynaAttr implements java.io.Serializable { public class DynaAttr implements java.io.Serializable {
@Id @Id

View File

@ -17,7 +17,7 @@ import java.security.NoSuchAlgorithmException;
* @author lxyer * @author lxyer
*/ */
@Cacheable(interval = 5*60) @Cacheable(interval = 5*60)
@Table(catalog = "db_redbbs", name = "user") @Table(catalog = "redbbs", name = "user")
public class User implements java.io.Serializable { public class User implements java.io.Serializable {
@Id @Id

View File

@ -1,26 +1,21 @@
package com.lxyer.bbs.base.user; package com.lxyer.bbs.base.user;
import com.jfinal.kit.Kv;
import com.lxyer.bbs.base.BaseService; import com.lxyer.bbs.base.BaseService;
import com.lxyer.bbs.base.LxyKit; import com.lxyer.bbs.base.LxyKit;
import com.lxyer.bbs.base.RetCodes; import com.lxyer.bbs.base.RetCodes;
import com.lxyer.bbs.base.user.LoginBean;
import com.lxyer.bbs.base.user.UserBean;
import com.lxyer.bbs.base.user.UserInfo;
import com.lxyer.bbs.base.user.User;
import org.redkale.net.http.RestMapping; import org.redkale.net.http.RestMapping;
import org.redkale.net.http.RestParam; import org.redkale.net.http.RestParam;
import org.redkale.net.http.RestService; import org.redkale.net.http.RestService;
import org.redkale.net.http.RestSessionid; import org.redkale.net.http.RestSessionid;
import org.redkale.service.RetResult; import org.redkale.service.RetResult;
import org.redkale.source.CacheSource; import org.redkale.source.*;
import org.redkale.source.FilterFunc;
import org.redkale.source.FilterNode;
import org.redkale.source.Flipper;
import org.redkale.util.SelectColumn; import org.redkale.util.SelectColumn;
import org.redkale.util.Sheet; import org.redkale.util.Sheet;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Random; import java.util.Random;
@ -114,7 +109,7 @@ public class UserService extends BaseService {
user.setCreateTime(System.currentTimeMillis()); user.setCreateTime(System.currentTimeMillis());
user.setPassword(user.passwordForMd5()); user.setPassword(user.passwordForMd5());
user.setStatus(1);//待激活 user.setStatus(1);
user.setUsername(user.getEmail()); user.setUsername(user.getEmail());
user.setAvatar("/res/images/avatar/"+ new Random().nextInt(21) +".jpg");//默认头像 user.setAvatar("/res/images/avatar/"+ new Random().nextInt(21) +".jpg");//默认头像
@ -157,4 +152,12 @@ public class UserService extends BaseService {
return infos; return infos;
} }
@RestMapping(name = "stat", auth = false, comment = "用户数据统计")
public Map userStat(){
Number count = source.getNumberResult(User.class, FilterFunc.COUNT, "userId", FilterNode.create("status", FilterExpress.NOTEQUAL, -1));
return Kv.by("count", count);
}
} }

View File

@ -10,7 +10,7 @@ import javax.persistence.*;
* @author lxyer * @author lxyer
*/ */
@Cacheable(interval = 5*60) @Cacheable(interval = 5*60)
@Table(catalog = "db_redbbs", name = "comment", comment = "[评论表]") @Table(catalog = "redbbs", name = "comment", comment = "[评论表]")
public class Comment implements java.io.Serializable { public class Comment implements java.io.Serializable {
@Id @Id

View File

@ -11,7 +11,7 @@ import javax.persistence.*;
* @author lxyer * @author lxyer
*/ */
@Cacheable(interval = 5*60) @Cacheable(interval = 5*60)
@Table(catalog = "db_redbbs", name = "content", comment = "[内容表]") @Table(catalog = "redbbs", name = "content", comment = "[内容表]")
public class Content implements java.io.Serializable { public class Content implements java.io.Serializable {
@Id @Id