Commit 189ba02db7b52d20f100033c250cd9a4ed3d5b50

Authored by liwei2917
1 parent d6be621d

新增禁言审核管理列表

src/main/java/com/cnlive/shenhe/controller/CommentsController.java
... ... @@ -20,6 +20,7 @@ import com.github.pagehelper.PageInfo;
20 20 import org.slf4j.Logger;
21 21 import org.slf4j.LoggerFactory;
22 22 import org.springframework.beans.factory.annotation.Autowired;
  23 +import org.springframework.beans.factory.annotation.Value;
23 24 import org.springframework.stereotype.Controller;
24 25 import org.springframework.ui.Model;
25 26 import org.springframework.web.bind.annotation.*;
... ... @@ -288,13 +289,4 @@ public class CommentsController extends BaseController {
288 289 }
289 290 return responseBean;
290 291 }
291   -
292   - @PostMapping("/notSpeak")
293   - @ResponseBody
294   - public ResponseBean notSpeak(String id,Integer type,Integer time, HttpSession session) {
295   - SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
296   - String userId = sessionUser.getUserId();
297   - ResponseBean success = commentsService.notSpeak(id, type, time,userId,"禁言");
298   - return success;
299   - }
300 292 }
... ...
src/main/java/com/cnlive/shenhe/controller/NotSpeakController.java 0 → 100644
  1 +package com.cnlive.shenhe.controller;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.cnlive.shenhe.bean.ErrorEnum;
  5 +import com.cnlive.shenhe.bean.ResponseBean;
  6 +import com.cnlive.shenhe.bean.SessionUser;
  7 +import com.cnlive.shenhe.entity.ShyComments;
  8 +import com.cnlive.shenhe.entity.ShyContent;
  9 +import com.cnlive.shenhe.entity.ShyNotspeak;
  10 +import com.cnlive.shenhe.entity.ShySites;
  11 +import com.cnlive.shenhe.entity.ShyUsers;
  12 +import com.cnlive.shenhe.entity.ShyVideos;
  13 +import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
  14 +import com.cnlive.shenhe.serviceImpl.ContentServiceImpl;
  15 +import com.cnlive.shenhe.serviceImpl.NotspeakServiceImpl;
  16 +import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
  17 +import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
  18 +import com.cnlive.shenhe.utils.AuditPass;
  19 +import com.cnlive.shenhe.utils.CommonConst;
  20 +import com.cnlive.shenhe.utils.CommonUtils;
  21 +import com.github.pagehelper.PageInfo;
  22 +import org.slf4j.Logger;
  23 +import org.slf4j.LoggerFactory;
  24 +import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.beans.factory.annotation.Value;
  26 +import org.springframework.stereotype.Controller;
  27 +import org.springframework.ui.Model;
  28 +import org.springframework.web.bind.annotation.*;
  29 +
  30 +import javax.servlet.http.HttpSession;
  31 +import java.util.Date;
  32 +import java.util.List;
  33 +
  34 +
  35 +@Controller
  36 +@RequestMapping("/notSpeak")
  37 +public class NotSpeakController extends BaseController {
  38 + private static Logger logger = LoggerFactory.getLogger(NotSpeakController.class);
  39 + @Autowired
  40 + AuditPass Pass;
  41 + @Autowired
  42 + CommentsServiceImpl commentsService;
  43 + @Autowired
  44 + NotspeakServiceImpl notSpeakService;
  45 +
  46 + @Autowired
  47 + UsersServiceImpl usersService;
  48 +
  49 + @Autowired
  50 + SitesServiceImpl sitesService;
  51 + @Autowired
  52 + ContentServiceImpl contentService;
  53 +
  54 + /**
  55 + * 禁言列表页
  56 + *
  57 + * @param activity_id
  58 + * @param content
  59 + * @param is_hot
  60 + * @param start_date
  61 + * @param end_date
  62 + * @param state
  63 + * @param page
  64 + * @param pageSize
  65 + * @param orderByClause
  66 + * @return
  67 + */
  68 + @GetMapping("/page")
  69 + public String getPage(Model model, String user_name, Integer user_id,Integer state,
  70 + Integer page, Integer pageSize, String orderByClause, HttpSession session) {
  71 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  72 + if(CommonUtils.isNull(sessionUser)){
  73 + return "redirect:/users/login";
  74 + }
  75 + String userId = sessionUser.getUserId();
  76 + if (CommonUtils.isNull(page)) page = 1;
  77 + if (CommonUtils.isNull(pageSize)) pageSize = 10;
  78 + PageInfo<ShyNotspeak> shyNotspeakPage = notSpeakService.getPage(user_name,user_id, state, page, pageSize, orderByClause);
  79 + List<ShyNotspeak> list = shyNotspeakPage.getList();
  80 + if (!list.isEmpty()) {
  81 + for (ShyNotspeak notspeak : list) {
  82 + String updater = CommonUtils.isEmpty(notspeak.getUpdater()) || "null".equals(notspeak.getUpdater())? "无":notspeak.getUpdater();
  83 + String auditor_id = notspeak.getAuditor();
  84 + if (CommonUtils.isNotEmpty(auditor_id)) {
  85 + ShyUsers user = new ShyUsers();
  86 + user.setUser_id(auditor_id);
  87 + user = usersService.select(user);
  88 + if (CommonUtils.isNotNull(user)) {
  89 + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail();
  90 + String userName = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername();
  91 + updater = userName ;
  92 + }
  93 + }
  94 + notspeak.setUpdater(updater);
  95 + if(null!=notspeak.getSp_id()){
  96 + //显示spid简称
  97 + ShySites shySites = sitesService.findspidDescByspid(notspeak.getSp_id());
  98 + if (CommonUtils.isNotNull(shySites)) {
  99 + notspeak.setSpid_desc(shySites.getName());
  100 + }
  101 + }else{
  102 + notspeak.setSpid_desc("sp无法显示");
  103 + }
  104 + }
  105 + }
  106 + /* 获取参数值给前台 用来判断是否需要把查看显示出来 state recive*/
  107 + String state1 = state == null ? "" : state.toString();
  108 + model.addAttribute("state1", state1);
  109 + model.addAttribute("pageSize", pageSize);
  110 + model.addAttribute("notspeakPage", shyNotspeakPage);
  111 + return "page/notspeak.html";
  112 + }
  113 +
  114 +
  115 + /**
  116 + * 禁言(通过评论进入)
  117 + * @param commentId
  118 + * @param type
  119 + * @param time
  120 + * @param session
  121 + * @return
  122 + */
  123 + @PostMapping("/notSpeakByComment")
  124 + @ResponseBody
  125 + public ResponseBean notSpeakByComment(Integer commentId,Integer time, HttpSession session) {
  126 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  127 + String userId = sessionUser.getUserId();
  128 + ResponseBean success = notSpeakService.notSpeakByComment(commentId, time,userId);
  129 + return success;
  130 + }
  131 + /**
  132 + * 禁言(通过禁言管理进入)
  133 + * @param notSpeakId
  134 + * @param type
  135 + * @param time
  136 + * @param session
  137 + * @return
  138 + */
  139 + @PostMapping("/speak")
  140 + @ResponseBody
  141 + public ResponseBean speak(Integer notSpeakId,Integer type,Integer time, HttpSession session) {
  142 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  143 + String userId = sessionUser.getUserId();
  144 + ResponseBean success = notSpeakService.speak(notSpeakId,type, time,userId);
  145 + return success;
  146 + }
  147 +}
