Commit df0aa7926d8902ecac1a649d1334fee082517e1a

Authored by liwei2917
1 parent 529a0c92

审核云error页面动态获取失败数据

src/main/java/com/cnlive/shenhe/controller/BaseController.java
... ... @@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
7 7 import javax.servlet.http.HttpSession;
8 8  
9 9 import org.springframework.stereotype.Controller;
  10 +import org.springframework.ui.Model;
10 11 import org.springframework.web.bind.annotation.GetMapping;
11 12 import org.springframework.web.bind.annotation.RequestMapping;
12 13 import org.springframework.web.context.request.RequestContextHolder;
... ... @@ -71,7 +72,39 @@ public class BaseController {
71 72 public void setSessionUser(SessionUser sessionUser){
72 73 this.getsession().setAttribute("",null);
73 74 }
  75 +
  76 + /**
  77 + * 设置报错页面显示信息——站点查询失败
  78 + * @param model
  79 + */
  80 + public void setmodel_site(Model model){
  81 + model.addAttribute("errorMessage", "站点查询失败,不存在此站点,请重新查询!");
  82 + model.addAttribute("remindMessage", "提示:站点查询请输入全称,不支持模糊查询");
  83 + }
  84 + /**
  85 + * 设置报错页面显示信息——参数校验失败
  86 + * @param model
  87 + * @param value 不能为空的参数
  88 + */
  89 + public void setmodel_param(Model model,String value){
  90 + model.addAttribute("errorMessage", "参数传递不能为空!"+value);
  91 + model.addAttribute("remindMessage", "提示:请检查所传参数,存在非空参数未赋值");
  92 + }
74 93  
75   -
  94 + /**
  95 + * 设置报错页面显示信息——入库结果失败
  96 + * @param model
  97 + */
  98 + public void setmodel_result(Model model){
  99 + model.addAttribute("errorMessage", "数据入库失败,请重试!");
  100 + model.addAttribute("remindMessage", "提示:如连续两次以上入库失败,请联系开发人员");
  101 + }
  102 + /**
  103 + * 设置报错页面显示信息——权限不足
  104 + * @param model
  105 + */
  106 + public void setmodel_limit(Model model){
  107 + model.addAttribute("errorMessage", "您没有此操作的权限,请重试或者联系管理员开通!");
  108 + }
76 109  
77 110 }
... ...
src/main/java/com/cnlive/shenhe/controller/ChannelController.java
... ... @@ -34,7 +34,7 @@ import java.util.Map;
34 34  
35 35 @Controller
36 36 @RequestMapping("/channel")
37   -public class ChannelController {
  37 +public class ChannelController extends BaseController {
38 38 private static Logger logger = LoggerFactory.getLogger(ChannelController.class);
39 39 @Value("${spring.localhost.url}")
40 40 private String localhost_url;//本机地址
... ... @@ -83,7 +83,8 @@ public class ChannelController {
83 83 if(CommonUtils.isNotNull(shySite)){
84 84 spid = shySite.getSpid();
85 85 }else{
86   - return "page/sitesError.html";
  86 + setmodel_site(model);
  87 + return "error.html";
87 88 }
88 89 } else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
89 90 spid = null;
... ...
src/main/java/com/cnlive/shenhe/controller/CommentsController.java
... ... @@ -31,7 +31,7 @@ import java.util.List;
31 31  
32 32 @Controller
33 33 @RequestMapping("/comments")
34   -public class CommentsController {
  34 +public class CommentsController extends BaseController {
35 35 private static Logger logger = LoggerFactory.getLogger(CommentsController.class);
36 36 @Autowired
37 37 AuditPass Pass;
... ...
src/main/java/com/cnlive/shenhe/controller/ContentController.java
... ... @@ -45,7 +45,7 @@ import java.util.List;
45 45  
46 46 @Controller
47 47 @RequestMapping("/content")
48   -public class ContentController {
  48 +public class ContentController extends BaseController {
49 49 private static Logger logger = LoggerFactory.getLogger(ContentController.class);
50 50 @Autowired
51 51 AuditPass Pass;
... ... @@ -91,7 +91,8 @@ public class ContentController {
91 91 if(CommonUtils.isNotNull(shySite)){
92 92 spid = shySite.getSpid();
93 93 }else{
94   - return "page/sitesError.html";
  94 + setmodel_site(model);
  95 + return "error.html";
95 96 }
96 97 } else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
97 98 spid = null;
... ...
src/main/java/com/cnlive/shenhe/controller/EmailController.java
... ... @@ -40,7 +40,7 @@ import javax.servlet.http.HttpSession;
40 40 */
41 41 @Controller
42 42 @RequestMapping("/email")
43   -public class EmailController {
  43 +public class EmailController extends BaseController {
44 44  
45 45 @Autowired
46 46 EmailServiceImpl emailServiceImpl;
... ... @@ -121,8 +121,9 @@ public class EmailController {
121 121  
122 122  
123 123 @PostMapping(value = "/write")
124   - public String write(Integer id,String email,String remark, String[] write_business, HttpSession session, String redirect_url) {
  124 + public String write(Model model,Integer id,String email,String remark, String[] write_business, HttpSession session, String redirect_url) {
125 125 if(CommonUtils.isEmpty(email)&&CommonUtils.isEmpty(remark)){
  126 + setmodel_param(model,"email,remark不能为空");
126 127 return "error.html";
127 128 }
128 129 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
... ... @@ -137,7 +138,8 @@ public class EmailController {
137 138 if (success) {
138 139 return "redirect:" + redirect_url;
139 140 } else {
140   - return "error.html";
  141 + setmodel_result(model);
  142 + return "error.html";
141 143 }
142 144 }
143 145  
... ...
src/main/java/com/cnlive/shenhe/controller/LiveApplyController.java
... ... @@ -45,7 +45,7 @@ import java.util.Map;
45 45  
46 46 @Controller
47 47 @RequestMapping("/liveApply")
48   -public class LiveApplyController {
  48 +public class LiveApplyController extends BaseController {
49 49 private static Logger logger = LoggerFactory.getLogger(LiveApplyController.class);
50 50 @Autowired
51 51 AuditPass Pass;
... ... @@ -147,7 +147,8 @@ public class LiveApplyController {
147 147 if(CommonUtils.isNotNull(shySite)){
148 148 spid = shySite.getSpid();
149 149 }else{
150   - return "page/sitesError.html";
  150 + setmodel_site(model);
  151 + return "error.html";
151 152 }
152 153 } else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
153 154 spid = null;
... ...
src/main/java/com/cnlive/shenhe/controller/LiveController.java
... ... @@ -40,7 +40,7 @@ import java.util.List;
40 40  
41 41 @Controller
42 42 @RequestMapping("/live")
43   -public class LiveController {
  43 +public class LiveController extends BaseController {
44 44 private static Logger logger = LoggerFactory.getLogger(LiveController.class);
45 45 @Autowired
46 46 AuditPass Pass;
... ... @@ -133,7 +133,8 @@ public class LiveController {
133 133 if(CommonUtils.isNotNull(shySite)){
134 134 spid = shySite.getSpid();
135 135 }else{
136   - return "page/sitesError.html";
  136 + setmodel_site(model);
  137 + return "error.html";
137 138 }
138 139 } else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
139 140 spid = null;
... ...
src/main/java/com/cnlive/shenhe/controller/SitesController.java
... ... @@ -26,7 +26,7 @@ import java.util.List;
26 26 */
27 27 @Controller
28 28 @RequestMapping("/sites")
29   -public class SitesController {
  29 +public class SitesController extends BaseController {
30 30  
31 31 private static Logger logger = LoggerFactory.getLogger(SitesController.class);
32 32  
... ... @@ -50,7 +50,8 @@ public class SitesController {
50 50 }
51 51 Integer spid = sessionUser.getSpid();
52 52 if (!sessionUser.isMaster() && spid != 0) {
53   - return "page/error.html";
  53 + setmodel_site(model);
  54 + return "error.html";
54 55 }
55 56 if (spid == 0) spid = null;
56 57 if (CommonUtils.isNull(page)) page = 1;
... ... @@ -79,12 +80,11 @@ public class SitesController {
79 80  
80 81  
81 82 @PostMapping(value = "/write")
82   - public String write(Integer siteId, String[] write_business, HttpSession session, String redirect_url) {
  83 + public String write(Model model,Integer siteId, String[] write_business, HttpSession session, String redirect_url) {
83 84 ShySites site = sitesService.get(siteId);
84 85 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
85   - Integer spid = sessionUser.getSpid();
86   - if ((!sessionUser.isMaster() && spid != 0) ) {
87   - return "page/error.html";
  86 + if(CommonUtils.isNull(sessionUser)){
  87 + return "redirect:/users/login";
88 88 }
89 89 String write = "";
90 90 if (CommonUtils.isNotNull(write_business) && write_business.length > 0) {
... ... @@ -98,7 +98,8 @@ public class SitesController {
98 98 if (success) {
99 99 return "redirect:" + redirect_url;
100 100 } else {
101   - return "error.html";
  101 + setmodel_result(model);
  102 + return "error.html";
102 103 }
103 104 }
104 105  
... ...
src/main/java/com/cnlive/shenhe/controller/TopicController.java
... ... @@ -47,7 +47,7 @@ import java.util.List;
47 47  
48 48 @Controller
49 49 @RequestMapping("/topic")
50   -public class TopicController {
  50 +public class TopicController extends BaseController {
51 51 private static Logger logger = LoggerFactory.getLogger(TopicController.class);
52 52 @Autowired
53 53 AuditPass Pass;
... ... @@ -93,7 +93,8 @@ public class TopicController {
93 93 if(CommonUtils.isNotNull(shySite)){
94 94 spid = shySite.getSpid();
95 95 }else{
96   - return "page/sitesError.html";
  96 + setmodel_site(model);
  97 + return "error.html";
97 98 }
98 99 } else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
99 100 spid = null;
... ...
src/main/java/com/cnlive/shenhe/controller/UsersController.java
... ... @@ -38,7 +38,7 @@ import javax.servlet.http.HttpSession;
38 38 */
39 39 @Controller
40 40 @RequestMapping("/users")
41   -public class UsersController {
  41 +public class UsersController extends BaseController {
42 42  
43 43 @Autowired
44 44 UsersServiceImpl usersService;
... ... @@ -92,9 +92,6 @@ public class UsersController {
92 92 return "redirect:/users/login";
93 93 }
94 94 Integer spid = sessionUser.getSpid();
95   - if (!sessionUser.isMaster() && spid != 0) {
96   - return "page/error.html";
97   - }
98 95 if (spid == 0) spid = null;
99 96 if (CommonUtils.isNull(page)) page = 1;
100 97 if (CommonUtils.isNull(pageSize)) pageSize = 10;
... ... @@ -145,12 +142,12 @@ public class UsersController {
145 142  
146 143  
147 144 @PostMapping(value = "/write")
148   - public String write(Integer userId, String[] write_notice, HttpSession session, String redirect_url) {
  145 + public String write(Model model,Integer userId, String[] write_notice, HttpSession session, String redirect_url) {
149 146 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
150   - Integer spid = sessionUser.getSpid();
151   - if (spid != 0) {
152   - return "page/error.html";
153   - }
  147 +// Integer spid = sessionUser.getSpid();
  148 +// if (spid != 0) {
  149 +// return "page/error.html";
  150 +// }
154 151 ShyUsers user = usersService.get(userId);
155 152 String write = "";
156 153 if (CommonUtils.isNotNull(write_notice) && write_notice.length > 0) {
... ... @@ -164,7 +161,8 @@ public class UsersController {
164 161 if (success) {
165 162 return "redirect:" + redirect_url;
166 163 } else {
167   - return "error.html";
  164 + setmodel_result(model);
  165 + return "error.html";
168 166 }
169 167 }
170 168  
... ...
src/main/java/com/cnlive/shenhe/controller/UsersFreeController.java
... ... @@ -36,7 +36,7 @@ import javax.servlet.http.HttpSession;
36 36 */
37 37 @Controller
38 38 @RequestMapping("/usersFree")
39   -public class UsersFreeController {
  39 +public class UsersFreeController extends BaseController {
40 40  
41 41 @Autowired
42 42 UsersfreeServiceImpl usersfreeService;
... ... @@ -100,8 +100,9 @@ public class UsersFreeController {
100 100  
101 101  
102 102 @PostMapping(value = "/write")
103   - public String write(String userId,String userMobile,Integer spId, String[] write_business, HttpSession session, String redirect_url) {
  103 + public String write(Model model,String userId,String userMobile,Integer spId, String[] write_business, HttpSession session, String redirect_url) {
104 104 if(CommonUtils.isEmpty(userId)&&CommonUtils.isEmpty(userMobile)){
  105 + setmodel_param(model,"userId,userMobile不能为空!");
105 106 return "error.html";
106 107 }
107 108 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
... ... @@ -116,6 +117,7 @@ public class UsersFreeController {
116 117 if (success) {
117 118 return "redirect:" + redirect_url;
118 119 } else {
  120 + setmodel_result(model);
119 121 return "error.html";
120 122 }
121 123 }
... ...
src/main/java/com/cnlive/shenhe/controller/VideosController.java
... ... @@ -129,7 +129,8 @@ public class VideosController extends BaseController {
129 129 if(CommonUtils.isNotNull(shySite)){
130 130 spid = shySite.getSpid();
131 131 }else{
132   - return "page/sitesError.html";
  132 + setmodel_site(model);
  133 + return "error.html";
133 134 }
134 135 } else if (CommonUtils.isEmpty(sp_desc) && spid == 0) {
135 136 spid = null;
... ...
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
... ... @@ -31,6 +31,19 @@ public class AuditPass {
31 31  
32 32 @Value("${queryUserByUserId}")
33 33 private String queryUserByUserId;//用户云查网家家用户信息(通过用户id)
  34 +
  35 + public static void main(String[] args) {
  36 + JSONObject map= new JSONObject();
  37 + map.put("platform","a" );
  38 + map.put("commentUserAvatar","http://yweb0.cnliveimg.com/images/headImg/2019/1129/1575022593286.jpg" );
  39 + map.put("appId","60#iqw7flx829" );
  40 + map.put("commentUserIP", null);
  41 + map.put("type", "topic");
  42 + map.put("activityId", "802:video:comets:604_ab79303bd0074a24965a92dd6514681a#20939");
  43 + HttpUtil httpUtil = HttpUtil.init();
  44 + httpUtil.setParam("param", map.toJSONString());
  45 + Map<String, String> post = httpUtil.post("http://test.shen.cnlive.com/api/comments/import");
  46 + }
34 47  
35 48 /**
36 49 * 点播视频回调
... ...
src/main/resources/application.properties
... ... @@ -49,8 +49,12 @@ spring.rabbitmq.publisher-returns=true
49 49 spring.rabbitmq.listener.direct.acknowledge-mode=manual
50 50 spring.rabbitmq.listener.simple.acknowledge-mode=manual
51 51  
  52 +#\u8bdd\u9898\u8bc4\u8bba\u5206\u4eabh5
52 53 topic_comment_shareH5=http://www.baidu.com?id=
53 54  
  55 +#\u5173\u95edspringboot\u63d0\u4f9b\u7684\u9ed8\u8ba4ico
  56 +spring.mvc.favicon.enabled = false
  57 +
54 58 #logback\u65e5\u5fd7\u4e2d\u4f7f\u7528
55 59 spring.application.name=cnlive_shenhe_test
56 60 spring.application.home=/usr/local/test_cnlive_shenhe/cnlive_shenhe/log
... ...
src/main/resources/static/favicon.ico 0 → 100644
No preview for this file type
src/main/resources/templates/common/head.html
... ... @@ -14,7 +14,8 @@
14 14  
15 15 <!--JQuery-->
16 16 <script src="../../static/js/jquery.min.js"></script>
17   -
  17 +<!-- <link rel="icon" href="http://app.shineup.com.cn/goldenline/play_sel.png" type="image/x-icon"> -->
  18 + <link rel="icon" href="/static/favicon.ico" type="image/x-icon">
18 19 <!--Bootstrap-->
19 20 <link href="../../static/css/bootstrap.min.css" rel="stylesheet">
20 21 <script src="../../static/js/bootstrap.min.js"></script>
... ...
src/main/resources/templates/error.html
1 1 <!DOCTYPE html>
2   -<html>
3   -<head>
4   - <title>审核云平台</title>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
5 3  
6   - <style>
7   - html, body {
8   - height: 100%;
9   - }
10   -
11   - body {
12   - margin: 0;
13   - padding: 0;
14   - width: 100%;
15   - display: table;
16   - font-weight: 100;
17   - font-family: 'Lato', sans-serif;
18   - }
19   -
20   - .container {
21   - text-align: center;
22   - display: table-cell;
23   - vertical-align: middle;
24   - }
  4 +<head th:replace="../templates/common/head::head">
  5 +</head>
25 6  
26   - .content {
27   - text-align: center;
28   - display: inline-block;
29   - }
  7 +<body class="skin-blue sidebar-mini">
30 8  
31   - .title {
32   - font-size: 40px;
33   - }
34   - </style>
35   -</head>
36   -<body>
37   -<div class="container">
38   - <div class="content">
39   - <div class="title">出错了,请稍后再试!</div>
  9 +<div class="wrapper">
  10 + <div th:replace="../templates/common/frame::frame"></div>
  11 + <div class="content-wrapper" style="min-height: 588px;">
  12 + <section class="content-header">
  13 + <h1>
  14 + 报错页面
  15 + </h1>
  16 + <ol class="breadcrumb">
  17 + <li>首页</li>
  18 + <li class="active">报错页面</li>
  19 + </ol>
  20 + </section>
  21 + <section class="content">
  22 + <div class="row">
  23 + <div class="col-md-12">
  24 + <div class="box box-info">
  25 + <div class="box-body">
  26 + <div class="container" style="background-color:#FFF;padding:150px;text-align: center; display: table-cell; vertical-align: middle;">
  27 + <div class="content" style="text-align: center;display: inline-block;">
  28 + <div style="font-size: 40px;" th:utext="${errorMessage}">出错了,请稍后再试!</div>
  29 + <br>
  30 + <div style="font-size: 20px;color:red;" th:utext="${remindMessage}">出错了,请稍后再试!</div>
  31 + </div>
  32 + </div>
  33 +
  34 + </div>
  35 + </div>
  36 + </div>
  37 + </div>
  38 + </section>
40 39 </div>
41   -</div>
42   -</body>
43   -</html>
  40 + <footer th:replace="../templates/common/foot::foot"></footer>
  41 + <!-- Add the sidebar's background. This div must be placed
  42 + immediately after the control sidebar -->
  43 + <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div>
  44 +</div><!-- ./wrapper -->
  45 +<!-- AdminLTE App -->
  46 +<script src="../../static/js/app.min.js"></script>
  47 +<!-- AdminLTE for demo purposes -->
  48 +<script src="../../static/js/sidebar.js"></script>
44 49  
  50 +</body>
  51 +</html>
45 52 \ No newline at end of file
... ...
src/main/resources/templates/error3.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
  3 +<head>
  4 + <title>审核云平台</title>
  5 +
  6 + <style>
  7 + html, body {
  8 + height: 100%;
  9 + }
  10 +
  11 + body {
  12 + margin: 0;
  13 + padding: 0;
  14 + width: 100%;
  15 + display: table;
  16 + font-weight: 100;
  17 + font-family: 'Lato', sans-serif;
  18 + }
  19 +
  20 + .container {
  21 + text-align: center;
  22 + display: table-cell;
  23 + vertical-align: middle;
  24 + }
  25 +
  26 + .content {
  27 + text-align: center;
  28 + display: inline-block;
  29 + }
  30 +
  31 + .title {
  32 + font-size: 40px;
  33 + }
  34 + .remind {
  35 + font-size: 20px;
  36 + }
  37 + </style>
  38 +</head>
  39 +<body>
  40 +<div class="container">
  41 + <div class="content">
  42 + <div class="title" th:utext="${errorMessage}">出错了,请稍后再试!</div>
  43 + <br>
  44 + <div class="remind" th:utext="${remindMessage}">出错了,请稍后再试!</div>
  45 + </div>
  46 +</div>
  47 +</body>
  48 +</html>
  49 +
... ...
src/main/resources/templates/page/error.html
... ... @@ -36,7 +36,7 @@
36 36 <body>
37 37 <div class="container">
38 38 <div class="content">
39   - <div class="title">抱歉!你没有审核云权限,请与视讯云用户中心管理员联系!</div>
  39 + <div class="title">抱歉!你没有审核云账户未激活,请与视讯云用户中心管理员联系!</div>
40 40 </div>
41 41 </div>
42 42 </body>
... ...