社区升级
1、表字段统一小写, 2、表模块划分 3、表状态等字段统一smallint 4、部分字段值重新定义
This commit is contained in:
parent
05bcd44e97
commit
1f79682516
@ -10,7 +10,7 @@
|
|||||||
</source>
|
</source>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
<server protocol="HTTP" host="0.0.0.0" port="6060" root="root">
|
<server protocol="HTTP" host="0.0.0.0" port="80" root="root">
|
||||||
|
|
||||||
<services autoload="true"/>
|
<services autoload="true"/>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<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://dbserver:3306/redbbs?autoReconnect=true&characterEncoding=utf8"/>
|
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://mysqlhost:3306/?autoReconnect=true&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="guest"/>
|
<property name="javax.persistence.jdbc.user" value="guest"/>
|
||||||
<property name="javax.persistence.jdbc.password" value="hello"/>
|
<property name="javax.persistence.jdbc.password" value="hello"/>
|
||||||
|
396
conf/redbbs.sql
396
conf/redbbs.sql
File diff suppressed because one or more lines are too long
BIN
libs/redbbs.jar
BIN
libs/redbbs.jar
Binary file not shown.
@ -158,7 +158,7 @@
|
|||||||
#define user_side(e)
|
#define user_side(e)
|
||||||
<ul class="layui-nav layui-nav-tree layui-inline" lay-filter="user">
|
<ul class="layui-nav layui-nav-tree layui-inline" lay-filter="user">
|
||||||
<li class="layui-nav-item #if(e == '') layui-this #end">
|
<li class="layui-nav-item #if(e == '') layui-this #end">
|
||||||
<a href="/user/#(mine.userId)">
|
<a href="/user/#(mine.userid)">
|
||||||
<i class="layui-icon"></i>
|
<i class="layui-icon"></i>
|
||||||
我的主页
|
我的主页
|
||||||
</a>
|
</a>
|
||||||
|
BIN
root/favicon.ico
Normal file
BIN
root/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
@ -14,17 +14,17 @@
|
|||||||
<ul class="fly-list">
|
<ul class="fly-list">
|
||||||
#for(x : top.rows??)
|
#for(x : top.rows??)
|
||||||
<li>
|
<li>
|
||||||
<a href="/user/#(x.userId)" class="fly-avatar">
|
<a href="/user/#(x.userid)" class="fly-avatar">
|
||||||
<img src="#(x.avatar)" alt="#(x.nickname)">
|
<img src="#(x.avatar)" alt="#(x.nickname)">
|
||||||
</a>
|
</a>
|
||||||
<h2 title="#(x.title)">
|
<h2 title="#(x.title)">
|
||||||
#if(x.status == 3)
|
#if(x.status == 30)
|
||||||
<a class="layui-badge">私密</a>
|
<a class="layui-badge">私密</a>
|
||||||
#else
|
#else
|
||||||
<a class="layui-badge">#(x.typeName)</a>
|
<a class="layui-badge">#(x.typename)</a>
|
||||||
#end
|
#end
|
||||||
<a href="/jie/detail/#(x.contentId)">
|
<a href="/jie/detail/#(x.contentid)">
|
||||||
#if(x.top == 3)
|
#if(x.top == 30)
|
||||||
<span style="color: #AB5D7C;font-weight: bold;">#(x.title)</span>
|
<span style="color: #AB5D7C;font-weight: bold;">#(x.title)</span>
|
||||||
#else
|
#else
|
||||||
#(x.title)
|
#(x.title)
|
||||||
@ -32,20 +32,20 @@
|
|||||||
</a>
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="fly-list-info">
|
<div class="fly-list-info">
|
||||||
<a href="/user/#(x.userId)" link>
|
<a href="/user/#(x.userid)" link>
|
||||||
<cite>#(x.nickname)</cite>
|
<cite>#(x.nickname)</cite>
|
||||||
<!--<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
<!--<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
||||||
<i class="layui-badge fly-badge-vip">VIP3</i>-->
|
<i class="layui-badge fly-badge-vip">VIP3</i>-->
|
||||||
</a>
|
</a>
|
||||||
<span>#(x.createTime)</span>
|
<span>#(x.createtime)</span>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
|
<span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
|
||||||
<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
|
<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
|
||||||
-->
|
-->
|
||||||
<span class="fly-list-nums">
|
<span class="fly-list-nums">
|
||||||
<i class="iconfont" title="人气"></i> #(x.viewNum??0)
|
<i class="iconfont" title="人气"></i> #(x.viewnum??0)
|
||||||
<i class="iconfont icon-pinglun1" title="回答"></i> #(x.replyNum??0)
|
<i class="iconfont icon-pinglun1" title="回答"></i> #(x.replynum??0)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="fly-list-badge">
|
<div class="fly-list-badge">
|
||||||
@ -79,34 +79,34 @@
|
|||||||
<ul class="fly-list">
|
<ul class="fly-list">
|
||||||
#for(x : contents.rows??)
|
#for(x : contents.rows??)
|
||||||
<li>
|
<li>
|
||||||
<a href="/user/#(x.userId)" class="fly-avatar">
|
<a href="/user/#(x.userid)" class="fly-avatar">
|
||||||
<img src="#(x.avatar)" alt="#(x.nickname)">
|
<img src="#(x.avatar)" alt="#(x.nickname)">
|
||||||
</a>
|
</a>
|
||||||
<h2 title="#(x.title)">
|
<h2 title="#(x.title)">
|
||||||
#if(x.status == 3)
|
#if(x.status == 30)
|
||||||
<a class="layui-badge">私密</a>
|
<a class="layui-badge">私密</a>
|
||||||
#else
|
#else
|
||||||
<a class="layui-badge">#(x.typeName)</a>
|
<a class="layui-badge">#(x.typename)</a>
|
||||||
#end
|
#end
|
||||||
<a href="/jie/detail/#(x.contentId)">#(x.title)</a>
|
<a href="/jie/detail/#(x.contentid)">#(x.title)</a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="fly-list-info">
|
<div class="fly-list-info">
|
||||||
<a href="/user/#(x.userId)" link>
|
<a href="/user/#(x.userid)" link>
|
||||||
<cite>#(x.nickname)</cite>
|
<cite>#(x.nickname)</cite>
|
||||||
<!--
|
<!--
|
||||||
<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
||||||
<i class="layui-badge fly-badge-vip">VIP3</i>
|
<i class="layui-badge fly-badge-vip">VIP3</i>
|
||||||
-->
|
-->
|
||||||
</a>
|
</a>
|
||||||
<span>#(x.createTime)</span>
|
<span>#(x.createtime)</span>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
|
<span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
|
||||||
<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
|
<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
|
||||||
-->
|
-->
|
||||||
<span class="fly-list-nums">
|
<span class="fly-list-nums">
|
||||||
<i class="iconfont" title="人气"></i> #(x.viewNum??0)
|
<i class="iconfont" title="人气"></i> #(x.viewnum??0)
|
||||||
<i class="iconfont icon-pinglun1" title="回答"></i> #(x.replyNum??0)
|
<i class="iconfont icon-pinglun1" title="回答"></i> #(x.replynum??0)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="fly-list-badge">
|
<div class="fly-list-badge">
|
||||||
@ -184,7 +184,7 @@
|
|||||||
<!--<i class="layui-icon fly-loading"></i>-->
|
<!--<i class="layui-icon fly-loading"></i>-->
|
||||||
#for(x : lastReg.rows??)
|
#for(x : lastReg.rows??)
|
||||||
<dd>
|
<dd>
|
||||||
<a href="/user/#(x.userId)">
|
<a href="/user/#(x.userid)">
|
||||||
<img src="#(x.avatar)"><cite>#(x.nickname)</cite><i>#(x.time)</i>
|
<img src="#(x.avatar)"><cite>#(x.nickname)</cite><i>#(x.time)</i>
|
||||||
</a>
|
</a>
|
||||||
</dd>
|
</dd>
|
||||||
@ -197,8 +197,8 @@
|
|||||||
<dt class="fly-panel-title">本周热议</dt>
|
<dt class="fly-panel-title">本周热议</dt>
|
||||||
#for(x : hotReply.rows)
|
#for(x : hotReply.rows)
|
||||||
<dd>
|
<dd>
|
||||||
<a href="/jie/detail/#(x.contentId)">#(x.title)</a>
|
<a href="/jie/detail/#(x.contentid)">#(x.title)</a>
|
||||||
<span><i class="iconfont icon-pinglun1"></i> #(x.replyNum)</span>
|
<span><i class="iconfont icon-pinglun1"></i> #(x.replynum)</span>
|
||||||
</dd>
|
</dd>
|
||||||
#else
|
#else
|
||||||
<div class="fly-none">没有相关数据</div>
|
<div class="fly-none">没有相关数据</div>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<option value="20" #if(bean.type?? == 20) selected #end>分享</option>
|
<option value="20" #if(bean.type?? == 20) selected #end>分享</option>
|
||||||
<option value="30" #if(bean.type?? == 30) selected #end>讨论</option>
|
<option value="30" #if(bean.type?? == 30) selected #end>讨论</option>
|
||||||
<!--高级权限开放类别-->
|
<!--高级权限开放类别-->
|
||||||
#if(mine.roleId?? == 1)
|
#if(mine.roleid?? == 1)
|
||||||
<option value="40" #if(bean.type?? == 40) selected #end>公告</option>
|
<option value="40" #if(bean.type?? == 40) selected #end>公告</option>
|
||||||
<option value="50" #if(bean.type?? == 50) selected #end>动态</option>
|
<option value="50" #if(bean.type?? == 50) selected #end>动态</option>
|
||||||
#end
|
#end
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<div class="layui-col-md6">
|
<div class="layui-col-md6">
|
||||||
<label for="L_title" class="layui-form-label">标题</label>
|
<label for="L_title" class="layui-form-label">标题</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="hidden" name="contentId" value="#(bean.contentId??)">
|
<input type="hidden" name="contentid" value="#(bean.contentid??)">
|
||||||
<input type="text" id="L_title" name="title" value="#(bean.title??)" required lay-verify="required" autocomplete="off" class="layui-input">
|
<input type="text" id="L_title" name="title" value="#(bean.title??)" required lay-verify="required" autocomplete="off" class="layui-input">
|
||||||
<!-- <input type="hidden" name="id" value="{{d.edit.id}}"> -->
|
<!-- <input type="hidden" name="id" value="{{d.edit.id}}"> -->
|
||||||
</div>
|
</div>
|
||||||
@ -140,7 +140,7 @@
|
|||||||
fly: 'index'
|
fly: 'index'
|
||||||
}).use(['fly','jie'], function () {
|
}).use(['fly','jie'], function () {
|
||||||
var jie = layui.jie;
|
var jie = layui.jie;
|
||||||
jie.createEditer();
|
jie.createEditer("content");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
#end
|
#end
|
@ -13,67 +13,67 @@
|
|||||||
<h1>#(bean.title)</h1>
|
<h1>#(bean.title)</h1>
|
||||||
<div class="fly-detail-info">
|
<div class="fly-detail-info">
|
||||||
<!-- <span class="layui-badge">审核中</span> -->
|
<!-- <span class="layui-badge">审核中</span> -->
|
||||||
#if(bean.status == 3)
|
#if(bean.status == 30)
|
||||||
<span class="layui-badge layui-bg-green fly-detail-column">私密</span>
|
<span class="layui-badge layui-bg-green fly-detail-column">私密</span>
|
||||||
#else
|
#else
|
||||||
<span class="layui-badge layui-bg-green fly-detail-column">#(bean.typeName)</span>
|
<span class="layui-badge layui-bg-green fly-detail-column">#(bean.typename)</span>
|
||||||
#end
|
#end
|
||||||
|
|
||||||
<span class="layui-badge" style="background-color: #999;">未结</span>
|
<span class="layui-badge" style="background-color: #999;">未结</span>
|
||||||
<!-- <span class="layui-badge" style="background-color: #5FB878;">已结</span> -->
|
<!-- <span class="layui-badge" style="background-color: #5FB878;">已结</span> -->
|
||||||
#if(bean.top == 1)
|
#if(bean.top == 10)
|
||||||
<span class="layui-badge layui-bg-black">置顶</span>
|
<span class="layui-badge layui-bg-black">置顶</span>
|
||||||
#end
|
#end
|
||||||
#if(bean.wonderful == 1)
|
#if(bean.wonderful == 10)
|
||||||
<span class="layui-badge layui-bg-red">精帖</span>
|
<span class="layui-badge layui-bg-red">精帖</span>
|
||||||
#end
|
#end
|
||||||
#if(mine.roleId?? == 1)
|
#if(mine.roleid?? == 1)
|
||||||
<div class="fly-admin-box" data-id="#(bean.contentId)">
|
<div class="fly-admin-box" data-id="#(bean.contentid)">
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="del">删除</span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="del">删除</span>
|
||||||
#if(bean.top == 1)
|
#if(bean.top >= 20)
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" v="0" style="background-color:#ccc;">取消置顶</span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" v="10" style="background-color:#ccc;">取消置顶</span>
|
||||||
#else
|
#else
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" v="1">置顶</span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" v="20">置顶</span>
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if(bean.wonderful == 1)
|
#if(bean.wonderful >= 20)
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="wonderful" v="0" style="background-color:#ccc;">取消加精</span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="wonderful" v="10" style="background-color:#ccc;">取消加精</span>
|
||||||
#else
|
#else
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="wonderful" v="1">加精</span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="wonderful" v="20">加精</span>
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if(bean.status != 3)
|
#if(bean.status != 30)
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="status" v="3">设为私密</span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="status" v="30">设为私密</span>
|
||||||
#else
|
#else
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="status" v="1">设为公开</span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="status" v="10">设为公开</span>
|
||||||
#end
|
#end
|
||||||
</div>
|
</div>
|
||||||
#end
|
#end
|
||||||
<span class="fly-list-nums">
|
<span class="fly-list-nums">
|
||||||
<a href="#comment"><i class="iconfont" title="回答"></i> #(bean.replyNum??0)</a>
|
<a href="#comment"><i class="iconfont" title="回答"></i> #(bean.replynum??0)</a>
|
||||||
<i class="iconfont" title="人气"></i> #(bean.viewNum??1)
|
<i class="iconfont" title="人气"></i> #(bean.viewnum??1)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail-about">
|
<div class="detail-about">
|
||||||
<a class="fly-avatar" href="/user/#(bean.userId)">
|
<a class="fly-avatar" href="/user/#(bean.userid)">
|
||||||
<img src="#(bean.avatar)" alt="#(bean.nickname)">
|
<img src="#(bean.avatar)" alt="#(bean.nickname)">
|
||||||
</a>
|
</a>
|
||||||
<div class="fly-detail-user">
|
<div class="fly-detail-user">
|
||||||
<a href="/user/#(bean.userId)" class="fly-link">
|
<a href="/user/#(bean.userid)" class="fly-link">
|
||||||
<cite>#(bean.nickname)</cite>
|
<cite>#(bean.nickname)</cite>
|
||||||
<!--
|
<!--
|
||||||
<i class="iconfont icon-renzheng" title="认证信息:{{ rows.user.approve }}"></i>
|
<i class="iconfont icon-renzheng" title="认证信息:{{ rows.user.approve }}"></i>
|
||||||
<i class="layui-badge fly-badge-vip">VIP3</i>
|
<i class="layui-badge fly-badge-vip">VIP3</i>
|
||||||
-->
|
-->
|
||||||
</a>
|
</a>
|
||||||
<span>#(bean.createTime??)</span>
|
<span>#(bean.createtime??)</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail-hits" id="LAY_jieAdmin" data-id="123">
|
<div class="detail-hits" id="LAY_jieAdmin" data-id="123">
|
||||||
<!--
|
<!--
|
||||||
<span style="padding-right: 10px; color: #FF7200">悬赏:60飞吻</span>
|
<span style="padding-right: 10px; color: #FF7200">悬赏:60飞吻</span>
|
||||||
-->
|
-->
|
||||||
#if(bean.userId == mine.userId?? || mine.roleId?? == 1)
|
#if(bean.userid == mine.userid?? || mine.roleid?? == 1)
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="/jie/add/#(bean.contentId)">编辑此贴</a></span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="/jie/add/#(bean.contentid)">编辑此贴</a></span>
|
||||||
#end
|
#end
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -101,10 +101,10 @@
|
|||||||
|
|
||||||
<ul class="jieda" id="jieda">
|
<ul class="jieda" id="jieda">
|
||||||
#for(x : comments.rows??)
|
#for(x : comments.rows??)
|
||||||
<li data-id="#(x.commentId)" class="jieda-daan">
|
<li data-id="#(x.commentid)" class="jieda-daan">
|
||||||
<a name="item-1111111111"></a>
|
<a name="item-1111111111"></a>
|
||||||
<div class="detail-about detail-about-reply">
|
<div class="detail-about detail-about-reply">
|
||||||
<a class="fly-avatar" href="/user/#(x.userId)">
|
<a class="fly-avatar" href="/user/#(x.userid)">
|
||||||
<img src="#(x.avatar)" alt="#(x.nickname)">
|
<img src="#(x.avatar)" alt="#(x.nickname)">
|
||||||
</a>
|
</a>
|
||||||
<div class="fly-detail-user">
|
<div class="fly-detail-user">
|
||||||
@ -113,7 +113,7 @@
|
|||||||
<!--<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
<!--<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
||||||
<i class="layui-badge fly-badge-vip">VIP3</i>-->
|
<i class="layui-badge fly-badge-vip">VIP3</i>-->
|
||||||
</a>
|
</a>
|
||||||
#if(x.userId == bean.userId??)
|
#if(x.userid == bean.userid??)
|
||||||
<span>(楼主)</span>
|
<span>(楼主)</span>
|
||||||
#end
|
#end
|
||||||
<!--
|
<!--
|
||||||
@ -123,7 +123,7 @@
|
|||||||
-->
|
-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="detail-hits"><span>#(x.createTime??)</span></div>
|
<div class="detail-hits"><span>#(x.createtime??)</span></div>
|
||||||
#if(1>2)
|
#if(1>2)
|
||||||
<i class="iconfont icon-caina" title="最佳答案"></i>
|
<i class="iconfont icon-caina" title="最佳答案"></i>
|
||||||
#end
|
#end
|
||||||
@ -132,18 +132,18 @@
|
|||||||
#(x.content)
|
#(x.content)
|
||||||
</div>
|
</div>
|
||||||
<div class="jieda-reply">
|
<div class="jieda-reply">
|
||||||
#if(x.hadSupport == 1)
|
#if(x.hadsupport == 1)
|
||||||
<span class="jieda-zan zanok" type="zan"><i class="iconfont icon-zan"></i><em>#(x.supportNum)</em></span>
|
<span class="jieda-zan zanok" type="zan"><i class="iconfont icon-zan"></i><em>#(x.supportnum)</em></span>
|
||||||
#else
|
#else
|
||||||
<span class="jieda-zan" type="zan"><i class="iconfont icon-zan"></i><em>#(x.supportNum)</em></span>
|
<span class="jieda-zan" type="zan"><i class="iconfont icon-zan"></i><em>#(x.supportnum)</em></span>
|
||||||
#end
|
#end
|
||||||
<span type="reply"><i class="iconfont icon-svgmoban53"></i>回复</span>
|
<span type="reply"><i class="iconfont icon-svgmoban53"></i>回复</span>
|
||||||
<div class="jieda-admin">
|
<div class="jieda-admin">
|
||||||
#if(x.userId == mine.userId?? && false)
|
#if(x.userid == mine.userid?? && false)
|
||||||
<span type="edit">编辑</span>
|
<span type="edit">编辑</span>
|
||||||
<span type="del">删除</span>
|
<span type="del">删除</span>
|
||||||
#end
|
#end
|
||||||
#if(bean.userId == mine.userId??)
|
#if(bean.userid == mine.userid??)
|
||||||
<span class="jieda-accept" type="accept">采纳</span>
|
<span class="jieda-accept" type="accept">采纳</span>
|
||||||
#end
|
#end
|
||||||
</div>
|
</div>
|
||||||
@ -164,7 +164,7 @@
|
|||||||
<div id="editor"></div>
|
<div id="editor"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<input type="hidden" name="contentId" value="#(bean.contentId??)">
|
<input type="hidden" name="contentid" value="#(bean.contentid??)">
|
||||||
<input type="hidden" name="pid" value="0">
|
<input type="hidden" name="pid" value="0">
|
||||||
<button class="layui-btn" lay-filter="jie-reply" lay-submit>提交回复</button>
|
<button class="layui-btn" lay-filter="jie-reply" lay-submit>提交回复</button>
|
||||||
</div>
|
</div>
|
||||||
@ -178,8 +178,8 @@
|
|||||||
<dt class="fly-panel-title">本周热议</dt>
|
<dt class="fly-panel-title">本周热议</dt>
|
||||||
#for(x : hotReply.rows)
|
#for(x : hotReply.rows)
|
||||||
<dd>
|
<dd>
|
||||||
<a href="/jie/detail/#(x.contentId)">#(x.title)</a>
|
<a href="/jie/detail/#(x.contentid)">#(x.title)</a>
|
||||||
<span><i class="iconfont icon-pinglun1"></i> #(x.replyNum)</span>
|
<span><i class="iconfont icon-pinglun1"></i> #(x.replynum)</span>
|
||||||
</dd>
|
</dd>
|
||||||
#else
|
#else
|
||||||
<div class="fly-none">没有相关数据</div>
|
<div class="fly-none">没有相关数据</div>
|
||||||
@ -232,7 +232,7 @@
|
|||||||
othis.html(fly.content(html));
|
othis.html(fly.content(html));
|
||||||
});*/
|
});*/
|
||||||
|
|
||||||
jie.createEditer();
|
jie.createEditer("comment");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
#end
|
#end
|
@ -33,40 +33,40 @@
|
|||||||
#for(x : contents.rows)
|
#for(x : contents.rows)
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<a href="/user/#(x.userId)" class="fly-avatar">
|
<a href="/user/#(x.userid)" class="fly-avatar">
|
||||||
<img src="#(x.avatar??)" alt="#(x.nickname)">
|
<img src="#(x.avatar??)" alt="#(x.nickname)">
|
||||||
</a>
|
</a>
|
||||||
<h2>
|
<h2>
|
||||||
#if(x.status == 3)
|
#if(x.status == 30)
|
||||||
<a class="layui-badge">私密</a>
|
<a class="layui-badge">私密</a>
|
||||||
#else
|
#else
|
||||||
<a class="layui-badge">#(x.typeName)</a>
|
<a class="layui-badge">#(x.typename)</a>
|
||||||
#end
|
#end
|
||||||
<a href="/jie/detail/#(x.contentId)">#(x.title)</a>
|
<a href="/jie/detail/#(x.contentid)">#(x.title)</a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="fly-list-info">
|
<div class="fly-list-info">
|
||||||
<a href="user/#(x.userId)" link>
|
<a href="user/#(x.userid)" link>
|
||||||
<cite>#(x.nickname)</cite>
|
<cite>#(x.nickname)</cite>
|
||||||
<!--
|
<!--
|
||||||
<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
||||||
<i class="layui-badge fly-badge-vip">VIP3</i>
|
<i class="layui-badge fly-badge-vip">VIP3</i>
|
||||||
-->
|
-->
|
||||||
</a>
|
</a>
|
||||||
<span>#(x.createTime)</span>
|
<span>#(x.createtime)</span>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
|
<span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
|
||||||
<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
|
<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
|
||||||
-->
|
-->
|
||||||
<span class="fly-list-nums">
|
<span class="fly-list-nums">
|
||||||
<i class="iconfont icon-pinglun1" title="回答"></i> #(x.replyNum??0)
|
<i class="iconfont icon-pinglun1" title="回答"></i> #(x.replynum??0)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="fly-list-badge">
|
<div class="fly-list-badge">
|
||||||
#if(x.top > 0)
|
#if(x.top >= 20)
|
||||||
<span class="layui-badge layui-bg-black">置顶</span>
|
<span class="layui-badge layui-bg-black">置顶</span>
|
||||||
#end
|
#end
|
||||||
#if(x.wonderful == 1)
|
#if(x.wonderful >= 20)
|
||||||
<span class="layui-badge layui-bg-red">精帖</span>
|
<span class="layui-badge layui-bg-red">精帖</span>
|
||||||
#end
|
#end
|
||||||
</div>
|
</div>
|
||||||
@ -87,8 +87,8 @@
|
|||||||
<dt class="fly-panel-title">本周热议</dt>
|
<dt class="fly-panel-title">本周热议</dt>
|
||||||
#for(x : hotReply.rows??)
|
#for(x : hotReply.rows??)
|
||||||
<dd>
|
<dd>
|
||||||
<a href="/jie/detail/#(x.contentId)">#(x.title)</a>
|
<a href="/jie/detail/#(x.contentid)">#(x.title)</a>
|
||||||
<span><i class="iconfont icon-pinglun1"></i> #(x.replyNum)</span>
|
<span><i class="iconfont icon-pinglun1"></i> #(x.replynum)</span>
|
||||||
</dd>
|
</dd>
|
||||||
#else
|
#else
|
||||||
<div class="fly-none">没有相关数据</div>
|
<div class="fly-none">没有相关数据</div>
|
||||||
|
@ -250,12 +250,12 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'face'], f
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
,editer: function(){
|
,editer: function(key){
|
||||||
var E = window.wangEditor;
|
var E = window.wangEditor;
|
||||||
var editor = new E('#editor');
|
var editor = new E('#editor');
|
||||||
editor.customConfig.uploadImgServer = '/upload/img';
|
editor.customConfig.uploadImgServer = '/upload/img';
|
||||||
|
|
||||||
var cache_key = "content_" + $("input[name='contentId']").val();
|
var cache_key = key+"_" + $("input[name='contentid']").val();
|
||||||
var html = localStorage.getItem(cache_key);
|
var html = localStorage.getItem(cache_key);
|
||||||
|
|
||||||
editor.customConfig.onblur = function (html) {
|
editor.customConfig.onblur = function (html) {
|
||||||
|
@ -22,8 +22,8 @@ layui.define(['fly','laypage'], function(exports){
|
|||||||
};
|
};
|
||||||
|
|
||||||
var jie = {
|
var jie = {
|
||||||
createEditer : function(){
|
createEditer : function(key){
|
||||||
editor = fly.editer();
|
editor = fly.editer(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ layui.define(['fly','laypage'], function(exports){
|
|||||||
layer.close(index);
|
layer.close(index);
|
||||||
fly.json('/os/content/set', {
|
fly.json('/os/content/set', {
|
||||||
id: div.data('id')
|
id: div.data('id')
|
||||||
,v: -1
|
,v: -10
|
||||||
,field:"status"
|
,field:"status"
|
||||||
}, function(res){
|
}, function(res){
|
||||||
location.href= "/";
|
location.href= "/";
|
||||||
@ -147,7 +147,7 @@ layui.define(['fly','laypage'], function(exports){
|
|||||||
zan: function(li){ //赞
|
zan: function(li){ //赞
|
||||||
var othis = $(this), ok = othis.hasClass('zanok');
|
var othis = $(this), ok = othis.hasClass('zanok');
|
||||||
fly.json('/os/comment/support', {
|
fly.json('/os/comment/support', {
|
||||||
commentId: li.data('id')
|
commentid: li.data('id')
|
||||||
,ok: ok?-1:1
|
,ok: ok?-1:1
|
||||||
}, function(res){
|
}, function(res){
|
||||||
var zans = othis.find('em').html()|0;
|
var zans = othis.find('em').html()|0;
|
||||||
@ -239,7 +239,7 @@ layui.define(['fly','laypage'], function(exports){
|
|||||||
|
|
||||||
form.on('submit(jie-add)', function(data){
|
form.on('submit(jie-add)', function(data){
|
||||||
var bean = {};
|
var bean = {};
|
||||||
["contentId","title", "content", "type", "status"].forEach(function (value) {
|
["contentid","title", "content", "type", "status"].forEach(function (value) {
|
||||||
bean[value] = data.field[value];
|
bean[value] = data.field[value];
|
||||||
});
|
});
|
||||||
bean["content"] = editor.txt.html();
|
bean["content"] = editor.txt.html();
|
||||||
@ -249,7 +249,7 @@ layui.define(['fly','laypage'], function(exports){
|
|||||||
bean:JSON.stringify(bean)
|
bean:JSON.stringify(bean)
|
||||||
},function (res) {
|
},function (res) {
|
||||||
layer.msg("发布成功",{time:2000},function () {
|
layer.msg("发布成功",{time:2000},function () {
|
||||||
var cache_key = "content_" + $("input[name='contentId']").val();
|
var cache_key = "content_" + $("input[name='contentid']").val();
|
||||||
localStorage.removeItem(cache_key);
|
localStorage.removeItem(cache_key);
|
||||||
location.href = "/user";
|
location.href = "/user";
|
||||||
});
|
});
|
||||||
@ -258,7 +258,7 @@ layui.define(['fly','laypage'], function(exports){
|
|||||||
});
|
});
|
||||||
form.on('submit(jie-reply)', function(data){
|
form.on('submit(jie-reply)', function(data){
|
||||||
var bean = {};
|
var bean = {};
|
||||||
["contentId","pid", "content"].forEach(function (value) {
|
["contentid","pid", "content"].forEach(function (value) {
|
||||||
bean[value] = data.field[value];
|
bean[value] = data.field[value];
|
||||||
});
|
});
|
||||||
bean["content"] = editor.txt.html();
|
bean["content"] = editor.txt.html();
|
||||||
@ -269,6 +269,8 @@ layui.define(['fly','laypage'], function(exports){
|
|||||||
},function (res) {
|
},function (res) {
|
||||||
layer.msg("回复成功",{time:2000},function () {
|
layer.msg("回复成功",{time:2000},function () {
|
||||||
//location.href = "/";
|
//location.href = "/";
|
||||||
|
var cache_key = "comment_" + $("input[name='contentid']").val();
|
||||||
|
localStorage.removeItem(cache_key);
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -9,9 +9,14 @@
|
|||||||
-->
|
-->
|
||||||
<h1>
|
<h1>
|
||||||
#(user.nickname??)
|
#(user.nickname??)
|
||||||
|
#if(user.sex == 10)
|
||||||
<i class="iconfont icon-nan"></i>
|
<i class="iconfont icon-nan"></i>
|
||||||
<!--
|
#elseif(user.sex == 20)
|
||||||
<i class="iconfont icon-nv"></i>
|
<i class="iconfont icon-nv"></i>
|
||||||
|
#else
|
||||||
|
|
||||||
|
#end
|
||||||
|
<!--
|
||||||
<i class="layui-badge fly-badge-vip">VIP3</i>
|
<i class="layui-badge fly-badge-vip">VIP3</i>
|
||||||
<span style="color:#c00;">(管理员)</span>
|
<span style="color:#c00;">(管理员)</span>
|
||||||
<span style="color:#5FB878;">(社区之光)</span>
|
<span style="color:#5FB878;">(社区之光)</span>
|
||||||
@ -27,7 +32,7 @@
|
|||||||
<!--
|
<!--
|
||||||
<i class="iconfont icon-kiss" title="飞吻"></i><span style="color: #FF7200;">66666 飞吻</span>
|
<i class="iconfont icon-kiss" title="飞吻"></i><span style="color: #FF7200;">66666 飞吻</span>
|
||||||
-->
|
-->
|
||||||
<i class="iconfont icon-shijian"></i><span>#(EJ.date(user.createTime??,"yyyy-MM-dd")) 加入</span>
|
<i class="iconfont icon-shijian"></i><span>#(EJ.date(user.createtime??,"yyyy-MM-dd")) 加入</span>
|
||||||
<i class="iconfont icon-chengshi"></i><span>来自#(user.city?? "火星")</span>
|
<i class="iconfont icon-chengshi"></i><span>来自#(user.city?? "火星")</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -53,9 +58,9 @@
|
|||||||
#if(x.wonderful == 1)
|
#if(x.wonderful == 1)
|
||||||
<span class="fly-jing">精</span>
|
<span class="fly-jing">精</span>
|
||||||
#end
|
#end
|
||||||
<a href="/jie/detail/#(x.contentId)" class="jie-title">#(x.title)</a>
|
<a href="/jie/detail/#(x.contentid)" class="jie-title">#(x.title)</a>
|
||||||
<i>#(x.createTime)</i>
|
<i>#(x.createtime)</i>
|
||||||
<em class="layui-hide-xs">#(x.viewNum)阅/#(x.replyNum)答</em>
|
<em class="layui-hide-xs">#(x.viewnum)阅/#(x.replynum)答</em>
|
||||||
</li>
|
</li>
|
||||||
#end
|
#end
|
||||||
<!-- <div class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><i style="font-size:14px;">没有发表任何求解</i></div> -->
|
<!-- <div class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><i style="font-size:14px;">没有发表任何求解</i></div> -->
|
||||||
@ -70,8 +75,8 @@
|
|||||||
#for(x : comments.rows??)
|
#for(x : comments.rows??)
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
<span>#(x.createTime)</span>
|
<span>#(x.createtime)</span>
|
||||||
在<a href="/jie/detail/#(x.contentId)" target="_blank">#(x.title)</a>中回答:
|
在<a href="/jie/detail/#(x.contentid)" target="_blank">#(x.title)</a>中回答:
|
||||||
</p>
|
</p>
|
||||||
<div class="home-dacontent">
|
<div class="home-dacontent">
|
||||||
#(x.content)
|
#(x.content)
|
||||||
|
@ -31,10 +31,10 @@
|
|||||||
<ul class="mine-view jie-row">
|
<ul class="mine-view jie-row">
|
||||||
#for(x : contents.rows)
|
#for(x : contents.rows)
|
||||||
<li>
|
<li>
|
||||||
<a class="jie-title" href="/jie/detail/#(x.contentId)" target="_blank">#(x.title)</a>
|
<a class="jie-title" href="/jie/detail/#(x.contentid)" target="_blank">#(x.title)</a>
|
||||||
<i>#(x.createTime) </i>
|
<i>#(x.createtime) </i>
|
||||||
<a class="mine-edit" href="/jie/add/#(x.contentId)">编辑</a>
|
<a class="mine-edit" href="/jie/add/#(x.contentid)">编辑</a>
|
||||||
<em>#(x.viewNum)阅/#(x.replyNum)答</em>
|
<em>#(x.viewnum)阅/#(x.replynum)答</em>
|
||||||
</li>
|
</li>
|
||||||
#end
|
#end
|
||||||
</ul>
|
</ul>
|
||||||
@ -44,8 +44,8 @@
|
|||||||
<ul class="mine-view jie-row">
|
<ul class="mine-view jie-row">
|
||||||
#for(x : collects.rows??)
|
#for(x : collects.rows??)
|
||||||
<li>
|
<li>
|
||||||
<a class="jie-title" href="/jie/detail/#(x.contentId)" target="_blank">#(x.title)</a>
|
<a class="jie-title" href="/jie/detail/#(x.contentid)" target="_blank">#(x.title)</a>
|
||||||
<i>收藏于#(x.createTime)</i>
|
<i>收藏于#(x.createtime)</i>
|
||||||
</li>
|
</li>
|
||||||
#end
|
#end
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<li class="layui-this" lay-id="info">我的资料</li>
|
<li class="layui-this" lay-id="info">我的资料</li>
|
||||||
<li lay-id="avatar">头像</li>
|
<li lay-id="avatar">头像</li>
|
||||||
<li lay-id="pass">密码</li>
|
<li lay-id="pass">密码</li>
|
||||||
#if(mine.roleId == 1)
|
#if(mine.roleid == 1)
|
||||||
<li lay-id="blog">博客地址</li>
|
<li lay-id="blog">博客地址</li>
|
||||||
#end
|
#end
|
||||||
<!--<li lay-id="bind">帐号绑定</li>-->
|
<!--<li lay-id="bind">帐号绑定</li>-->
|
||||||
@ -43,8 +43,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="radio" name="sex" value="1" #if(mine.sex == 1) checked #end title="男">
|
<input type="radio" name="sex" value="10" #if(mine.sex == 10) checked #end title="男">
|
||||||
<input type="radio" name="sex" value="2" #if(mine.sex == 2) checked #end title="女">
|
<input type="radio" name="sex" value="20" #if(mine.sex == 20) checked #end title="女">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.lxyer.bbs.base;
|
package com.lxyer.bbs.base;
|
||||||
|
|
||||||
import com.lxyer.bbs.base.user.User;
|
import com.lxyer.bbs.base.user.UserRecord;
|
||||||
import com.lxyer.bbs.base.user.UserInfo;
|
import com.lxyer.bbs.base.user.UserInfo;
|
||||||
import org.redkale.service.Service;
|
import org.redkale.service.Service;
|
||||||
import org.redkale.source.CacheSource;
|
import org.redkale.source.CacheSource;
|
||||||
@ -62,11 +62,11 @@ public class BaseService<F extends UF,I extends UI> implements Service {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected <I extends UI> Sheet<I> setIUser(Sheet<I> ufSheet){
|
protected <I extends UI> Sheet<I> setIUser(Sheet<I> ufSheet){
|
||||||
int[] userIds = ufSheet.stream().mapToInt(I::getUserId).toArray();
|
int[] userIds = ufSheet.stream().mapToInt(I::getUserid).toArray();
|
||||||
|
|
||||||
List<User> users = source.queryList(User.class, FilterNode.create("userId", FilterExpress.IN, userIds));
|
List<UserRecord> users = source.queryList(UserRecord.class, FilterNode.create("userId", FilterExpress.IN, userIds));
|
||||||
ufSheet.forEach(x->{
|
ufSheet.forEach(x->{
|
||||||
User user = users.stream().filter(u -> u.getUserId() == x.getUserId()).findAny().orElse(null);
|
UserRecord user = users.stream().filter(u -> u.getUserid() == x.getUserid()).findAny().orElse(null);
|
||||||
x.setUser(user);
|
x.setUser(user);
|
||||||
});
|
});
|
||||||
return ufSheet;
|
return ufSheet;
|
||||||
@ -78,7 +78,7 @@ public class BaseService<F extends UF,I extends UI> implements Service {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected I setIUser(I uf){
|
protected I setIUser(I uf){
|
||||||
User user = source.find(User.class, uf.getUserId());
|
UserRecord user = source.find(UserRecord.class, uf.getUserid());
|
||||||
|
|
||||||
return (I) uf.setUser(user);
|
return (I) uf.setUser(user);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class BaseServlet extends HttpServlet {
|
|||||||
private static final Kv _kv = Kv.create();
|
private static final Kv _kv = Kv.create();
|
||||||
private static Engine engine;
|
private static Engine engine;
|
||||||
protected String sessionid;
|
protected String sessionid;
|
||||||
protected int currentId;//登录人id
|
protected int currentid;//登录人id
|
||||||
|
|
||||||
protected static final boolean winos = System.getProperty("os.name").contains("Window");
|
protected static final boolean winos = System.getProperty("os.name").contains("Window");
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ public class BaseServlet extends HttpServlet {
|
|||||||
sessionid = request.getSessionid(false);
|
sessionid = request.getSessionid(false);
|
||||||
if (sessionid != null) {
|
if (sessionid != null) {
|
||||||
request.setCurrentUser(userService.current(sessionid));
|
request.setCurrentUser(userService.current(sessionid));
|
||||||
currentId = userService.currentUserId(sessionid);
|
currentid = userService.currentUserId(sessionid);
|
||||||
_kv.set("mine", request.currentUser());
|
_kv.set("mine", request.currentUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,10 +179,10 @@ public class BaseServlet extends HttpServlet {
|
|||||||
protected FilterNode setPrivate(FilterNode node){
|
protected FilterNode setPrivate(FilterNode node){
|
||||||
UserInfo userInfo = request.currentUser();
|
UserInfo userInfo = request.currentUser();
|
||||||
if (userInfo == null){
|
if (userInfo == null){
|
||||||
node.and("status", FilterExpress.NOTEQUAL, 3);
|
node.and("status", FilterExpress.NOTEQUAL, 30);
|
||||||
}else if (!userService.isAdmin(currentId)){
|
}else if (!userService.isAdmin(currentid)){
|
||||||
//select * from content c where c.status != -1 and (c.status!=3 or (c.status=3 and c.userId=100001))
|
//select * from content c where c.status != -1 and (c.status!=30 or (c.status=30 and c.userid=100001))
|
||||||
node.and(FilterNode.create("status", FilterExpress.NOTEQUAL, 3).or(FilterNode.create("status", 3).and("userId", userInfo.getUserId())));
|
node.and(FilterNode.create("status", FilterExpress.NOTEQUAL, 30).or(FilterNode.create("status", 30).and("userid", userInfo.getUserid())));
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
@ -5,6 +5,6 @@ package com.lxyer.bbs.base;
|
|||||||
* Created by liangxianyou at 2018/6/9 14:50.
|
* Created by liangxianyou at 2018/6/9 14:50.
|
||||||
*/
|
*/
|
||||||
public interface UF<I extends UI> {
|
public interface UF<I extends UI> {
|
||||||
int getUserId();
|
int getUserid();
|
||||||
I createInfo();
|
I createInfo();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.lxyer.bbs.base;
|
package com.lxyer.bbs.base;
|
||||||
|
|
||||||
import com.lxyer.bbs.base.user.User;
|
import com.lxyer.bbs.base.user.UserRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by liangxianyou at 2018/6/9 13:45.
|
* Created by liangxianyou at 2018/6/9 13:45.
|
||||||
@ -8,9 +8,9 @@ import com.lxyer.bbs.base.user.User;
|
|||||||
public interface UI<I extends UI> {
|
public interface UI<I extends UI> {
|
||||||
|
|
||||||
//抽象方法
|
//抽象方法
|
||||||
int getUserId();
|
int getUserid();
|
||||||
User getUser();
|
UserRecord getUser();
|
||||||
I setUser(User user);
|
I setUser(UserRecord user);
|
||||||
|
|
||||||
//默认实现方法
|
//默认实现方法
|
||||||
default String getRealname(){
|
default String getRealname(){
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
package com.lxyer.bbs.base.entity;
|
package com.lxyer.bbs.base.entity;
|
||||||
|
|
||||||
import org.redkale.convert.json.JsonConvert;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author lxyer
|
* @author lxyer
|
||||||
*/
|
*/
|
||||||
@Cacheable
|
@Cacheable(interval = 5*60)
|
||||||
@Table(catalog = "redbbs", name = "act_log")
|
@Table(catalog = "redbbs", name = "sys_actlog")
|
||||||
public class ActLog implements java.io.Serializable {
|
public class ActLog implements java.io.Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@ -17,49 +18,23 @@ public class ActLog implements java.io.Serializable {
|
|||||||
@Column(comment = "[日志id]")
|
@Column(comment = "[日志id]")
|
||||||
private int logid;
|
private int logid;
|
||||||
|
|
||||||
@Column(comment = "[日志类型]")
|
@Column(comment = "[日志类型]10赞,20收藏,30阅读")
|
||||||
private int cate;
|
private short cate;
|
||||||
|
|
||||||
@Column(comment = "[目标数据id]")
|
@Column(comment = "[目标数据id]")
|
||||||
private int tid;
|
private int tid;
|
||||||
|
|
||||||
@Column(comment = "[用户id]")
|
@Column(comment = "[用户id]")
|
||||||
private int userId;
|
private int userid;
|
||||||
|
|
||||||
@Column(comment = "[创建时间]")
|
@Column(updatable = false, comment = "[创建时间]")
|
||||||
private long createTime;
|
private long createtime;
|
||||||
|
|
||||||
@Column(length = 128, comment = "[说明]")
|
@Column(length = 128, comment = "[说明]")
|
||||||
private String remark = "";
|
private String remark = "";
|
||||||
|
|
||||||
@Column(comment = "[状态]-1删除 1正常")
|
@Column(comment = "[状态]-1删除 1正常")
|
||||||
private int status = 1;
|
private short status = 10;
|
||||||
|
|
||||||
public ActLog cate(int cate){
|
|
||||||
this.cate = cate;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
public ActLog tid(int tid){
|
|
||||||
this.tid = tid;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
public ActLog userId(int userId){
|
|
||||||
this.userId = userId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
public ActLog createTime(long createTime){
|
|
||||||
this.createTime = createTime;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
public ActLog remark(String remark){
|
|
||||||
this.remark = remark;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
public ActLog status(int status){
|
|
||||||
this.status = status;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setLogid(int logid) {
|
public void setLogid(int logid) {
|
||||||
this.logid = logid;
|
this.logid = logid;
|
||||||
@ -69,11 +44,11 @@ public class ActLog implements java.io.Serializable {
|
|||||||
return this.logid;
|
return this.logid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCate(int cate) {
|
public void setCate(short cate) {
|
||||||
this.cate = cate;
|
this.cate = cate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCate() {
|
public short getCate() {
|
||||||
return this.cate;
|
return this.cate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,20 +60,20 @@ public class ActLog implements java.io.Serializable {
|
|||||||
return this.tid;
|
return this.tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId) {
|
public void setUserid(int userid) {
|
||||||
this.userId = userId;
|
this.userid = userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId() {
|
public int getUserid() {
|
||||||
return this.userId;
|
return this.userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(long createTime) {
|
public void setCreatetime(long createtime) {
|
||||||
this.createTime = createTime;
|
this.createtime = createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCreateTime() {
|
public long getCreatetime() {
|
||||||
return this.createTime;
|
return this.createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
public void setRemark(String remark) {
|
||||||
@ -109,11 +84,11 @@ public class ActLog implements java.io.Serializable {
|
|||||||
return this.remark;
|
return this.remark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(int status) {
|
public void setStatus(short status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
public short getStatus() {
|
||||||
return this.status;
|
return this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,4 +96,15 @@ public class ActLog implements java.io.Serializable {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonConvert.root().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----
|
||||||
|
public ActLog() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActLog(int cate, int tid, int userid) {
|
||||||
|
this.cate = (short) cate;
|
||||||
|
this.tid = tid;
|
||||||
|
this.userid = userid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,15 @@ import javax.persistence.Table;
|
|||||||
* @author lxyer
|
* @author lxyer
|
||||||
*/
|
*/
|
||||||
@Cacheable(interval = 5*60)
|
@Cacheable(interval = 5*60)
|
||||||
@Table(catalog = "redbbs", name = "dyna_attr", comment = "[动态属性表]")
|
@Table(catalog = "redbbs", name = "sys_dynattr", comment = "[动态属性表]")
|
||||||
public class DynaAttr implements java.io.Serializable {
|
public class DynAttr implements java.io.Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(comment = "[目标数据id]")
|
@Column(comment = "[目标数据id]")
|
||||||
private int tid;
|
private int tid;
|
||||||
|
|
||||||
@Column(comment = "[类型]1文章, 2xx, 3...,")
|
@Column(comment = "[类型]1文章, 2xx, 3...,")
|
||||||
private int cate;
|
private short cate;
|
||||||
|
|
||||||
@Column(length = 32, comment = "")
|
@Column(length = 32, comment = "")
|
||||||
private String attr = "";
|
private String attr = "";
|
||||||
@ -36,11 +36,11 @@ public class DynaAttr implements java.io.Serializable {
|
|||||||
return this.tid;
|
return this.tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCate(int cate) {
|
public void setCate(short cate) {
|
||||||
this.cate = cate;
|
this.cate = cate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCate() {
|
public short getCate() {
|
||||||
return this.cate;
|
return this.cate;
|
||||||
}
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ public class LoginBean implements FilterBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return User.md5IfNeed(password);
|
return UserRecord.md5IfNeed(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
|
@ -15,7 +15,7 @@ public class UserInfo implements java.io.Serializable {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(comment = "[用户id]")
|
@Column(comment = "[用户id]")
|
||||||
private int userId;
|
private int userid;
|
||||||
|
|
||||||
private String username = "";
|
private String username = "";
|
||||||
private int sex = 1;
|
private int sex = 1;
|
||||||
@ -25,21 +25,21 @@ public class UserInfo implements java.io.Serializable {
|
|||||||
private String avatar = "";
|
private String avatar = "";
|
||||||
private String relaname = "";
|
private String relaname = "";
|
||||||
private String email = "";
|
private String email = "";
|
||||||
private int roleId = 0;
|
private int roleid = 0;
|
||||||
private String site = "";
|
private String site = "";
|
||||||
private String git = "";
|
private String git = "";
|
||||||
private long createTime;
|
private long createtime;
|
||||||
private String sign = "";
|
private String sign = "";
|
||||||
private String city = "";
|
private String city = "";
|
||||||
private int status = 1;
|
private int status = 1;
|
||||||
private String time = "";
|
private String time = "";
|
||||||
|
|
||||||
public void setUserId(int userId) {
|
public void setUserid(int userid) {
|
||||||
this.userId = userId;
|
this.userid = userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId() {
|
public int getUserid() {
|
||||||
return this.userId;
|
return this.userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUsername(String username) {
|
public void setUsername(String username) {
|
||||||
@ -107,12 +107,12 @@ public class UserInfo implements java.io.Serializable {
|
|||||||
return this.email == null || this.email.isEmpty() ? "" : this.email;
|
return this.email == null || this.email.isEmpty() ? "" : this.email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRoleId() {
|
public int getRoleid() {
|
||||||
return roleId;
|
return roleid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleId(int roleId) {
|
public void setRoleid(int roleid) {
|
||||||
this.roleId = roleId;
|
this.roleid = roleid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSite() {
|
public String getSite() {
|
||||||
@ -131,12 +131,12 @@ public class UserInfo implements java.io.Serializable {
|
|||||||
this.git = git;
|
this.git = git;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(long createTime) {
|
public void setCreatetime(long createtime) {
|
||||||
this.createTime = createTime;
|
this.createtime = createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCreateTime() {
|
public long getCreatetime() {
|
||||||
return this.createTime;
|
return this.createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSign() {
|
public String getSign() {
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
package com.lxyer.bbs.base.user;
|
package com.lxyer.bbs.base.user;
|
||||||
|
|
||||||
import org.redkale.convert.ConvertColumn;
|
import javax.persistence.*;
|
||||||
import org.redkale.convert.ConvertType;
|
import org.redkale.convert.json.*;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
|
||||||
import org.redkale.util.Utility;
|
import org.redkale.util.Utility;
|
||||||
|
|
||||||
import javax.persistence.Cacheable;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
@ -17,23 +12,22 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
* @author lxyer
|
* @author lxyer
|
||||||
*/
|
*/
|
||||||
@Cacheable(interval = 5*60)
|
@Cacheable(interval = 5*60)
|
||||||
@Table(catalog = "redbbs", name = "user")
|
@Table(catalog = "redbbs", name = "sys_userrecord")
|
||||||
public class User implements java.io.Serializable {
|
public class UserRecord implements java.io.Serializable {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
//@GeneratedValue
|
@Column(comment = "[用户id]")
|
||||||
@Column(comment = "[用户id]", updatable = false)
|
private int userid;
|
||||||
private int userId;
|
|
||||||
|
|
||||||
@Column(length = 32, comment = "[登录名]")
|
@Column(length = 32, comment = "[登录名]")
|
||||||
private String username = "";
|
private String username = "";
|
||||||
|
|
||||||
@Column(comment = "[性别]默认1 1男,2女")
|
|
||||||
private int sex = 1;
|
|
||||||
|
|
||||||
@Column(length = 64, comment = "[密码]")
|
@Column(length = 64, comment = "[密码]")
|
||||||
private String password = "";
|
private String password = "";
|
||||||
|
|
||||||
|
@Column(comment = "[性别]默认 10男,20女")
|
||||||
|
private short sex;
|
||||||
|
|
||||||
@Column(length = 32, comment = "[电话号码]")
|
@Column(length = 32, comment = "[电话号码]")
|
||||||
private String phone = "";
|
private String phone = "";
|
||||||
|
|
||||||
@ -49,8 +43,8 @@ public class User implements java.io.Serializable {
|
|||||||
@Column(length = 32, comment = "[邮箱]")
|
@Column(length = 32, comment = "[邮箱]")
|
||||||
private String email = "";
|
private String email = "";
|
||||||
|
|
||||||
@Column(length = 2, comment = "[用户角色]")
|
@Column(comment = "")
|
||||||
private int roleId = 0;
|
private int roleid;
|
||||||
|
|
||||||
@Column(length = 128, comment = "[个人博客地址]")
|
@Column(length = 128, comment = "[个人博客地址]")
|
||||||
private String site = "";
|
private String site = "";
|
||||||
@ -58,8 +52,8 @@ public class User implements java.io.Serializable {
|
|||||||
@Column(length = 128, comment = "[码云/GitHub]")
|
@Column(length = 128, comment = "[码云/GitHub]")
|
||||||
private String git = "";
|
private String git = "";
|
||||||
|
|
||||||
@Column(comment = "[创建时间]", updatable = false)
|
@Column(updatable = false, comment = "[创建时间]")
|
||||||
private long createTime;
|
private long createtime;
|
||||||
|
|
||||||
@Column(length = 256, comment = "[签名]")
|
@Column(length = 256, comment = "[签名]")
|
||||||
private String sign = "";
|
private String sign = "";
|
||||||
@ -67,8 +61,164 @@ public class User implements java.io.Serializable {
|
|||||||
@Column(length = 64, comment = "[所在城市]")
|
@Column(length = 64, comment = "[所在城市]")
|
||||||
private String city = "";
|
private String city = "";
|
||||||
|
|
||||||
@Column(comment = "[状态]")
|
@Column(comment = "[状态]-10删除 10正常")
|
||||||
private int status = 1;
|
private short status = 10;
|
||||||
|
|
||||||
|
public void setUserid(int userid) {
|
||||||
|
this.userid = userid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUserid() {
|
||||||
|
return this.userid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return this.username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return this.password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSex(short sex) {
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getSex() {
|
||||||
|
return this.sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return this.phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNickname(String nickname) {
|
||||||
|
this.nickname = nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNickname() {
|
||||||
|
return this.nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvatar(String avatar) {
|
||||||
|
this.avatar = avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvatar() {
|
||||||
|
return this.avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRealname(String realname) {
|
||||||
|
this.realname = realname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRealname() {
|
||||||
|
return this.realname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return this.email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleid(int roleid) {
|
||||||
|
this.roleid = roleid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRoleid() {
|
||||||
|
return this.roleid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSite(String site) {
|
||||||
|
this.site = site;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSite() {
|
||||||
|
return this.site;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGit(String git) {
|
||||||
|
this.git = git;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGit() {
|
||||||
|
return this.git;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatetime(long createtime) {
|
||||||
|
this.createtime = createtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCreatetime() {
|
||||||
|
return this.createtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSign(String sign) {
|
||||||
|
this.sign = sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSign() {
|
||||||
|
return this.sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCity(String city) {
|
||||||
|
this.city = city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCity() {
|
||||||
|
return this.city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(short status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getStatus() {
|
||||||
|
return this.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return JsonConvert.root().convertTo(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------
|
||||||
|
|
||||||
|
public UserInfo createUserInfo() {
|
||||||
|
UserInfo userInfo = new UserInfo();
|
||||||
|
userInfo.setUserid(userid);
|
||||||
|
userInfo.setUsername(username);
|
||||||
|
userInfo.setSex(sex);
|
||||||
|
userInfo.setPassword(password);
|
||||||
|
userInfo.setPhone(phone);
|
||||||
|
userInfo.setNickname(nickname);
|
||||||
|
userInfo.setAvatar(avatar);
|
||||||
|
userInfo.setRelaname(realname);
|
||||||
|
userInfo.setEmail(email);
|
||||||
|
userInfo.setRoleid(roleid);
|
||||||
|
userInfo.setSite(site);
|
||||||
|
userInfo.setGit(git);
|
||||||
|
userInfo.setCreatetime(createtime);
|
||||||
|
userInfo.setSign(sign);
|
||||||
|
userInfo.setCity(city);
|
||||||
|
userInfo.setStatus(getStatus());
|
||||||
|
return userInfo;
|
||||||
|
}
|
||||||
|
|
||||||
public String passwordForMd5(){
|
public String passwordForMd5(){
|
||||||
return md5IfNeed(password);
|
return md5IfNeed(password);
|
||||||
@ -88,159 +238,4 @@ public class User implements java.io.Serializable {
|
|||||||
bytes = md5.digest(bytes);
|
bytes = md5.digest(bytes);
|
||||||
return new String(Utility.binToHex(bytes));
|
return new String(Utility.binToHex(bytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserId(int userId) {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSex() {
|
|
||||||
return sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSex(int sex) {
|
|
||||||
this.sex = sex;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConvertColumn(ignore = true, type = ConvertType.JSON)
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhone() {
|
|
||||||
return phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPhone(String phone) {
|
|
||||||
this.phone = phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNickname() {
|
|
||||||
return nickname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNickname(String nickname) {
|
|
||||||
this.nickname = nickname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAvatar() {
|
|
||||||
return avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAvatar(String avatar) {
|
|
||||||
this.avatar = avatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRealname() {
|
|
||||||
return realname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRealname(String realname) {
|
|
||||||
this.realname = realname;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return (email == null || email.isEmpty()) ? " " : email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRoleId() {
|
|
||||||
return roleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoleId(int roleId) {
|
|
||||||
this.roleId = roleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSite() {
|
|
||||||
return site;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSite(String site) {
|
|
||||||
this.site = site;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGit() {
|
|
||||||
return git;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGit(String git) {
|
|
||||||
this.git = git;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(long createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSign() {
|
|
||||||
return sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSign(String sign) {
|
|
||||||
this.sign = sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCity() {
|
|
||||||
return city;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCity(String city) {
|
|
||||||
this.city = city;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(int status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return JsonConvert.root().convertTo(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserInfo createUserInfo() {
|
|
||||||
UserInfo userInfo = new UserInfo();
|
|
||||||
userInfo.setUserId(userId);
|
|
||||||
userInfo.setUsername(username);
|
|
||||||
userInfo.setSex(sex);
|
|
||||||
userInfo.setPassword(password);
|
|
||||||
userInfo.setPhone(phone);
|
|
||||||
userInfo.setNickname(nickname);
|
|
||||||
userInfo.setAvatar(avatar);
|
|
||||||
userInfo.setRelaname(realname);
|
|
||||||
userInfo.setEmail(email);
|
|
||||||
userInfo.setRoleId(roleId);
|
|
||||||
userInfo.setSite(site);
|
|
||||||
userInfo.setGit(git);
|
|
||||||
userInfo.setCreateTime(createTime);
|
|
||||||
userInfo.setSign(sign);
|
|
||||||
userInfo.setCity(city);
|
|
||||||
userInfo.setStatus(getStatus());
|
|
||||||
return userInfo;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -31,7 +31,7 @@ public class UserService extends BaseService {
|
|||||||
|
|
||||||
final RetResult retResult = new RetResult();
|
final RetResult retResult = new RetResult();
|
||||||
|
|
||||||
User user = source.find(User.class, "username", loginBean.getUsername());
|
UserRecord user = source.find(UserRecord.class, "username", loginBean.getUsername());
|
||||||
if (user == null || !Objects.equals(user.getPassword(), loginBean.getPassword())){
|
if (user == null || !Objects.equals(user.getPassword(), loginBean.getPassword())){
|
||||||
//log(null, 0, "用户或密码错误");
|
//log(null, 0, "用户或密码错误");
|
||||||
return RetCodes.retResult(RetCodes.RET_USER_ACCOUNT_PWD_ILLEGAL, "用户或密码错误");
|
return RetCodes.retResult(RetCodes.RET_USER_ACCOUNT_PWD_ILLEGAL, "用户或密码错误");
|
||||||
@ -40,7 +40,7 @@ public class UserService extends BaseService {
|
|||||||
//log(user, 0, "用户登录成功.");
|
//log(user, 0, "用户登录成功.");
|
||||||
UserInfo userInfo = user.createUserInfo();
|
UserInfo userInfo = user.createUserInfo();
|
||||||
|
|
||||||
sessions.setAsync(sessionExpireSeconds, loginBean.getSessionid(), userInfo.getUserId());
|
sessions.setAsync(sessionExpireSeconds, loginBean.getSessionid(), userInfo.getUserid());
|
||||||
retResult.setRetcode(0);
|
retResult.setRetcode(0);
|
||||||
retResult.setResult(userInfo);
|
retResult.setResult(userInfo);
|
||||||
retResult.setRetinfo("登录成功.");
|
retResult.setRetinfo("登录成功.");
|
||||||
@ -61,7 +61,7 @@ public class UserService extends BaseService {
|
|||||||
|
|
||||||
@RestMapping(name = "info", comment = "用户信息")
|
@RestMapping(name = "info", comment = "用户信息")
|
||||||
public UserInfo findUserInfo(int userid) {
|
public UserInfo findUserInfo(int userid) {
|
||||||
User user = source.find(User.class, userid);
|
UserRecord user = source.find(UserRecord.class, userid);
|
||||||
return user == null ? null : user.createUserInfo();
|
return user == null ? null : user.createUserInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,8 +74,8 @@ public class UserService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "query", auth = false, comment = "用户数据查询")
|
@RestMapping(name = "query", auth = false, comment = "用户数据查询")
|
||||||
public Sheet<User> queryUser(Flipper flipper, @RestParam(name = "bean", comment = "过滤条件") final UserBean userBean){
|
public Sheet<UserRecord> queryUser(Flipper flipper, @RestParam(name = "bean", comment = "过滤条件") final UserBean userBean){
|
||||||
Sheet<User> users = source.querySheet(User.class, flipper, userBean);
|
Sheet<UserRecord> users = source.querySheet(UserRecord.class, flipper, userBean);
|
||||||
|
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
@ -84,32 +84,32 @@ public class UserService extends BaseService {
|
|||||||
public RetResult updatePwd(@RestSessionid String sessionid, String pass, String nowpass){
|
public RetResult updatePwd(@RestSessionid String sessionid, String pass, String nowpass){
|
||||||
UserInfo userInfo = current(sessionid);//不会为空
|
UserInfo userInfo = current(sessionid);//不会为空
|
||||||
|
|
||||||
if (!Objects.equals(userInfo.getPassword(), User.md5IfNeed(nowpass)))
|
if (!Objects.equals(userInfo.getPassword(), UserRecord.md5IfNeed(nowpass)))
|
||||||
return RetCodes.retResult(RET_USER_ACCOUNT_PWD_ILLEGAL, "密码错误");
|
return RetCodes.retResult(RET_USER_ACCOUNT_PWD_ILLEGAL, "密码错误");
|
||||||
if (pass == null || pass.length() < 6 || Objects.equals(pass, nowpass))
|
if (pass == null || pass.length() < 6 || Objects.equals(pass, nowpass))
|
||||||
return RetCodes.retResult(RET_USER_PASSWORD_ILLEGAL, "密码设置无效");
|
return RetCodes.retResult(RET_USER_PASSWORD_ILLEGAL, "密码设置无效");
|
||||||
source.updateColumn(User.class, userInfo.getUserId(), "password", User.md5IfNeed(pass));
|
source.updateColumn(UserRecord.class, userInfo.getUserid(), "password", UserRecord.md5IfNeed(pass));
|
||||||
return RetResult.success();
|
return RetResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "register", auth = false, comment = "用户注册")
|
@RestMapping(name = "register", auth = false, comment = "用户注册")
|
||||||
public RetResult register(@RestParam(name = "bean") User user){
|
public RetResult register(@RestParam(name = "bean") UserRecord user){
|
||||||
/*用户名、密码、邮箱*/
|
/*用户名、密码、邮箱*/
|
||||||
if (user.getEmail() == null) return RetCodes.retResult(RET_USER_EMAIL_ILLEGAL, "邮件地址无效");
|
if (user.getEmail() == null) return RetCodes.retResult(RET_USER_EMAIL_ILLEGAL, "邮件地址无效");
|
||||||
if (user.getPassword() == null || user.getPassword().length() < 6) return RetCodes.retResult(RET_USER_PASSWORD_ILLEGAL, "密码设置无效");
|
if (user.getPassword() == null || user.getPassword().length() < 6) return RetCodes.retResult(RET_USER_PASSWORD_ILLEGAL, "密码设置无效");
|
||||||
|
|
||||||
User _user = source.find(User.class, FilterNode.create("email", user.getEmail()));
|
UserRecord _user = source.find(UserRecord.class, FilterNode.create("email", user.getEmail()));
|
||||||
if (_user != null) return RetCodes.retResult(RET_USER_USERNAME_EXISTS, "用户名已存在");
|
if (_user != null) return RetCodes.retResult(RET_USER_USERNAME_EXISTS, "用户名已存在");
|
||||||
|
|
||||||
user.setCreateTime(System.currentTimeMillis());
|
user.setCreatetime(System.currentTimeMillis());
|
||||||
user.setPassword(user.passwordForMd5());
|
user.setPassword(user.passwordForMd5());
|
||||||
user.setStatus(1);
|
user.setStatus((short) 10);
|
||||||
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");//默认头像
|
||||||
|
|
||||||
int maxId = source.getNumberResult(User.class, FilterFunc.MAX, 10_0000, "userId").intValue();
|
int maxId = source.getNumberResult(UserRecord.class, FilterFunc.MAX, 10_0000, "userid").intValue();
|
||||||
if (maxId < 10_0000) maxId = 10_0000;
|
if (maxId < 10_0000) maxId = 10_0000;
|
||||||
user.setUserId(maxId+1);
|
user.setUserid(maxId+1);
|
||||||
source.insert(user);
|
source.insert(user);
|
||||||
|
|
||||||
//记录日志
|
//记录日志
|
||||||
@ -117,19 +117,19 @@ public class UserService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "update", comment = "用户信息修改")
|
@RestMapping(name = "update", comment = "用户信息修改")
|
||||||
public RetResult userUpdate(@RestSessionid String sessionid, @RestParam(name = "bean") User user, String[] columns){
|
public RetResult userUpdate(@RestSessionid String sessionid, @RestParam(name = "bean") UserRecord user, String[] columns){
|
||||||
String nickname = user.getNickname();
|
String nickname = user.getNickname();
|
||||||
if (nickname == null && nickname.isEmpty())
|
if (nickname == null && nickname.isEmpty())
|
||||||
return RetCodes.retResult(RET_USER_NICKNAME_ILLEGAL, "昵称无效");
|
return RetCodes.retResult(RET_USER_NICKNAME_ILLEGAL, "昵称无效");
|
||||||
|
|
||||||
nickname = nickname.replace(" ", "");
|
nickname = nickname.replace(" ", "");
|
||||||
User _user = source.find(User.class, FilterNode.create("nickname", nickname));
|
UserRecord _user = source.find(UserRecord.class, FilterNode.create("nickname", nickname));
|
||||||
if (_user != null && _user.getUserId() != currentUserId(sessionid))
|
if (_user != null && _user.getUserid() != currentUserId(sessionid))
|
||||||
return RetCodes.retResult(RET_USER_NICKNAME_EXISTS, "昵称已存在");
|
return RetCodes.retResult(RET_USER_NICKNAME_EXISTS, "昵称已存在");
|
||||||
|
|
||||||
user.setNickname(nickname);//去除昵称中的空格
|
user.setNickname(nickname);//去除昵称中的空格
|
||||||
source.updateColumn(user
|
source.updateColumn(user
|
||||||
,FilterNode.create("userId", currentUserId(sessionid))
|
,FilterNode.create("userid", currentUserId(sessionid))
|
||||||
,SelectColumn.createIncludes(columns)
|
,SelectColumn.createIncludes(columns)
|
||||||
);
|
);
|
||||||
return RetResult.success();
|
return RetResult.success();
|
||||||
@ -137,17 +137,17 @@ public class UserService extends BaseService {
|
|||||||
|
|
||||||
//最新加入
|
//最新加入
|
||||||
public Sheet<UserInfo> lastReg(){
|
public Sheet<UserInfo> lastReg(){
|
||||||
Sheet<User> users = source.querySheet(User.class
|
Sheet<UserRecord> users = source.querySheet(UserRecord.class
|
||||||
, SelectColumn.createIncludes("userId", "nickname", "avatar", "createTime")
|
, SelectColumn.createIncludes("userid", "nickname", "avatar", "createtime")
|
||||||
, new Flipper().sort("createTime DESC").limit(8)
|
, new Flipper().sort("createtime DESC").limit(8)
|
||||||
, FilterNode.create("status", 1));
|
, FilterNode.create("status", 10));
|
||||||
|
|
||||||
Sheet<UserInfo> infos = new Sheet<>();
|
Sheet<UserInfo> infos = new Sheet<>();
|
||||||
ArrayList<UserInfo> list = new ArrayList<>();
|
ArrayList<UserInfo> list = new ArrayList<>();
|
||||||
|
|
||||||
users.forEach(x->{
|
users.forEach(x->{
|
||||||
UserInfo info = x.createUserInfo();
|
UserInfo info = x.createUserInfo();
|
||||||
info.setTime(LxyKit.dateFmt(x.getCreateTime()));
|
info.setTime(LxyKit.dateFmt(x.getCreatetime()));
|
||||||
list.add(info);
|
list.add(info);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -167,16 +167,16 @@ public class UserService extends BaseService {
|
|||||||
|
|
||||||
@RestMapping(name = "usercount", auth = false, comment = "用户数据统计")
|
@RestMapping(name = "usercount", auth = false, comment = "用户数据统计")
|
||||||
public Number userCount() {
|
public Number userCount() {
|
||||||
return source.getNumberResult(User.class, FilterFunc.COUNT, "userId", FilterNode.create("status", FilterExpress.NOTEQUAL, -1));
|
return source.getNumberResult(UserRecord.class, FilterFunc.COUNT, "userid", FilterNode.create("status", FilterExpress.NOTEQUAL, -10));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(ignore = true, comment = "判断用户是否是管理员")
|
@RestMapping(ignore = true, comment = "判断用户是否是管理员")
|
||||||
public boolean isAdmin(int userId){
|
public boolean isAdmin(int userid){
|
||||||
if (userId <= 0) return false;
|
if (userid <= 0) return false;
|
||||||
|
|
||||||
List<Integer> userIds = source.queryColumnList("userId", User.class, FilterNode.create("roleId", 1));
|
List<Integer> userIds = source.queryColumnList("userid", UserRecord.class, FilterNode.create("roleid", 1));
|
||||||
for (Integer x : userIds) {
|
for (Integer x : userIds) {
|
||||||
if (userId == x) {
|
if (userid == x) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package com.lxyer.bbs.comment;
|
package com.lxyer.bbs.comment;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
import com.lxyer.bbs.base.UF;
|
import com.lxyer.bbs.base.UF;
|
||||||
import com.lxyer.bbs.base.kit.LxyKit;
|
import com.lxyer.bbs.base.kit.LxyKit;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,107 +13,107 @@ import java.io.Serializable;
|
|||||||
* @author lxyer
|
* @author lxyer
|
||||||
*/
|
*/
|
||||||
@Cacheable(interval = 5*60)
|
@Cacheable(interval = 5*60)
|
||||||
@Table(catalog = "redbbs", name = "comment", comment = "[评论表]")
|
@Table(catalog = "redbbs", name = "sys_comment", comment = "[评论表]")
|
||||||
public class Comment implements UF<CommentInfo>,Serializable {
|
public class Comment implements Serializable, UF {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@Column(comment = "[评论id]")
|
@Column(comment = "[评论id]")
|
||||||
private int commentId;
|
private int commentid;
|
||||||
|
|
||||||
@Column(comment = "[评论用户id]")
|
@Column(comment = "[评论用户id]")
|
||||||
private int userId;
|
private int userid;
|
||||||
|
|
||||||
@Column(comment = "[评论父id]")
|
@Column(comment = "[评论父id]")
|
||||||
private int pid;
|
private int pid;
|
||||||
|
|
||||||
@Column(comment = "[评论的类型]")
|
@Column(comment = "[评论的类型]")
|
||||||
private int cate;
|
private short cate = 1;
|
||||||
|
|
||||||
@Column(comment = "[被评论内容的id]")
|
@Column(comment = "[被评论内容的id]")
|
||||||
private int contentId;
|
private int contentid;
|
||||||
|
|
||||||
@Column(comment = "[评论内容]")
|
@Column(comment = "[评论内容]")
|
||||||
private String content = "";
|
private String content = "";
|
||||||
|
|
||||||
@Column(comment = "[创建时间]")
|
@Column(updatable = false, comment = "[创建时间]")
|
||||||
private long createTime;
|
private long createtime;
|
||||||
|
|
||||||
@Column(comment = "[支持数]")
|
@Column(comment = "[支持数]")
|
||||||
private int supportNum;
|
private int supportnum;
|
||||||
|
|
||||||
@Column(comment = "[状态]1正常,-1删除")
|
@Column(comment = "[状态]1正常,-1删除")
|
||||||
private int status = 1;
|
private short status = 10;
|
||||||
|
|
||||||
public void setCommentId(int commentId) {
|
public void setCommentid(int commentid) {
|
||||||
this.commentId = commentId;
|
this.commentid = commentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCommentId() {
|
public int getCommentid() {
|
||||||
return this.commentId;
|
return this.commentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId) {
|
public void setUserid(int userid) {
|
||||||
this.userId = userId;
|
this.userid = userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId() {
|
public int getUserid() {
|
||||||
return this.userId;
|
return this.userid;
|
||||||
}
|
|
||||||
|
|
||||||
public int getPid() {
|
|
||||||
return pid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPid(int pid) {
|
public void setPid(int pid) {
|
||||||
this.pid = pid;
|
this.pid = pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCate() {
|
public int getPid() {
|
||||||
return cate;
|
return this.pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCate(int cate) {
|
public void setCate(short cate) {
|
||||||
this.cate = cate;
|
this.cate = cate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContentId(int contentId) {
|
public short getCate() {
|
||||||
this.contentId = contentId;
|
return this.cate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getContentId() {
|
public void setContentid(int contentid) {
|
||||||
return this.contentId;
|
this.contentid = contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
public int getContentid() {
|
||||||
return content;
|
return this.contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContent(String content) {
|
public void setContent(String content) {
|
||||||
this.content = content;
|
this.content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(long createTime) {
|
public String getContent() {
|
||||||
this.createTime = createTime;
|
return this.content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCreateTime() {
|
public void setCreatetime(long createtime) {
|
||||||
return this.createTime;
|
this.createtime = createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSupportNum() {
|
public long getCreatetime() {
|
||||||
return supportNum;
|
return this.createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSupportNum(int supportNum) {
|
public void setSupportnum(int supportnum) {
|
||||||
this.supportNum = supportNum;
|
this.supportnum = supportnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(int status) {
|
public int getSupportnum() {
|
||||||
|
return this.supportnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(short status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
public short getStatus() {
|
||||||
return this.status;
|
return this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,16 +124,16 @@ public class Comment implements UF<CommentInfo>,Serializable {
|
|||||||
|
|
||||||
public CommentInfo createInfo(){
|
public CommentInfo createInfo(){
|
||||||
CommentInfo info = new CommentInfo();
|
CommentInfo info = new CommentInfo();
|
||||||
info.setCommentId(commentId);
|
info.setCommentid(commentid);
|
||||||
info.setUserId(userId);
|
info.setUserid(userid);
|
||||||
info.setPid(pid);
|
info.setPid(pid);
|
||||||
info.setCate(cate);
|
info.setCate(cate);
|
||||||
info.setContentId(contentId);
|
info.setContentid(contentid);
|
||||||
info.setContent(content);
|
info.setContent(content);
|
||||||
info.setSupportNum(supportNum);
|
info.setSupportnum(supportnum);
|
||||||
info.setStatus(status);
|
info.setStatus(status);
|
||||||
|
|
||||||
info.setCreateTime(LxyKit.dateFmt(createTime));
|
info.setCreatetime(LxyKit.dateFmt(createtime));
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.lxyer.bbs.comment;
|
package com.lxyer.bbs.comment;
|
||||||
|
|
||||||
import com.lxyer.bbs.base.UI;
|
import com.lxyer.bbs.base.UI;
|
||||||
import com.lxyer.bbs.base.user.User;
|
import com.lxyer.bbs.base.user.UserRecord;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
import org.redkale.convert.json.JsonConvert;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
@ -14,10 +14,10 @@ import java.io.Serializable;
|
|||||||
public class CommentInfo implements UI<CommentInfo>,Serializable {
|
public class CommentInfo implements UI<CommentInfo>,Serializable {
|
||||||
|
|
||||||
@Column(comment = "[评论id]")
|
@Column(comment = "[评论id]")
|
||||||
private int commentId;
|
private int commentid;
|
||||||
|
|
||||||
@Column(comment = "[评论用户id]")
|
@Column(comment = "[评论用户id]")
|
||||||
private int userId;
|
private int userid;
|
||||||
|
|
||||||
@Column(comment = "[评论父id]")
|
@Column(comment = "[评论父id]")
|
||||||
private int pid;
|
private int pid;
|
||||||
@ -26,39 +26,39 @@ public class CommentInfo implements UI<CommentInfo>,Serializable {
|
|||||||
private int cate;
|
private int cate;
|
||||||
|
|
||||||
@Column(comment = "[被评论内容的id]")
|
@Column(comment = "[被评论内容的id]")
|
||||||
private int contentId;
|
private int contentid;
|
||||||
|
|
||||||
@Column(comment = "[评论内容]")
|
@Column(comment = "[评论内容]")
|
||||||
private String content = "";
|
private String content = "";
|
||||||
|
|
||||||
@Column(comment = "[支持数]")
|
@Column(comment = "[支持数]")
|
||||||
private int supportNum;
|
private int supportnum;
|
||||||
|
|
||||||
@Column(comment = "[状态]1正常,-1删除")
|
@Column(comment = "[状态]1正常,-1删除")
|
||||||
private int status = 1;
|
private int status = 1;
|
||||||
|
|
||||||
|
|
||||||
private String createTime;
|
private String createtime;
|
||||||
|
|
||||||
private CommentInfo pCommentInfo;
|
private CommentInfo pCommentInfo;
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
private int hadSupport = -1;
|
private int hadsupport = -1;
|
||||||
|
|
||||||
public void setCommentId(int commentId) {
|
public void setCommentid(int commentid) {
|
||||||
this.commentId = commentId;
|
this.commentid = commentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCommentId() {
|
public int getCommentid() {
|
||||||
return this.commentId;
|
return this.commentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId) {
|
public void setUserid(int userid) {
|
||||||
this.userId = userId;
|
this.userid = userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId() {
|
public int getUserid() {
|
||||||
return this.userId;
|
return this.userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPid() {
|
public int getPid() {
|
||||||
@ -77,12 +77,12 @@ public class CommentInfo implements UI<CommentInfo>,Serializable {
|
|||||||
this.cate = cate;
|
this.cate = cate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContentId(int contentId) {
|
public void setContentid(int contentid) {
|
||||||
this.contentId = contentId;
|
this.contentid = contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getContentId() {
|
public int getContentid() {
|
||||||
return this.contentId;
|
return this.contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
public String getContent() {
|
||||||
@ -93,12 +93,12 @@ public class CommentInfo implements UI<CommentInfo>,Serializable {
|
|||||||
this.content = content;
|
this.content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSupportNum() {
|
public int getSupportnum() {
|
||||||
return supportNum;
|
return supportnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSupportNum(int supportNum) {
|
public void setSupportnum(int supportnum) {
|
||||||
this.supportNum = supportNum;
|
this.supportnum = supportnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(int status) {
|
public void setStatus(int status) {
|
||||||
@ -109,12 +109,12 @@ public class CommentInfo implements UI<CommentInfo>,Serializable {
|
|||||||
return this.status;
|
return this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreateTime() {
|
public String getCreatetime() {
|
||||||
return createTime;
|
return createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(String createTime) {
|
public void setCreatetime(String createtime) {
|
||||||
this.createTime = createTime;
|
this.createtime = createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommentInfo getpCommentInfo() {
|
public CommentInfo getpCommentInfo() {
|
||||||
@ -133,12 +133,12 @@ public class CommentInfo implements UI<CommentInfo>,Serializable {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHadSupport() {
|
public int getHadsupport() {
|
||||||
return hadSupport;
|
return hadsupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHadSupport(int hadSupport) {
|
public void setHadsupport(int hadsupport) {
|
||||||
this.hadSupport = hadSupport;
|
this.hadsupport = hadsupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -147,15 +147,15 @@ public class CommentInfo implements UI<CommentInfo>,Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----
|
//----
|
||||||
private User user;
|
private UserRecord user;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getUser() {
|
public UserRecord getUser() {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommentInfo setUser(User user) {
|
public CommentInfo setUser(UserRecord user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,10 @@ public class CommentService extends BaseService<Comment, CommentInfo> {
|
|||||||
|
|
||||||
@RestMapping(name = "save", comment = "评论保存")
|
@RestMapping(name = "save", comment = "评论保存")
|
||||||
public RetResult commentSave(@RestSessionid String sessionid, @RestParam(name = "bean") Comment comment){
|
public RetResult commentSave(@RestSessionid String sessionid, @RestParam(name = "bean") Comment comment){
|
||||||
int contentId = comment.getContentId();
|
int contentid = comment.getContentid();
|
||||||
|
|
||||||
//数据校验
|
//数据校验
|
||||||
if (contentId < 1)
|
if (contentid < 1)
|
||||||
return RetCodes.retResult(RET_COMMENT_PARA_ILLEGAL, "评论参数无效");
|
return RetCodes.retResult(RET_COMMENT_PARA_ILLEGAL, "评论参数无效");
|
||||||
if (comment.getContent() == null)
|
if (comment.getContent() == null)
|
||||||
return RetCodes.retResult(RET_COMMENT_CONTENT_ILLEGAL, "评论内容无效");
|
return RetCodes.retResult(RET_COMMENT_CONTENT_ILLEGAL, "评论内容无效");
|
||||||
@ -45,16 +45,16 @@ public class CommentService extends BaseService<Comment, CommentInfo> {
|
|||||||
if (content.isEmpty())
|
if (content.isEmpty())
|
||||||
return RetCodes.retResult(RET_COMMENT_CONTENT_ILLEGAL, "评论内容无效");
|
return RetCodes.retResult(RET_COMMENT_CONTENT_ILLEGAL, "评论内容无效");
|
||||||
|
|
||||||
if (comment.getCommentId() < 1) {
|
if (comment.getCommentid() < 1) {
|
||||||
int userId = userService.currentUserId(sessionid);
|
int userid = userService.currentUserId(sessionid);
|
||||||
comment.setUserId(userId);
|
comment.setUserid(userid);
|
||||||
comment.setCreateTime(System.currentTimeMillis());
|
comment.setCreatetime(System.currentTimeMillis());
|
||||||
//todo:@用户处理
|
//todo:@用户处理
|
||||||
source.insert(comment);
|
source.insert(comment);
|
||||||
|
|
||||||
//update replyNum
|
//update replyNum
|
||||||
int count = source.getNumberResult(Comment.class, FilterFunc.COUNT, "commentId", FilterNode.create("contentId", contentId)).intValue();
|
int count = source.getNumberResult(Comment.class, FilterFunc.COUNT, "commentid", FilterNode.create("contentid", contentid)).intValue();
|
||||||
source.updateColumn(Content.class, contentId, ColumnValue.create("replyNum", count));
|
source.updateColumn(Content.class, contentid, ColumnValue.create("replynum", count));
|
||||||
}else {
|
}else {
|
||||||
source.updateColumn(comment, SelectColumn.createIncludes("content"));
|
source.updateColumn(comment, SelectColumn.createIncludes("content"));
|
||||||
}
|
}
|
||||||
@ -63,22 +63,22 @@ public class CommentService extends BaseService<Comment, CommentInfo> {
|
|||||||
|
|
||||||
@RestMapping(name = "query", auth = false,comment = "查询评论")
|
@RestMapping(name = "query", auth = false,comment = "查询评论")
|
||||||
public Sheet<CommentInfo> commentQuery(@RestSessionid String sessionid , int contentId, Flipper flipper){
|
public Sheet<CommentInfo> commentQuery(@RestSessionid String sessionid , int contentId, Flipper flipper){
|
||||||
int userId = userService.currentUserId(sessionid);
|
int userid = userService.currentUserId(sessionid);
|
||||||
|
|
||||||
flipper.setSort("supportNum DESC,commentId ASC");
|
flipper.setSort("supportnum DESC,commentid ASC");
|
||||||
Sheet<Comment> comments = source.querySheet(Comment.class, flipper, FilterNode.create("contentId", contentId));
|
Sheet<Comment> comments = source.querySheet(Comment.class, flipper, FilterNode.create("contentid", contentId));
|
||||||
|
|
||||||
Sheet<CommentInfo> infos = createInfo(comments);
|
Sheet<CommentInfo> infos = createInfo(comments);
|
||||||
setIUser(infos);
|
setIUser(infos);
|
||||||
|
|
||||||
//用户点赞的评论
|
//用户点赞的评论
|
||||||
if (userId > 0){
|
if (userid > 0){
|
||||||
int[] commentIds = comments.stream().mapToInt(Comment::getCommentId).toArray();
|
int[] commentids = comments.stream().mapToInt(Comment::getCommentid).toArray();
|
||||||
FilterNode node = FilterNode.create("cate", 1).and("status", 1).and("userId", userId).and("tid", FilterExpress.IN, commentIds);
|
FilterNode node = FilterNode.create("cate", 10).and("status", 10).and("userid", userid).and("tid", FilterExpress.IN, commentids);
|
||||||
List<Integer> hadSupport = source.queryColumnList("tid", ActLog.class, node);
|
List<Integer> hadSupport = source.queryColumnList("tid", ActLog.class, node);
|
||||||
|
|
||||||
infos.forEach(x->{
|
infos.forEach(x->{
|
||||||
x.setHadSupport(hadSupport.contains(x.getCommentId()) ? 1 : -1);//
|
x.setHadsupport(hadSupport.contains(x.getCommentid()) ? 1 : -1);//
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,18 +86,18 @@ public class CommentService extends BaseService<Comment, CommentInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Sheet<CommentInfo> queryByUserid(int userid){
|
public Sheet<CommentInfo> queryByUserid(int userid){
|
||||||
Sheet<Comment> comments = source.querySheet(Comment.class, new Flipper().sort("createTime DESC"), FilterNode.create("userId", userid));
|
Sheet<Comment> comments = source.querySheet(Comment.class, new Flipper().sort("createtime DESC"), FilterNode.create("userid", userid));
|
||||||
|
|
||||||
int[] contentIds = comments.stream().mapToInt(x -> x.getContentId()).toArray();
|
int[] contentIds = comments.stream().mapToInt(x -> x.getCommentid()).toArray();
|
||||||
|
|
||||||
List<Content> contents = source.queryList(Content.class, SelectColumn.createIncludes("contentId","title"), FilterNode.create("contentId", FilterExpress.IN, contentIds));
|
List<Content> contents = source.queryList(Content.class, SelectColumn.createIncludes("contentid","title"), FilterNode.create("contentid", FilterExpress.IN, contentIds));
|
||||||
|
|
||||||
Sheet<CommentInfo> infos = new Sheet<>();
|
Sheet<CommentInfo> infos = new Sheet<>();
|
||||||
List<CommentInfo> list = new ArrayList<>();
|
List<CommentInfo> list = new ArrayList<>();
|
||||||
|
|
||||||
comments.forEach(x->{
|
comments.forEach(x->{
|
||||||
CommentInfo info = x.createInfo();
|
CommentInfo info = x.createInfo();
|
||||||
Content content = contents.stream().filter(k -> k.getContentId() == x.getContentId()).findFirst().orElse(new Content());
|
Content content = contents.stream().filter(k -> k.getContentid() == x.getContentid()).findFirst().orElse(new Content());
|
||||||
info.setTitle(content.getTitle());
|
info.setTitle(content.getTitle());
|
||||||
list.add(info);
|
list.add(info);
|
||||||
});
|
});
|
||||||
@ -108,23 +108,23 @@ public class CommentService extends BaseService<Comment, CommentInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "support", comment = "评论点赞")
|
@RestMapping(name = "support", comment = "评论点赞")
|
||||||
public RetResult support(@RestSessionid String sessionid, int commentId, int ok){
|
public RetResult support(@RestSessionid String sessionid, int commentid, int ok){
|
||||||
int userId = userService.currentUserId(sessionid);
|
int userid = userService.currentUserId(sessionid);
|
||||||
|
|
||||||
ActLog actLog = source.find(ActLog.class, FilterNode.create("userId", userId).and("tid", commentId).and("cate", 1));
|
ActLog actLog = source.find(ActLog.class, FilterNode.create("userid", userid).and("tid", commentid).and("cate", 10));
|
||||||
if (actLog == null && ok == 1){
|
if (actLog == null && ok == 1){
|
||||||
actLog = new ActLog().cate(1).tid(commentId).userId(userId);
|
actLog = new ActLog(10, commentid, userid);
|
||||||
actLog.setCreateTime(System.currentTimeMillis());
|
actLog.setCreatetime(System.currentTimeMillis());
|
||||||
source.insert(actLog);
|
source.insert(actLog);
|
||||||
}else if (actLog != null && actLog.getStatus() != ok){
|
}else if (actLog != null && actLog.getStatus() != ok){
|
||||||
actLog.setStatus(ok);
|
actLog.setStatus((short) -10);
|
||||||
source.update(actLog);
|
source.update(actLog);
|
||||||
}else {
|
}else {
|
||||||
return RetCodes.retResult(-1, ok == 1 ? "已赞" : "已取消赞");
|
return RetCodes.retResult(-1, ok == 1 ? "已赞" : "已取消赞");
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = source.getNumberResult(ActLog.class, FilterFunc.COUNT, 0, "logid", FilterNode.create("tid", commentId).and("status", 1)).intValue();
|
int count = source.getNumberResult(ActLog.class, FilterFunc.COUNT, 0, "logid", FilterNode.create("tid", commentid).and("status", 10)).intValue();
|
||||||
source.updateColumn(Comment.class, commentId,"supportNum", count);
|
source.updateColumn(Comment.class, commentid,"supportnum", count);
|
||||||
|
|
||||||
return RetResult.success();
|
return RetResult.success();
|
||||||
}
|
}
|
||||||
@ -132,9 +132,9 @@ public class CommentService extends BaseService<Comment, CommentInfo> {
|
|||||||
@RestMapping(name = "rankuser", auth = false, comment = "评论榜")
|
@RestMapping(name = "rankuser", auth = false, comment = "评论榜")
|
||||||
public Map<String, Number> commentRank(){
|
public Map<String, Number> commentRank(){
|
||||||
Flipper flipper = new Flipper().limit(8);
|
Flipper flipper = new Flipper().limit(8);
|
||||||
source.querySheet(Comment.class, flipper, FilterNode.create("userId", FilterExpress.IN));
|
source.querySheet(Comment.class, flipper, FilterNode.create("userid", FilterExpress.IN));
|
||||||
|
|
||||||
Map<String, Number> numberMap = source.getNumberMap(Comment.class, FilterFuncColumn.create(FilterFunc.DISTINCTCOUNT, "userId"));
|
Map<String, Number> numberMap = source.getNumberMap(Comment.class, FilterFuncColumn.create(FilterFunc.DISTINCTCOUNT, "userid"));
|
||||||
|
|
||||||
return numberMap;
|
return numberMap;
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,29 @@
|
|||||||
package com.lxyer.bbs.content;
|
package com.lxyer.bbs.content;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
import com.jfinal.kit.Kv;
|
import com.jfinal.kit.Kv;
|
||||||
import com.lxyer.bbs.base.UF;
|
import com.lxyer.bbs.base.UF;
|
||||||
import com.lxyer.bbs.base.kit.LxyKit;
|
import com.lxyer.bbs.base.kit.LxyKit;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
import org.redkale.convert.json.*;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author lxyer
|
* @author lxyer
|
||||||
*/
|
*/
|
||||||
@Cacheable(interval = 5*60)
|
@Cacheable(interval = 5*60)
|
||||||
@Table(catalog = "redbbs", name = "content", comment = "[内容表]")
|
@Table(catalog = "redbbs", name = "sys_content", comment = "[内容表]")
|
||||||
public class Content implements UF<ContentInfo>,java.io.Serializable {
|
public class Content implements Serializable, UF<ContentInfo> {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@Column(comment = "[内容id]")
|
@Column(comment = "[内容id]")
|
||||||
private int contentId;
|
private int contentid;
|
||||||
|
|
||||||
@Column(comment = "[用户id]")
|
@Column(comment = "[用户id]")
|
||||||
private int userId;
|
private int userid;
|
||||||
|
|
||||||
@Column(length = 64, comment = "[标题]")
|
@Column(length = 64, comment = "[标题]")
|
||||||
private String title = "";
|
private String title = "";
|
||||||
@ -32,47 +34,47 @@ public class Content implements UF<ContentInfo>,java.io.Serializable {
|
|||||||
@Column(comment = "[内容]")
|
@Column(comment = "[内容]")
|
||||||
private String content = "";
|
private String content = "";
|
||||||
|
|
||||||
@Column(comment = "[创建时间]")
|
@Column(updatable = false, comment = "[创建时间]")
|
||||||
private long createTime;
|
private long createtime;
|
||||||
|
|
||||||
@Column(comment = "[类别]")
|
@Column(comment = "[类别]")
|
||||||
private int cate;
|
private short cate;
|
||||||
|
|
||||||
@Column(comment = "[内容类型]1新闻,2作品")
|
@Column(comment = "[内容栏目]10求助,20分享,30建议,40公告,50动态")
|
||||||
private int type;
|
private short type;
|
||||||
|
|
||||||
@Column(comment = "[评论数]")
|
@Column(comment = "[评论数]")
|
||||||
private int replyNum;
|
private int replynum;
|
||||||
|
|
||||||
@Column(comment = "[阅读量]")
|
@Column(comment = "[阅读量]")
|
||||||
private int viewNum;
|
private int viewnum;
|
||||||
|
|
||||||
@Column(comment = "[精] 0否,1是")
|
@Column(comment = "[精] 10否,20是")
|
||||||
private int wonderful;
|
private short wonderful = 10;
|
||||||
|
|
||||||
@Column(comment = "[置顶] 0否,1是")
|
@Column(comment = "[置顶]10否,20是")
|
||||||
private int top;
|
private short top = 10;
|
||||||
|
|
||||||
@Column(comment = "[结帖]大于0结帖")
|
@Column(comment = "[结帖]10否,20是")
|
||||||
private int solved;
|
private short solved = 10;
|
||||||
|
|
||||||
@Column(comment = "[状态]")
|
@Column(comment = "[状态] -10删除 10未结帖 20结帖 30私密")
|
||||||
private int status = 1;
|
private short status = 10;
|
||||||
|
|
||||||
public void setContentId(int contentId) {
|
public void setContentid(int contentid) {
|
||||||
this.contentId = contentId;
|
this.contentid = contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getContentId() {
|
public int getContentid() {
|
||||||
return this.contentId;
|
return this.contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId) {
|
public void setUserid(int userid) {
|
||||||
this.userId = userId;
|
this.userid = userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId() {
|
public int getUserid() {
|
||||||
return this.userId;
|
return this.userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
@ -91,84 +93,83 @@ public class Content implements UF<ContentInfo>,java.io.Serializable {
|
|||||||
return this.digest;
|
return this.digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
public void setContent(String content) {
|
||||||
this.content = content;
|
this.content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(long createTime) {
|
public String getContent() {
|
||||||
this.createTime = createTime;
|
return this.content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCreateTime() {
|
public void setCreatetime(long createtime) {
|
||||||
return this.createTime;
|
this.createtime = createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCate() {
|
public long getCreatetime() {
|
||||||
return cate;
|
return this.createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCate(int cate) {
|
public void setCate(short cate) {
|
||||||
this.cate = cate;
|
this.cate = cate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(int type) {
|
public short getCate() {
|
||||||
|
return this.cate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(short type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public short getType() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setReplynum(int replynum) {
|
||||||
public int getReplyNum() {
|
this.replynum = replynum;
|
||||||
return replyNum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReplyNum(int replyNum) {
|
public int getReplynum() {
|
||||||
this.replyNum = replyNum;
|
return this.replynum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getViewNum() {
|
public void setViewnum(int viewnum) {
|
||||||
return viewNum;
|
this.viewnum = viewnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setViewNum(int viewNum) {
|
public int getViewnum() {
|
||||||
this.viewNum = viewNum;
|
return this.viewnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWonderful() {
|
public void setWonderful(short wonderful) {
|
||||||
return wonderful;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWonderful(int wonderful) {
|
|
||||||
this.wonderful = wonderful;
|
this.wonderful = wonderful;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTop() {
|
public short getWonderful() {
|
||||||
return top;
|
return this.wonderful;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTop(int top) {
|
public void setTop(short top) {
|
||||||
this.top = top;
|
this.top = top;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSolved() {
|
public short getTop() {
|
||||||
return solved;
|
return this.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSolved(int solved) {
|
public void setSolved(short solved) {
|
||||||
this.solved = solved;
|
this.solved = solved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(int status) {
|
public short getSolved() {
|
||||||
|
return this.solved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(short status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
public short getStatus() {
|
||||||
return this.status;
|
return this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,21 +183,21 @@ public class Content implements UF<ContentInfo>,java.io.Serializable {
|
|||||||
@Override
|
@Override
|
||||||
public ContentInfo createInfo() {
|
public ContentInfo createInfo() {
|
||||||
ContentInfo info = new ContentInfo();
|
ContentInfo info = new ContentInfo();
|
||||||
info.setContentId(contentId);
|
info.setContentid(contentid);
|
||||||
info.setUserId(userId);
|
info.setUserid(userid);
|
||||||
info.setTitle(title);
|
info.setTitle(title);
|
||||||
info.setContent(content);
|
info.setContent(content);
|
||||||
info.setCate(cate);
|
info.setCate(cate);
|
||||||
info.setType(type);
|
info.setType(type);
|
||||||
info.setViewNum(viewNum);
|
info.setViewnum(viewnum);
|
||||||
info.setReplyNum(replyNum);
|
info.setReplynum(replynum);
|
||||||
info.setWonderful(wonderful);
|
info.setWonderful(wonderful);
|
||||||
info.setTop(top);
|
info.setTop(top);
|
||||||
info.setSolved(solved);
|
info.setSolved(solved);
|
||||||
info.setStatus(status);
|
info.setStatus(status);
|
||||||
|
|
||||||
info.setTypeName(types.getOrDefault(type, "其他").toString());
|
info.setTypename(types.getOrDefault((int)type, "其他").toString());
|
||||||
info.setCreateTime(LxyKit.dateFmt(createTime));
|
info.setCreatetime(LxyKit.dateFmt(createtime));
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
|||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@Column(comment = "[内容id]")
|
@Column(comment = "[内容id]")
|
||||||
private int contentId;
|
private int contentid;
|
||||||
|
|
||||||
@Column(comment = "[用户id]")
|
@Column(comment = "[用户id]")
|
||||||
private int userId;
|
private int userid;
|
||||||
|
|
||||||
@Column(length = 64, comment = "[标题]")
|
@Column(length = 64, comment = "[标题]")
|
||||||
private String title = "";
|
private String title = "";
|
||||||
@ -33,7 +33,7 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
|||||||
private String content = "";
|
private String content = "";
|
||||||
|
|
||||||
@Column(comment = "[创建时间]")
|
@Column(comment = "[创建时间]")
|
||||||
private long createTime;
|
private long createtime;
|
||||||
|
|
||||||
@Column(comment = "[类别]")
|
@Column(comment = "[类别]")
|
||||||
private int cate;
|
private int cate;
|
||||||
@ -42,10 +42,10 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
|||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
@Column(comment = "[评论数]")
|
@Column(comment = "[评论数]")
|
||||||
private int replyNum;
|
private int replynum;
|
||||||
|
|
||||||
@Column(comment = "[阅读量]")
|
@Column(comment = "[阅读量]")
|
||||||
private int viewNum;
|
private int viewnum;
|
||||||
|
|
||||||
/* @Column(comment = "[精] 0否,1是")
|
/* @Column(comment = "[精] 0否,1是")
|
||||||
private int wonderful;
|
private int wonderful;
|
||||||
@ -59,20 +59,20 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
|||||||
@Column(comment = "[状态]")
|
@Column(comment = "[状态]")
|
||||||
private int status = 1;*/
|
private int status = 1;*/
|
||||||
|
|
||||||
public void setContentId(int contentId) {
|
public void setContentid(int contentid) {
|
||||||
this.contentId = contentId;
|
this.contentid = contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getContentId() {
|
public int getContentid() {
|
||||||
return this.contentId;
|
return this.contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId) {
|
public void setUserid(int userid) {
|
||||||
this.userId = userId;
|
this.userid = userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId() {
|
public int getUserid() {
|
||||||
return this.userId;
|
return this.userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
@ -99,12 +99,12 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
|||||||
this.content = content;
|
this.content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(long createTime) {
|
public void setCreatetime(long createtime) {
|
||||||
this.createTime = createTime;
|
this.createtime = createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCreateTime() {
|
public long getCreatetime() {
|
||||||
return this.createTime;
|
return this.createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCate() {
|
public int getCate() {
|
||||||
@ -123,20 +123,20 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
|||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getReplyNum() {
|
public int getReplynum() {
|
||||||
return replyNum;
|
return replynum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReplyNum(int replyNum) {
|
public void setReplynum(int replynum) {
|
||||||
this.replyNum = replyNum;
|
this.replynum = replynum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getViewNum() {
|
public int getViewnum() {
|
||||||
return viewNum;
|
return viewnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setViewNum(int viewNum) {
|
public void setViewnum(int viewnum) {
|
||||||
this.viewNum = viewNum;
|
this.viewnum = viewnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.lxyer.bbs.content;
|
package com.lxyer.bbs.content;
|
||||||
|
|
||||||
import com.lxyer.bbs.base.UI;
|
import com.lxyer.bbs.base.UI;
|
||||||
import com.lxyer.bbs.base.user.User;
|
import com.lxyer.bbs.base.user.UserRecord;
|
||||||
import org.redkale.convert.ConvertColumn;
|
import org.redkale.convert.ConvertColumn;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -11,38 +11,38 @@ import java.io.Serializable;
|
|||||||
*/
|
*/
|
||||||
public class ContentInfo implements UI<ContentInfo>,Serializable {
|
public class ContentInfo implements UI<ContentInfo>,Serializable {
|
||||||
|
|
||||||
private int contentId;
|
private int contentid;
|
||||||
private int userId;
|
private int userid;
|
||||||
private String title = "";
|
private String title = "";
|
||||||
private String digest = "";
|
private String digest = "";
|
||||||
private String content = "";
|
private String content = "";
|
||||||
private String createTime;
|
private String createtime;
|
||||||
private int cate;
|
private int cate;
|
||||||
private int type;
|
private int type;
|
||||||
private int replyNum;
|
private int replynum;
|
||||||
private int viewNum;
|
private int viewnum;
|
||||||
private int wonderful;
|
private int wonderful;
|
||||||
private int top;
|
private int top;
|
||||||
private int solved;
|
private int solved;
|
||||||
private int status = 1;
|
private int status = 10;
|
||||||
|
|
||||||
private String typeName;
|
private String typename;
|
||||||
private int hadCollect = -1;
|
private int hadcollect = -1;
|
||||||
|
|
||||||
public int getContentId() {
|
public int getContentid() {
|
||||||
return contentId;
|
return contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContentId(int contentId) {
|
public void setContentid(int contentid) {
|
||||||
this.contentId = contentId;
|
this.contentid = contentid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserId() {
|
public int getUserid() {
|
||||||
return userId;
|
return userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(int userId) {
|
public void setUserid(int userid) {
|
||||||
this.userId = userId;
|
this.userid = userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
@ -85,20 +85,20 @@ public class ContentInfo implements UI<ContentInfo>,Serializable {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getReplyNum() {
|
public int getReplynum() {
|
||||||
return replyNum;
|
return replynum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReplyNum(int replyNum) {
|
public void setReplynum(int replynum) {
|
||||||
this.replyNum = replyNum;
|
this.replynum = replynum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getViewNum() {
|
public int getViewnum() {
|
||||||
return viewNum;
|
return viewnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setViewNum(int viewNum) {
|
public void setViewnum(int viewnum) {
|
||||||
this.viewNum = viewNum;
|
this.viewnum = viewnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
public int getStatus() {
|
||||||
@ -133,41 +133,41 @@ public class ContentInfo implements UI<ContentInfo>,Serializable {
|
|||||||
this.solved = solved;
|
this.solved = solved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreateTime() {
|
public String getCreatetime() {
|
||||||
return createTime;
|
return createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreateTime(String createTime) {
|
public void setCreatetime(String createtime) {
|
||||||
this.createTime = createTime;
|
this.createtime = createtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTypeName() {
|
public String getTypename() {
|
||||||
return typeName;
|
return typename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTypeName(String typeName) {
|
public void setTypename(String typename) {
|
||||||
this.typeName = typeName;
|
this.typename = typename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHadCollect() {
|
public int getHadcollect() {
|
||||||
return hadCollect;
|
return hadcollect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHadCollect(int hadCollect) {
|
public void setHadcollect(int hadcollect) {
|
||||||
this.hadCollect = hadCollect;
|
this.hadcollect = hadcollect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------
|
//-----------
|
||||||
private User user;
|
private UserRecord user;
|
||||||
@ConvertColumn(ignore = true)
|
@ConvertColumn(ignore = true)
|
||||||
@Override
|
@Override
|
||||||
public User getUser() {
|
public UserRecord getUser() {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContentInfo setUser(User user) {
|
public ContentInfo setUser(UserRecord user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -39,20 +39,20 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "query", auth = false, comment = "内容列表")
|
@RestMapping(name = "query", auth = false, comment = "内容列表")
|
||||||
public Sheet<ContentInfo> contentQuery(Flipper flipper, String actived, int currentId){
|
public Sheet<ContentInfo> contentQuery(Flipper flipper, String actived, int currentid){
|
||||||
FilterNode filterNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1);
|
FilterNode filterNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1);
|
||||||
switch (actived){
|
switch (actived){
|
||||||
case "top": filterNode.and("top", 1);break;
|
case "top": filterNode.and("top", FilterExpress.GREATERTHANOREQUALTO, 20);break;
|
||||||
case "untop": filterNode.and("top", 0);break;
|
case "untop": filterNode.and("top", 10);break;
|
||||||
case "unsolved": filterNode.and("solved", 0);break;
|
case "unsolved": filterNode.and("solved", 10);break;
|
||||||
case "solved": filterNode.and("solved", 1);break;
|
case "solved": filterNode.and("solved", 20);break;
|
||||||
case "wonderful": filterNode.and("wonderful", 1);break;
|
case "wonderful": filterNode.and("wonderful", FilterExpress.GREATERTHANOREQUALTO, 20);break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!userService.isAdmin(currentId)){//私密贴:非管理员限制查看
|
if (!userService.isAdmin(currentid)){//私密贴:非管理员限制查看
|
||||||
filterNode.and(FilterNode.create("status", FilterExpress.NOTEQUAL, 3).or(FilterNode.create("status", 3).and("userId", currentId)));
|
filterNode.and(FilterNode.create("status", FilterExpress.NOTEQUAL, 30).or(FilterNode.create("status", 30).and("userid", currentid)));
|
||||||
}else if (currentId <= 0){//私密贴:未登录限制查看
|
}else if (currentid <= 0){//私密贴:未登录限制查看
|
||||||
filterNode.and("status", FilterExpress.NOTEQUAL, 3);
|
filterNode.and("status", FilterExpress.NOTEQUAL, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
return contentQuery(flipper, filterNode);
|
return contentQuery(flipper, filterNode);
|
||||||
@ -74,13 +74,13 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
|||||||
return RetCodes.retResult(-1, "少年你的文章标题太长啦,精简化标题吧,为了更好的SEO长度请少于64个字节");
|
return RetCodes.retResult(-1, "少年你的文章标题太长啦,精简化标题吧,为了更好的SEO长度请少于64个字节");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content.getContentId() < 1){
|
if (content.getContentid() < 1){
|
||||||
int maxId = source.getNumberResult(Content.class, FilterFunc.MAX, 10_0000, "contentId").intValue();
|
int maxId = source.getNumberResult(Content.class, FilterFunc.MAX, 10_0000, "contentid").intValue();
|
||||||
int userId = userService.currentUserId(sessionid);
|
int userId = userService.currentUserId(sessionid);
|
||||||
|
|
||||||
content.setContentId(maxId+1);
|
content.setContentid(maxId+1);
|
||||||
content.setCreateTime(System.currentTimeMillis());
|
content.setCreatetime(System.currentTimeMillis());
|
||||||
content.setUserId(userId);
|
content.setUserid(userId);
|
||||||
|
|
||||||
source.insert(content);
|
source.insert(content);
|
||||||
}else {
|
}else {
|
||||||
@ -101,29 +101,29 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
|||||||
|
|
||||||
//收藏状态
|
//收藏状态
|
||||||
if (userId > 0){
|
if (userId > 0){
|
||||||
ActLog actLog = source.find(ActLog.class, FilterNode.create("cate", 2).and("tid", contentid).and("status", 1));
|
ActLog actLog = source.find(ActLog.class, FilterNode.create("cate", 20).and("tid", contentid).and("status", 10));
|
||||||
if (actLog != null) contentInfo.setHadCollect(1);
|
if (actLog != null) contentInfo.setHadcollect(1);
|
||||||
}
|
}
|
||||||
return contentInfo;
|
return contentInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "upview", comment = "增加文章1个访问量")
|
@RestMapping(name = "upview", comment = "增加文章1个访问量")
|
||||||
public void incrViewNum(int contentId){
|
public void incrViewNum(int contentId){
|
||||||
source.updateColumn(Content.class, contentId, ColumnValue.inc("viewNum", 1));
|
source.updateColumn(Content.class, contentId, ColumnValue.inc("viewnum", 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "collect", comment = "内容收藏")
|
@RestMapping(name = "collect", comment = "内容收藏")
|
||||||
public RetResult collect(@RestSessionid String sessionid, int contentId, int ok){
|
public RetResult collect(@RestSessionid String sessionid, int contentid, int ok){
|
||||||
int userId = userService.currentUserId(sessionid);//不会为空
|
int userid = userService.currentUserId(sessionid);//不会为空
|
||||||
|
|
||||||
ActLog actLog = source.find(ActLog.class, FilterNode.create("userId", userId).and("tid", contentId).and("cate", 2));
|
ActLog actLog = source.find(ActLog.class, FilterNode.create("userid", userid).and("tid", contentid).and("cate", 20));
|
||||||
if (actLog == null && ok == 1){
|
if (actLog == null && ok == 1){
|
||||||
actLog = new ActLog().cate(2).tid(contentId).userId(userId);
|
actLog = new ActLog(20, contentid, userid);//.cate(2).tid(contentId).userId(userId);
|
||||||
actLog.setCreateTime(System.currentTimeMillis());
|
actLog.setCreatetime(System.currentTimeMillis());
|
||||||
source.insert(actLog);
|
source.insert(actLog);
|
||||||
}else if (actLog != null && actLog.getStatus() != ok){
|
}else if (actLog != null && actLog.getStatus() != ok){
|
||||||
actLog.setStatus(ok);
|
actLog.setStatus((short) ok);
|
||||||
actLog.setCreateTime(System.currentTimeMillis());
|
actLog.setCreatetime(System.currentTimeMillis());
|
||||||
source.update(actLog);
|
source.update(actLog);
|
||||||
}else {
|
}else {
|
||||||
return RetCodes.retResult(-1, ok == 1 ? "已收藏" : "已取消收藏");
|
return RetCodes.retResult(-1, ok == 1 ? "已收藏" : "已取消收藏");
|
||||||
@ -134,14 +134,14 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
|||||||
|
|
||||||
@RestMapping(name = "collectquery", comment = "收藏列表")
|
@RestMapping(name = "collectquery", comment = "收藏列表")
|
||||||
public Sheet<ContentInfo> collectQuery(@RestSessionid String sessionid){
|
public Sheet<ContentInfo> collectQuery(@RestSessionid String sessionid){
|
||||||
int userId = userService.currentUserId(sessionid);
|
int userid = userService.currentUserId(sessionid);
|
||||||
|
|
||||||
Flipper flipper = new Flipper().sort("createTime DESC");
|
Flipper flipper = new Flipper().sort("createtime DESC");
|
||||||
FilterNode filterNode = FilterNode.create("cate", 2).and("status", 1).and("userId", userId);
|
FilterNode filterNode = FilterNode.create("cate", 20).and("status", 10).and("userid", userid);
|
||||||
Sheet<ActLog> actLogs = source.querySheet(ActLog.class, SelectColumn.createIncludes("tid", "createTime"), flipper, filterNode);
|
Sheet<ActLog> actLogs = source.querySheet(ActLog.class, SelectColumn.createIncludes("tid", "createtime"), flipper, filterNode);
|
||||||
|
|
||||||
int[] contentids = actLogs.stream().mapToInt(x -> x.getTid()).toArray();
|
int[] contentids = actLogs.stream().mapToInt(x -> x.getTid()).toArray();
|
||||||
Sheet<Content> contents = source.querySheet(Content.class, SelectColumn.createIncludes("contentId", "title"), flipper.sort(null), FilterNode.create("contentId", FilterExpress.IN, contentids));
|
Sheet<Content> contents = source.querySheet(Content.class, SelectColumn.createIncludes("contentid", "title"), flipper.sort(null), FilterNode.create("contentid", FilterExpress.IN, contentids));
|
||||||
|
|
||||||
Sheet<ContentInfo> infos = createInfo(contents);
|
Sheet<ContentInfo> infos = createInfo(contents);
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "set", comment = "内容操作")
|
@RestMapping(name = "set", comment = "内容操作")
|
||||||
public RetResult contentSet(int id, String field, int v){
|
public RetResult contentSet(int id, String field, short v){
|
||||||
source.updateColumn(Content.class, id, field, v);
|
source.updateColumn(Content.class, id, field, v);
|
||||||
return RetResult.success();
|
return RetResult.success();
|
||||||
}
|
}
|
||||||
@ -157,13 +157,13 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
|||||||
@RestMapping(name = "t",auth = false, comment = "测试HttpScope 模板使用")
|
@RestMapping(name = "t",auth = false, comment = "测试HttpScope 模板使用")
|
||||||
public HttpScope t(){
|
public HttpScope t(){
|
||||||
ContentService contentService = this;
|
ContentService contentService = this;
|
||||||
Flipper flipper = new Flipper().limit(30).sort("top DESC,createTime DESC");
|
Flipper flipper = new Flipper().limit(30).sort("top DESC,createtime DESC");
|
||||||
//置顶贴
|
//置顶贴
|
||||||
FilterNode topNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1).and("top", FilterExpress.GREATERTHAN, 0);
|
FilterNode topNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -10).and("top", FilterExpress.GREATERTHANOREQUALTO, 20);
|
||||||
Sheet<ContentInfo> top = contentService.contentQuery(flipper, topNode);
|
Sheet<ContentInfo> top = contentService.contentQuery(flipper, topNode);
|
||||||
|
|
||||||
//非置顶贴
|
//非置顶贴
|
||||||
FilterNode untopNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1).and("top", 0);
|
FilterNode untopNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -10).and("top", 0);
|
||||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, untopNode);
|
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, untopNode);
|
||||||
|
|
||||||
//热帖
|
//热帖
|
||||||
@ -171,13 +171,16 @@ public class ContentService extends BaseService<Content,ContentInfo>{
|
|||||||
Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");*/
|
Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");*/
|
||||||
|
|
||||||
//热议
|
//热议
|
||||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
||||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", 0);
|
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", 0);
|
||||||
|
|
||||||
//最新加入
|
//最新加入
|
||||||
Sheet<UserInfo> lastReg = userService.lastReg();
|
Sheet<UserInfo> lastReg = userService.lastReg();
|
||||||
|
|
||||||
Kv kv = Kv.by("top", top).set("contents", contents).set("hotReply", hotReply).set("lastReg", lastReg);
|
Kv kv = Kv.by("top", top)
|
||||||
|
.set("contents", contents)
|
||||||
|
.set("hotReply", hotReply)
|
||||||
|
.set("lastReg", lastReg);
|
||||||
|
|
||||||
return HttpScope.refer("index.html").attr(kv);
|
return HttpScope.refer("index.html").attr(kv);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.lxyer.bbs.servlet;
|
|||||||
|
|
||||||
import com.jfinal.kit.Kv;
|
import com.jfinal.kit.Kv;
|
||||||
import com.lxyer.bbs.base.BaseServlet;
|
import com.lxyer.bbs.base.BaseServlet;
|
||||||
import com.lxyer.bbs.base.user.User;
|
import com.lxyer.bbs.base.user.UserRecord;
|
||||||
import com.lxyer.bbs.comment.CommentInfo;
|
import com.lxyer.bbs.comment.CommentInfo;
|
||||||
import com.lxyer.bbs.content.ContentInfo;
|
import com.lxyer.bbs.content.ContentInfo;
|
||||||
import org.redkale.net.http.*;
|
import org.redkale.net.http.*;
|
||||||
@ -28,8 +28,8 @@ public class ContentServlet extends BaseServlet {
|
|||||||
int curr = request.getIntParameter("curr", 1);
|
int curr = request.getIntParameter("curr", 1);
|
||||||
|
|
||||||
//分页帖子列表
|
//分页帖子列表
|
||||||
Flipper flipper = new Flipper().offset((curr-1)*15).limit(15).sort("top DESC,createTime DESC");
|
Flipper flipper = new Flipper().offset((curr-1)*15).limit(15).sort("top DESC,createtime DESC");
|
||||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, actived, currentId);
|
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, actived, currentid);
|
||||||
|
|
||||||
Kv kv = Kv.by("contents", contents).set("url", request.getRequestURI())
|
Kv kv = Kv.by("contents", contents).set("url", request.getRequestURI())
|
||||||
.set("actived", actived).set("curr", curr);
|
.set("actived", actived).set("curr", curr);
|
||||||
@ -61,15 +61,15 @@ public class ContentServlet extends BaseServlet {
|
|||||||
//Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");
|
//Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");
|
||||||
|
|
||||||
//热议
|
//热议
|
||||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
||||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId);
|
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentid);
|
||||||
|
|
||||||
//更新
|
//更新
|
||||||
CompletableFuture.supplyAsync(new Supplier<String>() {
|
CompletableFuture.supplyAsync(new Supplier<String>() {
|
||||||
@Override
|
@Override
|
||||||
public String get() {
|
public String get() {
|
||||||
User user = request.currentUser();
|
UserRecord user = request.currentUser();
|
||||||
if (user == null || user.getUserId() > 10_0003)
|
if (user == null || user.getUserid() > 10_0003)
|
||||||
contentService.incrViewNum(contentid);
|
contentService.incrViewNum(contentid);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -88,17 +88,17 @@ public class ContentServlet extends BaseServlet {
|
|||||||
|
|
||||||
Kv column = Kv.by("qz", 10).set("fx", 20).set("jy", 30).set("gg", 40).set("dt", 50);//栏目
|
Kv column = Kv.by("qz", 10).set("fx", 20).set("jy", 30).set("gg", 40).set("dt", 50);//栏目
|
||||||
|
|
||||||
Flipper flipper = new Flipper().offset((curr-1) * 20).limit(20).sort("top DESC,createTime DESC");
|
Flipper flipper = new Flipper().offset((curr-1) * 20).limit(20).sort("top DESC,createtime DESC");
|
||||||
//帖子列表
|
//帖子列表
|
||||||
FilterNode filterNode = FilterNode.create("status", NOTEQUAL, -1).and("type", column.getAs(para));
|
FilterNode filterNode = FilterNode.create("status", NOTEQUAL, -1).and("type", column.getAs(para));
|
||||||
if (solved > -1) filterNode.and("solved", solved);
|
if (solved > 0) filterNode.and("solved", 20);
|
||||||
if (wonderful > -1) filterNode.and("wonderful", wonderful);
|
if (wonderful > 0) filterNode.and("wonderful", 20);
|
||||||
|
|
||||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(filterNode));
|
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(filterNode));
|
||||||
|
|
||||||
//热议
|
//热议
|
||||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
||||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId);
|
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentid);
|
||||||
|
|
||||||
|
|
||||||
Kv kv = Kv.by("contents", contents).set("hotReply", hotReply)
|
Kv kv = Kv.by("contents", contents).set("hotReply", hotReply)
|
||||||
|
@ -13,6 +13,7 @@ import org.redkale.source.Flipper;
|
|||||||
import org.redkale.util.Sheet;
|
import org.redkale.util.Sheet;
|
||||||
|
|
||||||
import static org.redkale.source.FilterExpress.GREATERTHAN;
|
import static org.redkale.source.FilterExpress.GREATERTHAN;
|
||||||
|
import static org.redkale.source.FilterExpress.GREATERTHANOREQUALTO;
|
||||||
import static org.redkale.source.FilterExpress.NOTEQUAL;
|
import static org.redkale.source.FilterExpress.NOTEQUAL;
|
||||||
|
|
||||||
|
|
||||||
@ -26,13 +27,13 @@ public class IndexServlet extends BaseServlet {
|
|||||||
|
|
||||||
@HttpMapping(url = "/", auth = false, comment = "社区首页")
|
@HttpMapping(url = "/", auth = false, comment = "社区首页")
|
||||||
public void abc(HttpRequest request, HttpResponse response){
|
public void abc(HttpRequest request, HttpResponse response){
|
||||||
Flipper flipper = new Flipper().limit(30).sort("top DESC,createTime DESC");
|
Flipper flipper = new Flipper().limit(30).sort("top DESC,createtime DESC");
|
||||||
//置顶贴
|
//置顶贴
|
||||||
FilterNode topNode = FilterNode.create("status", NOTEQUAL, -1).and("top", GREATERTHAN, 0);
|
FilterNode topNode = FilterNode.create("status", NOTEQUAL, -10).and("top", GREATERTHANOREQUALTO, 20);
|
||||||
Sheet<ContentInfo> top = contentService.contentQuery(flipper, setPrivate(topNode));
|
Sheet<ContentInfo> top = contentService.contentQuery(flipper, setPrivate(topNode));
|
||||||
|
|
||||||
//非置顶贴
|
//非置顶贴
|
||||||
FilterNode untopNode = FilterNode.create("status", NOTEQUAL, -1).and("top", 0);
|
FilterNode untopNode = FilterNode.create("status", NOTEQUAL, -10).and("top", 10);
|
||||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(untopNode));
|
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(untopNode));
|
||||||
|
|
||||||
//热帖
|
//热帖
|
||||||
@ -40,8 +41,8 @@ public class IndexServlet extends BaseServlet {
|
|||||||
Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");*/
|
Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");*/
|
||||||
|
|
||||||
//热议
|
//热议
|
||||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
||||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId);
|
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentid);
|
||||||
|
|
||||||
//最新加入
|
//最新加入
|
||||||
Sheet<UserInfo> lastReg = userService.lastReg();
|
Sheet<UserInfo> lastReg = userService.lastReg();
|
||||||
|
@ -2,7 +2,7 @@ package com.lxyer.bbs.servlet;
|
|||||||
|
|
||||||
import com.jfinal.kit.Kv;
|
import com.jfinal.kit.Kv;
|
||||||
import com.lxyer.bbs.base.BaseServlet;
|
import com.lxyer.bbs.base.BaseServlet;
|
||||||
import com.lxyer.bbs.base.user.User;
|
import com.lxyer.bbs.base.user.UserRecord;
|
||||||
import com.lxyer.bbs.base.user.UserBean;
|
import com.lxyer.bbs.base.user.UserBean;
|
||||||
import com.lxyer.bbs.base.user.UserInfo;
|
import com.lxyer.bbs.base.user.UserInfo;
|
||||||
import com.lxyer.bbs.comment.CommentInfo;
|
import com.lxyer.bbs.comment.CommentInfo;
|
||||||
@ -58,9 +58,9 @@ public class UserServlet extends BaseServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建的帖子
|
//创建的帖子
|
||||||
Flipper flipper = new Flipper().limit(8).sort("createTime DESC");
|
Flipper flipper = new Flipper().limit(8).sort("createtime DESC");
|
||||||
ContentBean bean = new ContentBean();
|
ContentBean bean = new ContentBean();
|
||||||
bean.setUserId(user.getUserId());
|
bean.setUserid(user.getUserid());
|
||||||
Sheet<ContentInfo> contents = contentService.queryByBean(flipper, bean);
|
Sheet<ContentInfo> contents = contentService.queryByBean(flipper, bean);
|
||||||
|
|
||||||
//收藏的帖子
|
//收藏的帖子
|
||||||
@ -72,30 +72,30 @@ public class UserServlet extends BaseServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------用户主页------
|
//-------用户主页------
|
||||||
int userId = 0;
|
int userid = 0;
|
||||||
if ("nick".equals(para)){//通过@ 点击跳转
|
if ("nick".equals(para)){//通过@ 点击跳转
|
||||||
String nickname = request.getParameter("nickname");
|
String nickname = request.getParameter("nickname");
|
||||||
UserBean userBean = new UserBean();
|
UserBean userBean = new UserBean();
|
||||||
userBean.setNickname(nickname);
|
userBean.setNickname(nickname);
|
||||||
Sheet<User> users = userService.queryUser(new Flipper().limit(1), userBean);
|
Sheet<UserRecord> users = userService.queryUser(new Flipper().limit(1), userBean);
|
||||||
if (users.getTotal() > 0){
|
if (users.getTotal() > 0){
|
||||||
userId = users.stream().findFirst().orElse(null).getUserId();
|
userid = users.stream().findFirst().orElse(null).getUserid();
|
||||||
}
|
}
|
||||||
}else {//直接访问
|
}else {//直接访问
|
||||||
userId = getParaToInt(0);
|
userid = getParaToInt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//用户信息
|
//用户信息
|
||||||
UserInfo user = userService.findUserInfo(userId);
|
UserInfo user = userService.findUserInfo(userid);
|
||||||
|
|
||||||
//帖子
|
//帖子
|
||||||
Flipper flipper = new Flipper().limit(8).sort("createTime DESC");
|
Flipper flipper = new Flipper().limit(8).sort("createtime DESC");
|
||||||
ContentBean bean = new ContentBean();
|
ContentBean bean = new ContentBean();
|
||||||
bean.setUserId(userId);
|
bean.setUserid(userid);
|
||||||
Sheet<ContentInfo> contents = contentService.queryByBean(flipper, bean);
|
Sheet<ContentInfo> contents = contentService.queryByBean(flipper, bean);
|
||||||
|
|
||||||
//回复
|
//回复
|
||||||
Sheet<CommentInfo> comments = commentService.queryByUserid(userId);
|
Sheet<CommentInfo> comments = commentService.queryByUserid(userid);
|
||||||
|
|
||||||
Kv kv = Kv.by("contents", contents).set("user", user).set("comments", comments);
|
Kv kv = Kv.by("contents", contents).set("user", user).set("comments", comments);
|
||||||
finish("/user/home.html", kv);
|
finish("/user/home.html", kv);
|
||||||
|
Loading…
Reference in New Issue
Block a user