... ...
src/main/java/com/cnlive/shenhe/entity/ShyNotspeak.java 0 → 100644
  1 +package com.cnlive.shenhe.entity;
  2 +
  3 +import java.util.Date;
  4 +import javax.persistence.*;
  5 +
  6 +@Table(name = "shy_notSpeak")
  7 +public class ShyNotspeak {
  8 + @Id
  9 + private Integer id;
  10 +
  11 + /**
  12 + * 用户昵称
  13 + */
  14 + private String user_name;
  15 +
  16 + /**
  17 + * 用户id
  18 + */
  19 + private Integer user_id;
  20 +
  21 + /**
  22 + * 用户头像
  23 + */
  24 + private String user_avatar;
  25 +
  26 + /**
  27 + * spId
  28 + */
  29 + private Integer sp_id;
  30 +
  31 + /**
  32 + * 当前状态 1:禁言 0:解禁
  33 + */
  34 + private Integer state;
  35 +
  36 + /**
  37 + * 禁言开始时间
  38 + */
  39 + private Date start_time;
  40 +
  41 + /**
  42 + * 禁言时长(分钟)
  43 + */
  44 + private Integer time;
  45 +
  46 + /**
  47 + * 禁言结束时间
  48 + */
  49 + private Date end_time;
  50 +
  51 + /**
  52 + * 禁言次数
  53 + */
  54 + private Integer count;
  55 +
  56 + /**
  57 + * 创建时间
  58 + */
  59 + private Date created_at;
  60 +
  61 + /**
  62 + * 更新时间
  63 + */
  64 + private Date updated_at;
  65 +
  66 + /**
  67 + * 更新着
  68 + */
  69 + private String updater;
  70 +
  71 + /**
  72 + * 审核员id
  73 + */
  74 + private String auditor;
  75 +
  76 + /**
  77 + * 禁言消息
  78 + */
  79 + private String msg;
  80 +
  81 + @Transient
  82 + private String spid_desc;
  83 +
  84 + /**
  85 + * @return id
  86 + */
  87 + public Integer getId() {
  88 + return id;
  89 + }
  90 +
  91 + /**
  92 + * @param id
  93 + */
  94 + public void setId(Integer id) {
  95 + this.id = id;
  96 + }
  97 +
  98 + /**
  99 + * 获取用户昵称
  100 + *
  101 + * @return user_name - 用户昵称
  102 + */
  103 + public String getUser_name() {
  104 + return user_name;
  105 + }
  106 +
  107 + /**
  108 + * 设置用户昵称
  109 + *
  110 + * @param user_name 用户昵称
  111 + */
  112 + public void setUser_name(String user_name) {
  113 + this.user_name = user_name;
  114 + }
  115 +
  116 + /**
  117 + * 获取用户id
  118 + *
  119 + * @return user_id - 用户id
  120 + */
  121 + public Integer getUser_id() {
  122 + return user_id;
  123 + }
  124 +
  125 + /**
  126 + * 设置用户id
  127 + *
  128 + * @param user_id 用户id
  129 + */
  130 + public void setUser_id(Integer user_id) {
  131 + this.user_id = user_id;
  132 + }
  133 +
  134 + /**
  135 + * 获取用户头像
  136 + *
  137 + * @return user_avatar - 用户头像
  138 + */
  139 + public String getUser_avatar() {
  140 + return user_avatar;
  141 + }
  142 +
  143 + /**
  144 + * 设置用户头像
  145 + *
  146 + * @param user_avatar 用户头像
  147 + */
  148 + public void setUser_avatar(String user_avatar) {
  149 + this.user_avatar = user_avatar;
  150 + }
  151 +
  152 + /**
  153 + * 获取spId
  154 + *
  155 + * @return sp_id - spId
  156 + */
  157 + public Integer getSp_id() {
  158 + return sp_id;
  159 + }
  160 +
  161 + /**
  162 + * 设置spId
  163 + *
  164 + * @param sp_id spId
  165 + */
  166 + public void setSp_id(Integer sp_id) {
  167 + this.sp_id = sp_id;
  168 + }
  169 +
  170 + /**
  171 + * 获取当前状态 1:禁言 0:解禁
  172 + *
  173 + * @return state - 当前状态 1:禁言 0:解禁
  174 + */
  175 + public Integer getState() {
  176 + return state;
  177 + }
  178 +
  179 + /**
  180 + * 设置当前状态 1:禁言 0:解禁
  181 + *
  182 + * @param state 当前状态 1:禁言 0:解禁
  183 + */
  184 + public void setState(Integer state) {
  185 + this.state = state;
  186 + }
  187 +
  188 + /**
  189 + * 获取禁言开始时间
  190 + *
  191 + * @return start_time - 禁言开始时间
  192 + */
  193 + public Date getStart_time() {
  194 + return start_time;
  195 + }
  196 +
  197 + /**
  198 + * 设置禁言开始时间
  199 + *
  200 + * @param start_time 禁言开始时间
  201 + */
  202 + public void setStart_time(Date start_time) {
  203 + this.start_time = start_time;
  204 + }
  205 +
  206 + /**
  207 + * 获取禁言时长(分钟)
  208 + *
  209 + * @return time - 禁言时长(分钟)
  210 + */
  211 + public Integer getTime() {
  212 + return time;
  213 + }
  214 +
  215 + /**
  216 + * 设置禁言时长(分钟)
  217 + *
  218 + * @param time 禁言时长(分钟)
  219 + */
  220 + public void setTime(Integer time) {
  221 + this.time = time;
  222 + }
  223 +
  224 + /**
  225 + * 获取禁言结束时间
  226 + *
  227 + * @return end_time - 禁言结束时间
  228 + */
  229 + public Date getEnd_time() {
  230 + return end_time;
  231 + }
  232 +
  233 + /**
  234 + * 设置禁言结束时间
  235 + *
  236 + * @param end_time 禁言结束时间
  237 + */
  238 + public void setEnd_time(Date end_time) {
  239 + this.end_time = end_time;
  240 + }
  241 +
  242 + /**
  243 + * 获取禁言次数
  244 + *
  245 + * @return count - 禁言次数
  246 + */
  247 + public Integer getCount() {
  248 + return count;
  249 + }
  250 +
  251 + /**
  252 + * 设置禁言次数
  253 + *
  254 + * @param count 禁言次数
  255 + */
  256 + public void setCount(Integer count) {
  257 + this.count = count;
  258 + }
  259 +
  260 + /**
  261 + * 获取创建时间
  262 + *
  263 + * @return created_at - 创建时间
  264 + */
  265 + public Date getCreated_at() {
  266 + return created_at;
  267 + }
  268 +
  269 + /**
  270 + * 设置创建时间
  271 + *
  272 + * @param created_at 创建时间
  273 + */
  274 + public void setCreated_at(Date created_at) {
  275 + this.created_at = created_at;
  276 + }
  277 +
  278 + /**
  279 + * 获取更新时间
  280 + *
  281 + * @return updated_at - 更新时间
  282 + */
  283 + public Date getUpdated_at() {
  284 + return updated_at;
  285 + }
  286 +
  287 + /**
  288 + * 设置更新时间
  289 + *
  290 + * @param updated_at 更新时间
  291 + */
  292 + public void setUpdated_at(Date updated_at) {
  293 + this.updated_at = updated_at;
  294 + }
  295 +
  296 + /**
  297 + * 获取更新着
  298 + *
  299 + * @return updater - 更新着
  300 + */
  301 + public String getUpdater() {
  302 + return updater;
  303 + }
  304 +
  305 + /**
  306 + * 设置更新着
  307 + *
  308 + * @param updater 更新着
  309 + */
  310 + public void setUpdater(String updater) {
  311 + this.updater = updater;
  312 + }
  313 +
  314 + /**
  315 + * 获取审核员id
  316 + *
  317 + * @return auditor - 审核员id
  318 + */
  319 + public String getAuditor() {
  320 + return auditor;
  321 + }
  322 +
  323 + /**
  324 + * 设置审核员id
  325 + *
  326 + * @param auditor 审核员id
  327 + */
  328 + public void setAuditor(String auditor) {
  329 + this.auditor = auditor;
  330 + }
  331 +
  332 + /**
  333 + * 获取禁言消息
  334 + *
  335 + * @return msg - 禁言消息
  336 + */
  337 + public String getMsg() {
  338 + return msg;
  339 + }
  340 +
  341 + /**
  342 + * 设置禁言消息
  343 + *
  344 + * @param msg 禁言消息
  345 + */
  346 + public void setMsg(String msg) {
  347 + this.msg = msg;
  348 + }
  349 +
  350 + public String getSpid_desc() {
  351 + return spid_desc;
  352 + }
  353 +
  354 + public void setSpid_desc(String spid_desc) {
  355 + this.spid_desc = spid_desc;
  356 + }
  357 +
  358 +}
0 359 \ No newline at end of file
... ...
src/main/java/com/cnlive/shenhe/mapper/ShyNotspeakMapper.java 0 → 100644
  1 +package com.cnlive.shenhe.mapper;
  2 +
  3 +import com.cnlive.shenhe.entity.ShyNotspeak;
  4 +import tk.mybatis.mapper.common.Mapper;
  5 +
  6 +public interface ShyNotspeakMapper extends Mapper<ShyNotspeak> {
  7 +}
0 8 \ No newline at end of file
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
1 1 package com.cnlive.shenhe.serviceImpl;
2 2  
3 3 import com.alibaba.fastjson.JSONObject;
4   -import com.cnlive.shenhe.bean.ErrorEnum;
5   -import com.cnlive.shenhe.bean.ResponseBean;
6 4 import com.cnlive.shenhe.entity.ShyComments;
7 5 import com.cnlive.shenhe.entity.ShySites;
8 6 import com.cnlive.shenhe.entity.ShyUsers;
9   -import com.cnlive.shenhe.entity.ShyUsersfree;
10   -import com.cnlive.shenhe.entity.ShyVideos;
11 7 import com.cnlive.shenhe.mapper.ShyCommentsMapper;
  8 +import com.cnlive.shenhe.mapper.ShyNotspeakMapper;
12 9 import com.cnlive.shenhe.mapper.ShySitesMapper;
13 10 import com.cnlive.shenhe.mapper.ShyUsersMapper;
14 11 import com.cnlive.shenhe.utils.AuditPass;
... ... @@ -205,47 +202,6 @@ public class CommentsServiceImpl {
205 202 }
206 203 return success;
207 204 }
208   - public ResponseBean notSpeak(String id, Integer type,Integer time, String userId,String msg) {
209   - ResponseBean success;
210   - ShyComments comment = shyCommentsMapper.selectByPrimaryKey(Integer.parseInt(id));
211   - JSONObject json = new JSONObject();
212   - json.put("userId", comment.getComment_user_id());
213   - json.put("type", type);
214   - json.put("time", time);
215   - json.put("msg", msg);
216   - JSONObject result = new JSONObject();
217   - try {
218   - result = Pass.commentPass(json, comment.getCallback());
219   - } catch (Exception e) {
220   - logger.error("评论禁言失败,comments_id:{}", comment.getId());
221   - success=new ResponseBean(500,"评论禁言调用互动云服务器失败!");
222   - return success;
223   - }
224   - if (result == null) {
225   - logger.error("评论禁言错误,且无返回信息。comments_id:{}", comment.getId());
226   - success=new ResponseBean(500,"评论禁言调用互动云返回结果为空!");
227   - return success;
228   - } else {
229   - Integer errorCode = result.getInteger("errorCode");
230   - String errorMessage = result.getString("errorMessage");
231   - if (errorCode != 0) {
232   - logger.error("评论禁言错误,comments_id:{},errorCode:{},errorMessage:{}", comment.getId(), errorCode, errorMessage);
233   - success=new ResponseBean(500,"评论禁言调用互动云返回结果errorCode不为0!");
234   - return success;
235   - }
236   - comment.setState(CommonConst.AUDIT_REFUSE);
237   - comment.setMsg(msg);
238   - comment.setAuditor_id(userId);
239   - comment.setReceive(1);//已领取
240   - comment.setReceive_user_id(userId);
241   - int i = shyCommentsMapper.updateByPrimaryKeySelective(comment);
242   - if (i != 1) {
243   - success=new ResponseBean(500,"评论禁言修改当前评论数据失败!");
244   - return success;
245   - }
246   - }
247   - return new ResponseBean();
248   - }
249 205  
250 206 public Integer receive(String ids, Integer num, String userId, Integer spid) {
251 207 Integer n = 0;
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/NotspeakServiceImpl.java 0 → 100644
  1 +package com.cnlive.shenhe.serviceImpl;
  2 +
  3 +import com.alibaba.fastjson.JSONArray;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.cnlive.shenhe.bean.ResponseBean;
  6 +import com.cnlive.shenhe.entity.ShyComments;
  7 +import com.cnlive.shenhe.entity.ShyContent;
  8 +import com.cnlive.shenhe.entity.ShyLive;
  9 +import com.cnlive.shenhe.entity.ShyNotspeak;
  10 +import com.cnlive.shenhe.entity.ShySites;
  11 +import com.cnlive.shenhe.entity.ShyTopic;
  12 +import com.cnlive.shenhe.entity.ShyUsers;
  13 +import com.cnlive.shenhe.entity.ShyVideofilter;
  14 +import com.cnlive.shenhe.entity.ShyVideos;
  15 +import com.cnlive.shenhe.mapper.ShyCommentsMapper;
  16 +import com.cnlive.shenhe.mapper.ShyContentMapper;
  17 +import com.cnlive.shenhe.mapper.ShyNotspeakMapper;
  18 +import com.cnlive.shenhe.mapper.ShySitesMapper;
  19 +import com.cnlive.shenhe.mapper.ShyTopicMapper;
  20 +import com.cnlive.shenhe.mapper.ShyUsersMapper;
  21 +import com.cnlive.shenhe.utils.AntiFraudUtil;
  22 +import com.cnlive.shenhe.utils.AuditPass;
  23 +import com.cnlive.shenhe.utils.CommonConst;
  24 +import com.cnlive.shenhe.utils.CommonUtils;
  25 +import com.cnlive.shenhe.utils.TransitServiceUtils;
  26 +import com.github.pagehelper.PageHelper;
  27 +import com.github.pagehelper.PageInfo;
  28 +import org.apache.ibatis.session.RowBounds;
  29 +import org.slf4j.Logger;
  30 +import org.slf4j.LoggerFactory;
  31 +import org.springframework.beans.factory.annotation.Autowired;
  32 +import org.springframework.beans.factory.annotation.Value;
  33 +import org.springframework.stereotype.Service;
  34 +import tk.mybatis.mapper.entity.Example;
  35 +
  36 +import java.sql.Timestamp;
  37 +import java.text.ParseException;
  38 +import java.util.ArrayList;
  39 +import java.util.Date;
  40 +import java.util.HashMap;
  41 +import java.util.List;
  42 +import java.util.Map;
  43 +import java.util.UUID;
  44 +
  45 +/**
  46 + * @Auther: liwei
  47 + * @Date: 2019/1/2 11:30
  48 + * @Description:
  49 + */
  50 +@Service
  51 +public class NotspeakServiceImpl {
  52 +
  53 + private static Logger logger = LoggerFactory.getLogger(NotspeakServiceImpl.class);
  54 + @Autowired
  55 + ShyCommentsMapper shyCommentsMapper;
  56 + @Autowired
  57 + ShyNotspeakMapper shyNotspeakMapper;
  58 + @Autowired
  59 + ShySitesMapper shySitesMapper;
  60 + @Autowired
  61 + ShyUsersMapper shyUsersMapper;
  62 + @Autowired
  63 + TransitServiceUtils transitServiceUtils;
  64 + @Autowired
  65 + SitesServiceImpl sitesService;
  66 + @Autowired
  67 + VideosServiceImpl videosService;
  68 + @Autowired
  69 + VideofilterServiceImpl videofilterServiceImpl;
  70 + @Autowired
  71 + AuditPass Pass;
  72 +
  73 + @Value("${spring.localhost.url}")
  74 + String localhost_url;
  75 +
  76 + @Value("${speak_comment}")
  77 + String speak_comment;
  78 +
  79 + public ShyNotspeak getShySpeak(ShyNotspeak shyNotspeak) {
  80 + List<ShyNotspeak> shyNotspeakList = shyNotspeakMapper.select(shyNotspeak);
  81 + if(CommonUtils.isNotNull(shyNotspeakList)&&shyNotspeakList.size()>0){
  82 + return shyNotspeakList.get(0);
  83 + }
  84 + return new ShyNotspeak();
  85 + }
  86 +
  87 + //**************************************
  88 + public List<ShyNotspeak> findshyNotspeak(ShyNotspeak shyNotspeak) {
  89 +
  90 + return shyNotspeakMapper.selectByRowBounds(shyNotspeak, new RowBounds(0, 100));
  91 + }
  92 +
  93 + //***************************
  94 + public boolean updateshyNotspeak(ShyNotspeak shyNotspeak) {
  95 + int result = shyNotspeakMapper.updateByPrimaryKey(shyNotspeak);
  96 + if (result == 0) {
  97 + return false;
  98 + }
  99 + return true;
  100 + }
  101 +
  102 + //***************************
  103 + public boolean impotshyNotspeak(ShyNotspeak shyNotspeak) {
  104 + int result = shyNotspeakMapper.insertSelective(shyNotspeak);
  105 + if (result == 0) {
  106 + return false;
  107 + }
  108 + return true;
  109 + }
  110 +
  111 + public ResponseBean notSpeakByComment(Integer commentId,Integer time, String userId) {
  112 + ResponseBean success;
  113 + ShyComments comment = shyCommentsMapper.selectByPrimaryKey(commentId);
  114 + JSONObject json = new JSONObject();
  115 + json.put("sid", comment.getComment_user_id().toString());
  116 + json.put("type", CommonConst.SPEAK_NOT);
  117 + json.put("minute", time);
  118 + JSONObject result = new JSONObject();
  119 + try {
  120 + result = Pass.commentSpeak(json, speak_comment);
  121 + } catch (Exception e) {
  122 + logger.error("评论禁言失败,comments_id:{}", comment.getId());
  123 + success=new ResponseBean(500,"评论禁言调用互动云服务器失败!");
  124 + return success;
  125 + }
  126 + if (result == null) {
  127 + logger.error("评论禁言错误,且无返回信息。comments_id:{}", comment.getId());
  128 + success=new ResponseBean(500,"评论禁言调用互动云返回结果为空!");
  129 + return success;
  130 + } else {
  131 + Integer errorCode = result.getInteger("errorCode");
  132 + String errorMessage = result.getString("errorMessage");
  133 + if (errorCode != 0) {
  134 + logger.error("评论禁言错误,comments_id:{},errorCode:{},errorMessage:{}", comment.getId(), errorCode, errorMessage);
  135 + success=new ResponseBean(500,"评论禁言调用互动云返回结果errorCode不为0!");
  136 + return success;
  137 + }
  138 + comment.setState(CommonConst.AUDIT_REFUSE);
  139 + comment.setMsg("评论禁言操作");
  140 + comment.setAuditor_id(userId);
  141 + comment.setReceive(1);//已领取
  142 + comment.setReceive_user_id(userId);
  143 + int i = shyCommentsMapper.updateByPrimaryKeySelective(comment);
  144 + if (i != 1) {
  145 + success=new ResponseBean(500,"评论禁言修改当前评论数据失败!");
  146 + return success;
  147 + }
  148 + boolean res =writeNotSpeakByComment(commentId,time,userId);
  149 + if(res==false){
  150 + success=new ResponseBean(500,"评论禁言修改禁言表失败!");
  151 + return success;
  152 + }
  153 + }
  154 + return new ResponseBean();
  155 + }
  156 + public ResponseBean speak(Integer notSpeakId, Integer type,Integer time, String userId) {
  157 + ResponseBean success;
  158 + ShyNotspeak shyNotspeak=selectByPrimaryKey(notSpeakId);
  159 + JSONObject json = new JSONObject();
  160 + json.put("sid", shyNotspeak.getUser_id().toString());
  161 + json.put("type", type);
  162 + json.put("minute", time);
  163 + JSONObject result = new JSONObject();
  164 + try {
  165 + result = Pass.commentSpeak(json, speak_comment);
  166 + } catch (Exception e) {
  167 + logger.error("评论禁言失败,shyNotspeak_id:{}", shyNotspeak.getId());
  168 + success=new ResponseBean(500,"评论禁言调用互动云服务器失败!");
  169 + return success;
  170 + }
  171 + if (result == null) {
  172 + logger.error("评论禁言错误,且无返回信息。shyNotspeak_id:{}", shyNotspeak.getId());
  173 + success=new ResponseBean(500,"评论禁言调用互动云返回结果为空!");
  174 + return success;
  175 + } else {
  176 + Integer errorCode = result.getInteger("errorCode");
  177 + String errorMessage = result.getString("errorMessage");
  178 + if (errorCode != 0) {
  179 + logger.error("评论禁言错误,shyNotspeak_id:{},errorCode:{},errorMessage:{}", shyNotspeak.getId(), errorCode, errorMessage);
  180 + success=new ResponseBean(500,"评论禁言调用互动云返回结果errorCode不为0!");
  181 + return success;
  182 + }
  183 + String msg=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss")+"解除禁言";
  184 + shyNotspeak.setState(type);
  185 + if(type==CommonConst.SPEAK_NOT){
  186 + shyNotspeak.setStart_time(CommonUtils.getCurrentTime());
  187 + shyNotspeak.setTime(time);
  188 + shyNotspeak.setEnd_time(CommonUtils.getAddTime(time));
  189 + shyNotspeak.setCount(shyNotspeak.getCount()+1);
  190 + msg=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss")+"开始禁言,禁言时长为"+time+"分钟,禁言管理里面禁言的";
  191 + }
  192 + if(CommonUtils.isNotEmpty(userId)){
  193 + shyNotspeak.setAuditor(userId);
  194 + shyNotspeak.setUpdater("");
  195 + }
  196 + shyNotspeak.setUpdated_at(CommonUtils.getCurrentTime());
  197 + shyNotspeak.setMsg(shyNotspeak.getMsg()+"\n"+msg);
  198 + boolean res =updateshyNotspeak(shyNotspeak);
  199 + if(res==false){
  200 + success=new ResponseBean(500,"评论禁言修改禁言表失败!");
  201 + return success;
  202 + }
  203 +
  204 + }
  205 + return new ResponseBean();
  206 + }
  207 +
  208 +
  209 + public boolean writeNotSpeakByComment(Integer commentId,Integer time, String userId){
  210 + boolean result=false;
  211 + ShyComments comment = shyCommentsMapper.selectByPrimaryKey(commentId);
  212 + ShyNotspeak shyNotspeak=new ShyNotspeak();
  213 + shyNotspeak.setUser_id(comment.getComment_user_id());
  214 + String msg=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss")+"开始禁言,禁言时长为"+time+"分钟,禁言的评论为:'"+comment.getComment_content()+"'";
  215 +
  216 + List<ShyNotspeak> shyNotspeakList = shyNotspeakMapper.select(shyNotspeak);
  217 + if(CommonUtils.isNotNull(shyNotspeakList)&&shyNotspeakList.size()>0){
  218 + ShyNotspeak notspeak=shyNotspeakList.get(0);
  219 + notspeak.setUser_name(comment.getComment_user_name());
  220 + notspeak.setUser_avatar(comment.getComment_user_avatar());
  221 + notspeak.setSp_id(comment.getSpid());
  222 + notspeak.setState(CommonConst.SPEAK_NOT);
  223 + notspeak.setStart_time(CommonUtils.getCurrentTime());
  224 + notspeak.setTime(time);
  225 + notspeak.setEnd_time(CommonUtils.getAddTime(time));
  226 + notspeak.setUpdated_at(CommonUtils.getCurrentTime());
  227 + notspeak.setMsg(notspeak.getMsg()+"\n"+msg);
  228 + notspeak.setCount(notspeak.getCount()+1);
  229 + notspeak.setUpdater("");
  230 + notspeak.setAuditor(userId);
  231 + result=updateshyNotspeak(notspeak);
  232 + }else{
  233 + shyNotspeak.setUser_name(comment.getComment_user_name());
  234 + shyNotspeak.setUser_id(comment.getComment_user_id());
  235 + shyNotspeak.setUser_avatar(comment.getComment_user_avatar());
  236 + shyNotspeak.setSp_id(comment.getSpid());
  237 + shyNotspeak.setState(CommonConst.SPEAK_NOT);
  238 + shyNotspeak.setStart_time(CommonUtils.getCurrentTime());
  239 + shyNotspeak.setTime(time);
  240 + shyNotspeak.setEnd_time(CommonUtils.getAddTime(time));
  241 + shyNotspeak.setCreated_at(CommonUtils.getCurrentTime());
  242 + shyNotspeak.setUpdated_at(CommonUtils.getCurrentTime());
  243 + shyNotspeak.setMsg(msg);
  244 + shyNotspeak.setCount(1);
  245 + shyNotspeak.setUpdater("");
  246 + shyNotspeak.setAuditor(userId);
  247 + result=impotshyNotspeak(shyNotspeak);
  248 +
  249 + }
  250 + return result;
  251 + }
  252 +
  253 + public PageInfo<ShyNotspeak> getPage( String user_name, Integer user_id,Integer state,
  254 + Integer page, Integer pageSize, String orderByClause) {
  255 + Example example = new Example(ShyNotspeak.class);
  256 + Example.Criteria criteria = example.createCriteria();
  257 + if (CommonUtils.isNotEmpty(orderByClause)) {
  258 + example.setOrderByClause(orderByClause);
  259 + } else {
  260 + example.setOrderByClause("state desc , end_time");
  261 + }
  262 + if (CommonUtils.isNotEmpty(user_name)) {
  263 + criteria.andLike("user_name", "%" + user_name + "%");
  264 + }
  265 + if (CommonUtils.isNotNull(user_id)) {
  266 + criteria.andEqualTo("user_id", user_id);
  267 + }
  268 + if (CommonUtils.isNotNull(state)) {
  269 + criteria.andEqualTo("state", state);
  270 + }
  271 +
  272 + PageHelper.startPage(page, pageSize, true);
  273 + List<ShyNotspeak> shyNotspeakList = shyNotspeakMapper.selectByExample(example);
  274 + PageInfo<ShyNotspeak> pageInfo = new PageInfo<>(shyNotspeakList);
  275 + return pageInfo;
  276 + }
  277 +
  278 +
  279 + //**************************************
  280 + public ShyNotspeak selectByPrimaryKey(Integer id) {
  281 + ShyNotspeak shyNotspeak = shyNotspeakMapper.selectByPrimaryKey(id);
  282 + return shyNotspeak;
  283 + }
  284 +
  285 + public int updateByPrimaryKeySelective(ShyNotspeak shyNotspeak) {
  286 + return shyNotspeakMapper.updateByPrimaryKeySelective(shyNotspeak);
  287 + }
  288 +
  289 +
  290 +}
  291 +
  292 +
... ...
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
... ... @@ -148,6 +148,19 @@ public class AuditPass {
148 148 String result = HttpUtil.form(callBack, map);
149 149 return JSONObject.parseObject(result);
150 150 }
  151 + /**
  152 + * 评论禁言
  153 + * @param json
  154 + * @param callBack
  155 + * @return
  156 + */
  157 + public JSONObject commentSpeak(JSONObject json, String callBack) {
  158 + logger.info("评论禁言:param:{}", json);
  159 + Map<String, String> map = new HashMap<>();
  160 + map.put("param", json.toJSONString());
  161 + String result = HttpUtil.form(callBack, map);
  162 + return JSONObject.parseObject(result);
  163 + }
151 164  
152 165 /**
153 166 * 频道审核回调
... ...
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
... ... @@ -34,6 +34,14 @@ public class CommonConst {
34 34 * 审核类型:人工审
35 35 */
36 36 public static Integer AUDIT_TYPE_USER = 3;
  37 + /**
  38 + * 禁言状态:禁言
  39 + */
  40 + public static Integer SPEAK_NOT = 1;
  41 + /**
  42 + * 禁言状态:解禁
  43 + */
  44 + public static Integer SPEAK_YES = 0;
37 45  
38 46 /**
39 47 * 审核状态:白名单通过回调失败
... ...
src/main/java/com/cnlive/shenhe/utils/CommonUtils.java
... ... @@ -42,6 +42,10 @@ public class CommonUtils {
42 42 public static Timestamp getCurrentTime() {
43 43 return new Timestamp(new Date().getTime());
44 44 }
  45 + //获取当前时间加上一个时间(分钟算)
  46 + public static Timestamp getAddTime(Integer addTime) {
  47 + return new Timestamp(new Date().getTime()+addTime*60*1000);
  48 + }
45 49  
46 50 public static String getRandowUUID() {
47 51 UUID uuid = UUID.randomUUID();
... ...
src/main/resources/application.properties
... ... @@ -55,6 +55,9 @@ topic_comment_shareH5=http://www.baidu.com?id=
55 55 #\u5173\u95edspringboot\u63d0\u4f9b\u7684\u9ed8\u8ba4ico
56 56 spring.mvc.favicon.enabled = false
57 57  
  58 +#\u8bc4\u8bba\u7981\u8a00\u548c\u89e3\u7981\u4f7f\u7528API
  59 +speak_comment=http://comment.cnlive.com/services/commentForTopic/muted
  60 +
58 61 #logback\u65e5\u5fd7\u4e2d\u4f7f\u7528
59 62 spring.application.name=cnlive_shenhe_test
60 63 spring.application.home=/usr/local/test_cnlive_shenhe/cnlive_shenhe/log
... ...
src/main/resources/mapper/ShyNotspeakMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.cnlive.shenhe.mapper.ShyNotspeakMapper">
  4 + <resultMap id="BaseResultMap" type="com.cnlive.shenhe.entity.ShyNotspeak">
  5 + <!--
  6 + WARNING - @mbg.generated
  7 + -->
  8 + <id column="id" jdbcType="INTEGER" property="id" />
  9 + <result column="user_name" jdbcType="VARCHAR" property="user_name" />
  10 + <result column="user_id" jdbcType="INTEGER" property="user_id" />
  11 + <result column="user_avatar" jdbcType="VARCHAR" property="user_avatar" />
  12 + <result column="sp_id" jdbcType="INTEGER" property="sp_id" />
  13 + <result column="state" jdbcType="INTEGER" property="state" />
  14 + <result column="start_time" jdbcType="TIMESTAMP" property="start_time" />
  15 + <result column="time" jdbcType="INTEGER" property="time" />
  16 + <result column="end_time" jdbcType="TIMESTAMP" property="end_time" />
  17 + <result column="count" jdbcType="INTEGER" property="count" />
  18 + <result column="created_at" jdbcType="TIMESTAMP" property="created_at" />
  19 + <result column="updated_at" jdbcType="TIMESTAMP" property="updated_at" />
  20 + <result column="updater" jdbcType="VARCHAR" property="updater" />
  21 + <result column="auditor" jdbcType="VARCHAR" property="auditor" />
  22 + <result column="msg" jdbcType="LONGVARCHAR" property="msg" />
  23 + </resultMap>
  24 +</mapper>
0 25 \ No newline at end of file
... ...
src/main/resources/templates/common/frame.html
... ... @@ -93,6 +93,7 @@ line-height: 2em; margin: 0 auto;font-size: 2em&quot; th:text=&quot;${session.sessionUser.
93 93 <li><a href="/sites/page" id="/sites/page"> SP白名单管理</a></li>
94 94 <li><a href="/usersFree/page" id="/usersFree/page"> 网++白名单管理</a></li>
95 95 <li><a href="/email/page" id="/email/page"> 邮件消息管理</a></li>
  96 + <li><a href="/notSpeak/page?state=1" id="/notSpeak/page"> 禁言管理</a></li>
96 97 </ul>
97 98 </li>
98 99 </ul>
... ...
src/main/resources/templates/page/comment.html
... ... @@ -811,9 +811,8 @@
811 811 var noSpeak_hours = Number($("#noSpeak_hours").val());
812 812 var noSpeak_minutes = Number($("#noSpeak_minutes").val());
813 813 var time=noSpeak_days*24*60+noSpeak_hours*60+noSpeak_minutes;//单位为分钟
814   - var type=1;//禁言类型, 1:禁言 2:解禁
815 814 // alert(comments_id);
816   - $.post("/comments/notSpeak?id=" + comments_id + "&type=" + type+ "&time=" + time, function (data) {
  815 + $.post("/notSpeak/notSpeakByComment?commentId=" + comments_id + "&time=" + time, function (data) {
817 816 if (data.errorCode == 0) {
818 817 alert(data.errorMessage);
819 818 location.href = location.href;
... ...
src/main/resources/templates/page/notspeak.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
  3 +
  4 +<head th:replace="../templates/common/head::head"></head>
  5 +<style type="text/css">
  6 + .fixed-table-toolbar .bs-bars, .fixed-table-toolbar .columns, .fixed-table-toolbar .search{margin-top: 0px;}
  7 + .table{margin-bottom:0;}
  8 +
  9 +
  10 + .switch {
  11 + position: relative;
  12 + display: inline-block;
  13 + width: 60px;
  14 + height: 34px;
  15 +}
  16 +
  17 +.switch input {display:none;}
  18 +
  19 +.slider {
  20 + position: absolute;
  21 + cursor: pointer;
  22 + top: 0;
  23 + left: 0;
  24 + right: 0;
  25 + bottom: 0;
  26 + background-color: red;
  27 + -webkit-transition: .4s;
  28 + transition: .4s;
  29 +}
  30 +
  31 +.slider:before {
  32 + position: absolute;
  33 + content: "";
  34 + height: 26px;
  35 + width: 26px;
  36 + left: 4px;
  37 + bottom: 4px;
  38 + background-color: white;
  39 + -webkit-transition: .4s;
  40 + transition: .4s;
  41 +}
  42 +
  43 +input:checked + .slider {
  44 + background-color: #2196F3;
  45 +}
  46 +
  47 +input:focus + .slider {
  48 + box-shadow: 0 0 1px #2196F3;
  49 +}
  50 +
  51 +input:checked + .slider:before {
  52 + -webkit-transform: translateX(26px);
  53 + -ms-transform: translateX(26px);
  54 + transform: translateX(26px);
  55 +}
  56 +
  57 +/* Rounded sliders */
  58 +.slider.round {
  59 + border-radius: 34px;
  60 +}
  61 +
  62 +.slider.round:before {
  63 + border-radius: 50%;
  64 +}
  65 +
  66 +</style>
  67 +<body class="skin-blue sidebar-mini">
  68 +
  69 +<div class="wrapper">
  70 +
  71 + <div th:replace="../templates/common/frame::frame"></div>
  72 +
  73 + <div class="content-wrapper" style="min-height: 788px;">
  74 + <section class="content-header">
  75 + <h1>
  76 + 禁言管理
  77 + </h1>
  78 + <ol class="breadcrumb">
  79 + <li>首页</li>
  80 + <li>系统管理</li>
  81 + <li class="active">禁言管理</li>
  82 + </ol>
  83 + </section>
  84 + <section class="content">
  85 + <div class="row">
  86 + <div class="col-md-12">
  87 + <div class="box box-info">
  88 + <div class="box-body">
  89 + <div class="clearfix">
  90 + <div class="btn-group margin-bottom pull-right">
  91 + <div class="btn-group margin-bottom">
  92 + <button type="button" id="quanbu"
  93 + class="btn btn-sm margin-r-5 action_bottom"
  94 + th:onclick="'javascript:quanbu()'">全部
  95 + </button>
  96 + <button type="button" id="jinyan"
  97 + class="btn btn-sm margin-r-5 action_bottom"
  98 + >禁言中
  99 + </button>
  100 + <button type="button" id="jiejin"
  101 + class="btn btn-sm margin-r-5 action_bottom"
  102 + >已解禁
  103 + </button>
  104 +<!-- <button type="button" id="yishen" -->
  105 +<!-- class="btn btn-sm margin-r-5 action_bottom" -->
  106 +<!-- >我的已审 -->
  107 +<!-- </button> -->
  108 + </div>
  109 + <button type="button" class="btn btn-primary btn-sm margin-r-5" id="query"
  110 + onclick="openOrClose(&#39;forms&#39;)">高级查询
  111 + <span id="a_up">▼</span><span id="a_down" style="display: none;">▲</span>
  112 + </button>
  113 + </div>
  114 + </div>
  115 +
  116 +
  117 + <div class="form-horizontal form-group-sm" id="forms" style="display: none;">
  118 + <form id="commentForm">
  119 + <div class="btn-group margin-bottom col-md-6" style="padding: 0;">
  120 + <div class="col-md-5" style="padding: 0">
  121 + <label for="user_id" class="control-label cb-toolbar">用户id:</label>
  122 + <div class="col-sm-8" style="padding: 0;">
  123 + <input class="form-control" name="user_id" type="text"
  124 + id="user_id" >
  125 + </div>
  126 + </div>
  127 + <div class="col-md-5" style="padding: 0">
  128 + <label for="user_name" class="control-label cb-toolbar">用户昵称:</label>
  129 + <div class="col-sm-8" style="padding: 0;">
  130 + <input class="form-control" name="user_name" type="text" id="user_name" >
  131 + </div>
  132 + </div>
  133 +<!-- <div class="col-md-3" style="padding: 0"> -->
  134 +<!-- <label for="state" class="control-label cb-toolbar">状态:</label> -->
  135 +<!-- <div class="col-sm-6" style="padding: 0;"> -->
  136 +<!-- <select class="form-control col-sm-2" id="state" name="state"> -->
  137 +<!-- <option value="">全部</option> -->
  138 +<!-- <option value="0" >已解禁</option> -->
  139 +<!-- <option value="1" >禁言中</option> -->
  140 +<!-- </select> -->
  141 +<!-- </div> -->
  142 +<!-- </div> -->
  143 +
  144 + </div>
  145 +
  146 + </form>
  147 +
  148 + </div>
  149 +
  150 +
  151 + <div class="fixed-table-container" style="padding-bottom: 0px;">
  152 + <div class="fixed-table-body">
  153 + <table data-toggle="table" data-pagination="true" data-search="false" data-show-refresh="true"
  154 + data-show-toggle="true" data-show-columns="true" data-toolbar="#toolbar" class="table table-hover">
  155 + <thead>
  156 + <tr>
  157 + <th style="text-align: center; width: 3%;" data-field="sp_id" tabindex="0">
  158 + <div class="th-inner ">用户ID</div>
  159 + <div class="fht-cell"></div>
  160 + </th>
  161 + <th style="text-align: center; width: 10%;" data-field="sp_id_brief" tabindex="0">
  162 + <div class="th-inner ">用户昵称</div>
  163 + <div class="fht-cell"></div>
  164 + </th>
  165 + <th style="text-align: center; width: 5%;" data-field="type" tabindex="0">
  166 + <div class="th-inner ">用户头像</div>
  167 + <div class="fht-cell"></div>
  168 + </th>
  169 + <th style="text-align: center; width: 3%;" data-field="type" tabindex="0">
  170 + <div class="th-inner ">使用平台</div>
  171 + <div class="fht-cell"></div>
  172 + </th>
  173 + <th style="text-align: center; width: 3%;" data-field="type" tabindex="0">
  174 + <div class="th-inner ">禁言状态</div>
  175 + <div class="fht-cell"></div>
  176 + </th>
  177 + <th style="text-align: center; width: 3%;" data-field="type" tabindex="0">
  178 + <div class="th-inner ">禁言次数</div>
  179 + <div class="fht-cell"></div>
  180 + </th>
  181 + <th style="text-align: center; width: 3%;" data-field="type" tabindex="0">
  182 + <div class="th-inner ">修改人</div>
  183 + <div class="fht-cell"></div>
  184 + </th>
  185 + <th style="text-align: center; width: 10%;" data-field="upload_time" tabindex="0">
  186 + <div class="th-inner ">禁言开始时间</div>
  187 + <div class="fht-cell"></div>
  188 + </th>
  189 + <th style="text-align: center; width: 10%;" data-field="updated_at" tabindex="0">
  190 + <div class="th-inner ">禁言结束时间</div>
  191 + <div class="fht-cell"></div>
  192 + </th>
  193 + <th style="text-align: center; width: 30%;" data-field="msg" tabindex="0">
  194 + <div class="th-inner ">禁言消息</div>
  195 + <div class="fht-cell"></div>
  196 + </th>
  197 +<!-- <th style="text-align: center; width: 10%;" data-field="action" tabindex="0"> -->
  198 +<!-- <div class="th-inner ">操作</div> -->
  199 +<!-- <div class="fht-cell"></div> -->
  200 +<!-- </th> -->
  201 + </tr>
  202 + </thead>
  203 + <tbody>
  204 + <tr th:data-index="${notspeakStat.index}" th:each="notspeak : ${notspeakPage.list}">
  205 + <td style="text-align: center; width: 5%;" th:text="${notspeak.user_id}">82</td>
  206 + <td style="text-align: center; width: 6%;" th:text="${notspeak.user_name}">视讯中国</td>
  207 + <td style="text-align: center; width: 6%;" >
  208 + <div style="width:60px;height:60px;"><img
  209 + th:src="@{${notspeak.user_avatar}}" width="60px"
  210 + alt="用户头像"></div>
  211 + </td>
  212 + <td style="text-align: center; width: 6%;" th:text="${notspeak.spid_desc}"></td>
  213 + <td style="text-align: center; width: 6%;" th:if="${notspeak.state==0}">
  214 + <label class="switch"><input type="checkbox" checked th:id="'id'+${notspeak.id}" th:user_name="${notspeak.user_name}" th:spid_desc="${notspeak.spid_desc}"><span class="slider round" th:id="${notspeak.id}"></span></label>
  215 + </td>
  216 + <td style="text-align: center; width: 6%;" th:if="${notspeak.state==1}">
  217 + <label class="switch"><input type="checkbox" th:id="'id'+${notspeak.id}" th:user_name="${notspeak.user_name}" th:spid_desc="${notspeak.spid_desc}"><span class="slider round" th:id="${notspeak.id}"></span></label>
  218 + </td>
  219 + <td style="text-align: center; width: 6%;" th:text="${notspeak.count}"></td>
  220 + <td style="text-align: center; width: 6%;" th:text="${notspeak.updater}"></td>
  221 + <td style="text-align: center; width: 10%;" th:text="${#dates.format(notspeak.start_time, 'yyyy-MM-dd HH:mm:ss')}">2018-11-22
  222 + 23:08:48</td>
  223 + <td style="text-align: center; width: 10%;" th:text="${#dates.format(notspeak.end_time, 'yyyy-MM-dd HH:mm:ss')}">2016-08-03
  224 + 14:27:17</td>
  225 + <td style="text-align: center; width: 25%;" >
  226 +<!-- <span th:text="${notspeak.msg}"></span> -->
  227 + <textarea class="form-control" name="msg" cols="50" rows="3"
  228 + id="msg" th:text="${notspeak.msg}">禁言信息</textarea>
  229 + </td>
  230 +<!-- <td style="text-align: center; width: 10%;"> -->
  231 +<!-- <span>&nbsp;</span> -->
  232 +<!-- <a class="edit" th:href="'javascript:edit('+${notspeak.id}+',\''+${notspeak.user_name}+'\',\''+${notspeak.time}+'\',\''+${notspeak.time} +'\')'"> -->
  233 +<!-- <button class="btn btn-danger btn-xs">禁言</button> -->
  234 +<!-- </a><span> </span><span>&nbsp;</span> -->
  235 +<!-- <span>&nbsp;</span> -->
  236 +<!-- <a class="delete" th:href="'javascript:deleted('+${notspeak.id}+')'"> -->
  237 +<!-- <button class="btn btn-primary btn-xs">解除</button> -->
  238 +<!-- </a><span> </span><span>&nbsp;</span></td> -->
  239 + </tr>
  240 +
  241 + </tbody>
  242 + </table>
  243 + </div>
  244 +
  245 + <div class="fixed-table-pagination" style="display: block;">
  246 + <div class="pull-left pagination-detail">
  247 + <span class="pagination-info"
  248 + th:text="'共 '+${notspeakPage.total}+' 条记录,每页显示'">共 0 条记录</span>
  249 + <select class="" id="pageSize" name="pageSize"
  250 + onchange="selectPageSize()">
  251 + <option value="10" th:selected="${pageSize==10}">10</option>
  252 + <option value="20" th:selected="${pageSize==20}">20</option>
  253 + <option value="50" th:selected="${pageSize==50}">50</option>
  254 + <option value="100" th:selected="${pageSize==100}">100</option>
  255 + </select> <span class="pagination-info">条记录</span>
  256 + </div>
  257 + <div class="pull-right pagination">
  258 + <ul class="pagination" th:if="${notspeakPage.pages>1}">
  259 + <li class="page-pre"><a
  260 + th:href="'javascript:fanye(1);'">‹‹</a></li>
  261 + <li class="page-pre" th:if="${!notspeakPage.isFirstPage}"><a
  262 + th:onclick="'javascript:fanye(\''+${notspeakPage.pageNum-1}+'\');'">‹</a>
  263 + </li>
  264 +
  265 + <li class="page-number" th:if="${notspeakPage.pageNum-3>=1}"><a
  266 + th:onclick="'javascript:fanye(\''+${notspeakPage.pageNum-3}+'\');'"
  267 + th:text="${notspeakPage.pageNum-3}">2</a></li>
  268 + <li class="page-number" th:if="${notspeakPage.pageNum-2>=1}"><a
  269 + th:onclick="'javascript:fanye(\''+${notspeakPage.pageNum-2}+'\');'"
  270 + th:text="${notspeakPage.pageNum-2}">2</a></li>
  271 + <li class="page-number" th:if="${notspeakPage.pageNum-1>=1}"><a
  272 + th:onclick="'javascript:fanye(\''+${notspeakPage.pageNum-1}+'\');'"
  273 + th:text="${notspeakPage.pageNum-1}">2</a></li>
  274 + <li class="page-number active"><a
  275 + href="javaScript:void(0);" th:text="${notspeakPage.pageNum}">2</a></li>
  276 + <li class="page-number"
  277 + th:if="${notspeakPage.pageNum+1<=notspeakPage.pages}"><a
  278 + th:onclick="'javascript:fanye(\''+${notspeakPage.pageNum+1}+'\');'"
  279 + th:text="${notspeakPage.pageNum+1}">2</a></li>
  280 + <li class="page-number"
  281 + th:if="${notspeakPage.pageNum+2<=notspeakPage.pages}"><a
  282 + th:onclick="'javascript:fanye(\''+${notspeakPage.pageNum+2}+'\');'"
  283 + th:text="${notspeakPage.pageNum+2}">2</a></li>
  284 + <li class="page-number"
  285 + th:if="${notspeakPage.pageNum+3<=notspeakPage.pages}"><a
  286 + th:onclick="'javascript:fanye(\''+${notspeakPage.pageNum+3}+'\');'"
  287 + th:text="${notspeakPage.pageNum+3}">2</a></li>
  288 +
  289 + <li class="page-next" th:if="${!notspeakPage.isLastPage}"><a
  290 + th:onclick="'javascript:fanye(\''+${notspeakPage.pageNum+1}+'\');'">›</a>
  291 + </li>
  292 + <li class="page-next"><a
  293 + th:onclick="'javascript:fanye(\''+${notspeakPage.pages}+'\');'">››</a>
  294 + </li>
  295 + </ul>
  296 + </div>
  297 + </div>
  298 + </div>
  299 + </div>
  300 + <div class="clearfix"></div>
  301 + </div>
  302 + </div>
  303 + </div>
  304 + </section>
  305 + </div>
  306 +
  307 +<!-- 模态框(Modal) -->
  308 +<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  309 + <div class="modal-dialog">
  310 + <div class="modal-content" style="margin-top: 30%;">
  311 + <div class="modal-header">
  312 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  313 + <h4 class="modal-title" id="myModalLabel">编辑邮件消息</h4>
  314 + </div>
  315 + <div class="modal-body">
  316 + <form action="/notspeak/write" method="post" id="editWrite">
  317 + <input type="text" name="redirect_url" value="" class="hide" id="redirect_url"/>
  318 + <div class="form-group hide">
  319 + <label class="control-label col-sm-3" style="font-size: 15px;" >Id:</label>
  320 + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;">
  321 + <input class="form-control" style="width:30%;" type="text" value="" id="id" name="id">
  322 + </div>
  323 + </div>
  324 + <div class="form-group">
  325 + <label class="control-label col-sm-3" style="font-size: 15px;">邮件地址:</label>
  326 + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;">
  327 + <input class="form-control" style="width:40%;" type="text" value="" id="notspeak_edit" name="notspeak">
  328 + </div>
  329 + </div>
  330 + <div class="form-group">
  331 + <label class="control-label col-sm-3" style="font-size: 15px;">邮件人:</label>
  332 + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;">
  333 + <input class="form-control" style="width:20%;" type="text" value="" id="remark_edit" name="remark">
  334 + </div>
  335 + </div>
  336 +
  337 + <div class="form-group">
  338 + <label class="control-label col-sm-3" style="font-size: 15px;">邮件类型:</label>
  339 + <div class="col-sm-9" style="float: left">
  340 + <div th:each="bu:${notspeak_message}" style="padding-right: 30px;" class="write_check">
  341 + <span th:text="${bu.value}" style="font-size: 15px"></span>
  342 + <input type="checkbox" name="write_business" th:value="${bu.key}" th:id="'write_check_'+${bu.key}">
  343 + </div>
  344 + </div>
  345 + </div>
  346 +
  347 + </form>
  348 + </div>
  349 + <div class="modal-footer">
  350 + <button type="button" class="btn btn-primary" onclick="javascript:$('#editWrite').submit();">提交</button>
  351 + <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  352 + </div>
  353 + </div><!-- /.modal-content -->
  354 + </div><!-- /.modal-dialog -->
  355 +</div>
  356 +<!-- /.modal -->
  357 + <!-- 模态框,禁言框(Modal) -->
  358 +<div class="modal fade" id="speakModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  359 + <div class="modal-dialog">
  360 + <div class="modal-content" style="margin-top: 30%;">
  361 + <div class="modal-header">
  362 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  363 + <h4 class="modal-title" id="myModalLabel">禁言选项</h4>
  364 + </div>
  365 + <div class="modal-body">
  366 + <input type="text" name="speak_id" value="" class="hide" id="speak_id"/>
  367 + <div class="form-group">
  368 + <label class="control-label col-sm-3" style="font-size: 15px;" >用户昵称:</label>
  369 + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;">
  370 + <input class="form-control" readonly="readonly" style="width:40%;" type="text" value="" id="userName" name="userName">
  371 + </div>
  372 + </div>
  373 + <div class="form-group">
  374 + <label class="control-label col-sm-3" style="font-size: 15px;">发言平台:</label>
  375 + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;">
  376 + <input class="form-control" readonly="readonly" style="width:40%;" type="text" value="" id="sp_desc" name="sp_desc">
  377 + </div>
  378 + </div>
  379 + <div class="form-group">
  380 + <label class="control-label col-sm-3" style="font-size: 15px;">禁言时长:</label>
  381 + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;">
  382 + <input class="form-control" onkeyup="value=value.replace(/[^\d]/g,'')" style="display:inline;width:10%;" type="text" value="0" id="noSpeak_days" name="noSpeak_days">
  383 + <span>&nbsp;&nbsp;天&nbsp;&nbsp;</span>
  384 + <input class="form-control" onkeyup="value=value.replace(/[^\d]/g,'')" style="display:inline;width:10%;" type="text" value="0" id="noSpeak_hours" name="noSpeak_hours">
  385 + <span>&nbsp;&nbsp;时&nbsp;&nbsp;</span>
  386 + <input class="form-control" onkeyup="value=value.replace(/[^\d]/g,'')" style="display:inline;width:10%;" type="text" value="0" id="noSpeak_minutes" name="noSpeak_minutes">
  387 + <span>&nbsp;&nbsp;分&nbsp;&nbsp;</span>
  388 + </div>
  389 + </div>
  390 + </div>
  391 + <div class="modal-footer">
  392 + <button type="button" class="btn btn-primary" onclick="javascript:submitSpeak();">提交</button>
  393 + <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  394 + </div>
  395 + </div><!-- /.modal-content -->
  396 + </div><!-- /.modal-dialog -->
  397 +</div>
  398 +<!-- /.modal -->
  399 + <script th:inline="javascript">
  400 + $(function () {
  401 + //按钮颜色设置
  402 + var state = [[${param.state}]] ? [[${param.state}]][0] : null;
  403 + var stateIsNull = $.trim(state) == "";
  404 + if ( stateIsNull) {
  405 + $("#quanbu").addClass("btn-info");
  406 + } else if (state == '1') {
  407 + $("#jinyan").addClass("btn-warning");
  408 + } else if (state == '0') {
  409 + $("#jiejin").addClass("btn-success");
  410 + }
  411 +// else if (!stateIsNull && state != '0' && receive == '1') {
  412 +// $("#yishen").addClass("btn-danger");
  413 +// }
  414 +
  415 + })
  416 + //打开编辑窗口
  417 + function edit(Id,notspeak,remark,write_business){
  418 + $("#myModalLabel").text("编辑邮件消息");
  419 + $("#id").val(Id);
  420 + $("#notspeak_edit").val(notspeak);
  421 + $("#notspeak_edit").attr("readonly","true");
  422 + $("#remark_edit").val(remark);
  423 + $("#redirect_url").val(location.pathname+location.search);
  424 + $(".write_check input").prop("checked",false);
  425 + if($.trim(write_business)!=''){
  426 + var array = write_business.split(",")
  427 + for (var i=0;i<array.length;i++){
  428 + $("#write_check_"+array[i]).prop("checked",true);
  429 + }
  430 + }
  431 + $('#editModal').modal('show');
  432 + }
  433 +
  434 + //打开添加窗口
  435 + function add(){
  436 + $("#id").val("");
  437 + $("#notspeak_edit").val("");
  438 + $("#notspeak_edit").removeAttr("readonly");
  439 + $("#remark_edit").val("");
  440 + $(".write_check input").prop("checked",false);
  441 +
  442 + $("#redirect_url").val(location.pathname+location.search);
  443 + $("#myModalLabel").text("添加邮件消息");
  444 + $('#editModal').modal('show');
  445 + }
  446 +
  447 + //删除操作
  448 +// function deleted(id){
  449 +// var r = confirm("您确定删除本条内容吗?");
  450 +// if (r == true) {
  451 +// $.post("/notspeak/deleted?id=" + id, function (data) {
  452 +// if (data.errorCode == 0) {
  453 +// alert(data.errorMessage);
  454 +// location.href = location.href;
  455 +// } else {
  456 +// alert(data.errorMessage);
  457 +// }
  458 +// })
  459 +// }
  460 +// }
  461 +
  462 + var user_id ="";//活动id
  463 + var user_name = "";//内容
  464 + var state ="";//状态
  465 + var count = "";//每页显示数量
  466 +
  467 + function query(){
  468 + user_id = $("#user_id").val();
  469 + user_name = $("#user_name").val();
  470 + count = $("#pageSize").val();
  471 + window.location.href = "/notSpeak/page?user_id=" + user_id + "&user_name=" + user_name + "&state=" + state + "&pageSize="+count;
  472 + }
  473 +
  474 + //全部
  475 + function quanbu() {
  476 + query();
  477 + }
  478 +
  479 + //禁言
  480 + $('#jinyan').click(function () {
  481 + state=1;
  482 + query();
  483 + });
  484 + //解禁
  485 + $('#jiejin').click(function () {
  486 + state=0;
  487 + query();
  488 + });
  489 +
  490 + //开关的点击事件
  491 + $(".slider").on('click',function(e){
  492 + var myId=$(this).prop("id");
  493 + // var myIndex = $(".slider").index($(this));
  494 + var checked=$("#id"+myId).prop("checked");//获取当前状态,下一个状态用!checked表示
  495 + var user_name=$("#id"+myId).attr("user_name");
  496 + var spid_desc=$("#id"+myId).attr("spid_desc");
  497 + if(checked){//当前用户没有被禁言,现在要执行禁言操作
  498 + speakModal(myId,user_name,spid_desc);
  499 + }else{//当前用户已被禁言,现在执行解除禁言操作
  500 + var r = confirm("您确定要解除当前用户的禁言操作吗?");
  501 + if (r == true) {
  502 + $.post("/notSpeak/speak?notSpeakId=" + myId+"&type=0&time=0", function (data) {
  503 + if (data.errorCode == 0) {
  504 + alert(data.errorMessage);
  505 + location.href = location.href;
  506 + } else {
  507 + alert(data.errorMessage);
  508 + location.href = location.href;
  509 + }
  510 + })
  511 + }
  512 + }
  513 + })
  514 +
  515 + //禁言(弹窗)
  516 + function speakModal(speak_id,userName,sp_desc) {
  517 + $('#speak_id').val(speak_id);
  518 + $('#userName').val(userName);
  519 + $('#sp_desc').val(sp_desc);
  520 + $('#speakModal').modal('show');
  521 + }
  522 +
  523 + //提交禁言
  524 + function submitSpeak() {
  525 + var speak_id = $("#speak_id").val();
  526 + var noSpeak_days = Number($("#noSpeak_days").val());
  527 + var noSpeak_hours = Number($("#noSpeak_hours").val());
  528 + var noSpeak_minutes = Number($("#noSpeak_minutes").val());
  529 + var time=noSpeak_days*24*60+noSpeak_hours*60+noSpeak_minutes;//单位为分钟
  530 + $.post("/notSpeak/speak?notSpeakId=" + speak_id + "&time=" + time+ "&type=1", function (data) {
  531 + if (data.errorCode == 0) {
  532 + alert(data.errorMessage);
  533 + location.href = location.href;
  534 + } else {
  535 + alert(data.errorMessage);
  536 + }
  537 + })
  538 + }
  539 +
  540 + //翻页函数
  541 + function fanye(page) {
  542 + var param = location.search;
  543 + if (param.indexOf("page=") != -1) {
  544 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  545 + var split = se.split("&");
  546 + var h = "";
  547 + for (var i = 0; i < split.length; i++) {
  548 + var s = split[i];
  549 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
  550 + }
  551 + h = h.substring(1, h.length);
  552 + window.location.href = "/notSpeak/page?" + h + "&page=" + page;
  553 + } else {
  554 + param = param.substring(1, param.length);
  555 + window.location.href = "/notSpeak/page?" + param + "&page=" + page;
  556 + }
  557 + }
  558 +
  559 + //选择每页数量触发函数
  560 + function selectPageSize(){
  561 + var pageSize=$("#pageSize").val();
  562 + var param = location.search;
  563 + if (param.indexOf("pageSize=") != -1) {
  564 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  565 + var split = se.split("&");
  566 + var h = "";
  567 + for (var i = 0; i < split.length; i++) {
  568 + var s = split[i];
  569 + if (s.indexOf("pageSize=") < 0 &&s.indexOf("page=") < 0) h = h + "&" + split[i];
  570 + }
  571 + h = h.substring(1, h.length);
  572 + window.location.href = "/notSpeak/page?" + h + "&pageSize=" + pageSize;
  573 + } else {
  574 + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连
  575 + var split = se.split("&");
  576 + var h = "";
  577 + for (var i = 0; i < split.length; i++) {
  578 + var s = split[i];
  579 + if (s.indexOf("page=") < 0) h = h + "&" + split[i];
  580 + }
  581 + h = h.substring(1, h.length);
  582 + window.location.href = "/notSpeak/page?" + h + "&pageSize=" + pageSize;
  583 + }
  584 + }
  585 +
  586 +
  587 + //鼠标回车事件
  588 +// $(document).keyup(function(event){
  589 +// if(event.keyCode ==13){
  590 +// $("#notspeakQuery").trigger("click");
  591 +// }
  592 +// });
  593 +
  594 +
  595 + /*查询样式*/
  596 + function openOrClose(id_name_str) {
  597 + var id_name = '#' + id_name_str;
  598 + if ($(id_name).css('display') == 'block') {
  599 + $(id_name).slideUp(350);
  600 + $('#a_up').show();
  601 + $('#a_down').hide();
  602 + } else {
  603 + $(id_name).slideDown(350);
  604 + $('#a_up').hide();
  605 + $('#a_down').show();
  606 + }
  607 + }
  608 + </script>
  609 +
  610 + <footer th:replace="../templates/common/foot::foot" ></footer>
  611 +
  612 +
  613 + <!-- Add the sidebar's background. This div must be placed
  614 + immediately after the control sidebar -->
  615 + <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div>
  616 +
  617 +</div><!-- ./wrapper -->
  618 +
  619 +
  620 +<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  621 +<script type="text/javascript">
  622 + $('div.alert').not('.alert-danger').delay(3000).slideUp(300);
  623 +</script>
  624 +
  625 +<!-- AdminLTE App -->
  626 +<script src="../../static/js/app.min.js"></script>
  627 +<!-- AdminLTE for demo purposes -->
  628 +<script src="../../static/js/sidebar.js"></script>
  629 +
  630 +
  631 +</body>
  632 +</html>
0 633 \ No newline at end of file
... ...