Commit 1dc9937f35eb240bb1c4e504e62de9ab2362b1d0

Authored by liwei2917
1 parent ff8066ec

直播申请审核增加新来数据时右下角弹窗

src/main/java/com/cnlive/shenhe/api/ChannelControllerApi.java
@@ -26,8 +26,7 @@ import java.util.Map; @@ -26,8 +26,7 @@ import java.util.Map;
26 @RequestMapping("/api/channel") 26 @RequestMapping("/api/channel")
27 public class ChannelControllerApi { 27 public class ChannelControllerApi {
28 private static Logger logger = LoggerFactory.getLogger(ChannelControllerApi.class); 28 private static Logger logger = LoggerFactory.getLogger(ChannelControllerApi.class);
29 - @Value("${spring.localhost.url}")  
30 - private String localhost_url;//本机地址 29 +
31 @Autowired 30 @Autowired
32 AuditPass Pass; 31 AuditPass Pass;
33 @Autowired 32 @Autowired
@@ -92,28 +91,6 @@ public class ChannelControllerApi { @@ -92,28 +91,6 @@ public class ChannelControllerApi {
92 } 91 }
93 } 92 }
94 93
95 - /**  
96 - * @Auther: liwei  
97 - * @Date: 2019/08/17 11:17  
98 - * @Description: 频道前台通知接口  
99 - */  
100 - @GetMapping("/channelNotice")  
101 - @ResponseBody  
102 - public Map<String,Object> channelNotice() {  
103 - Map<String,Object> map=new HashMap<>();  
104 - ShyChannel shyChannel = new ShyChannel();  
105 - shyChannel.setShenhe_type(CommonConst.AUDIT_TYPE_USER);// 审核类型为人工审  
106 - shyChannel.setShenhe_status(CommonConst.AUDIT_INTT);  
107 - List<ShyChannel> channelList = channelService.findshyChannel(shyChannel);  
108 - if (channelList.size() > 0) {  
109 - logger.info("您有"+channelList.size()+"条新的频道审核申请,请注意查看!");  
110 - map.put("id", "1");//第一个提示框,避免冲突  
111 - map.put("title", "新频道审核通知");  
112 - map.put("content","您有"+channelList.size()+"条新的频道审核申请,请注意查看!" );  
113 - map.put("url",localhost_url+"/channel/page?shenhe_status=0&receive=0" );  
114 - return map;  
115 - }  
116 - return null;  
117 - } 94 +
118 95
119 } 96 }
src/main/java/com/cnlive/shenhe/controller/ChannelController.java
@@ -20,19 +20,24 @@ import com.github.pagehelper.PageInfo; @@ -20,19 +20,24 @@ import com.github.pagehelper.PageInfo;
20 import org.slf4j.Logger; 20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory; 21 import org.slf4j.LoggerFactory;
22 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
  23 +import org.springframework.beans.factory.annotation.Value;
23 import org.springframework.stereotype.Controller; 24 import org.springframework.stereotype.Controller;
24 import org.springframework.ui.Model; 25 import org.springframework.ui.Model;
25 import org.springframework.web.bind.annotation.*; 26 import org.springframework.web.bind.annotation.*;
26 27
27 import javax.servlet.http.HttpSession; 28 import javax.servlet.http.HttpSession;
28 import java.util.Date; 29 import java.util.Date;
  30 +import java.util.HashMap;
29 import java.util.List; 31 import java.util.List;
  32 +import java.util.Map;
30 33
31 34
32 @Controller 35 @Controller
33 @RequestMapping("/channel") 36 @RequestMapping("/channel")
34 public class ChannelController { 37 public class ChannelController {
35 private static Logger logger = LoggerFactory.getLogger(ChannelController.class); 38 private static Logger logger = LoggerFactory.getLogger(ChannelController.class);
  39 + @Value("${spring.localhost.url}")
  40 + private String localhost_url;//本机地址
36 @Autowired 41 @Autowired
37 AuditPass Pass; 42 AuditPass Pass;
38 @Autowired 43 @Autowired
@@ -249,4 +254,29 @@ public class ChannelController { @@ -249,4 +254,29 @@ public class ChannelController {
249 } 254 }
250 return responseBean; 255 return responseBean;
251 } 256 }
  257 +
  258 +
  259 + /**
  260 + * @Auther: liwei
  261 + * @Date: 2019/08/17 11:17
  262 + * @Description: 频道前台通知接口
  263 + */
  264 + @GetMapping("/channelNotice")
  265 + @ResponseBody
  266 + public Map<String,Object> channelNotice() {
  267 + Map<String,Object> map=new HashMap<>();
  268 + ShyChannel shyChannel = new ShyChannel();
  269 + shyChannel.setShenhe_type(CommonConst.AUDIT_TYPE_USER);// 审核类型为人工审
  270 + shyChannel.setShenhe_status(CommonConst.AUDIT_INTT);
  271 + List<ShyChannel> channelList = channelService.findshyChannel(shyChannel);
  272 + if (channelList.size() > 0) {
  273 + logger.info("您有"+channelList.size()+"条新的频道审核申请,请注意查看!");
  274 + map.put("id", "1");//第一个提示框,避免冲突
  275 + map.put("title", "新频道审核通知");
  276 + map.put("content","您有"+channelList.size()+"条新的频道审核申请,请注意查看!" );
  277 + map.put("url",localhost_url+"/channel/page?shenhe_status=0&receive=0" );
  278 + return map;
  279 + }
  280 + return null;
  281 + }
252 } 282 }
src/main/java/com/cnlive/shenhe/controller/LiveApplyController.java
@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject; @@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
9 import com.cnlive.shenhe.bean.ErrorEnum; 9 import com.cnlive.shenhe.bean.ErrorEnum;
10 import com.cnlive.shenhe.bean.ResponseBean; 10 import com.cnlive.shenhe.bean.ResponseBean;
11 import com.cnlive.shenhe.bean.SessionUser; 11 import com.cnlive.shenhe.bean.SessionUser;
  12 +import com.cnlive.shenhe.entity.ShyChannel;
12 import com.cnlive.shenhe.entity.ShyLive; 13 import com.cnlive.shenhe.entity.ShyLive;
13 import com.cnlive.shenhe.entity.ShyLiveapply; 14 import com.cnlive.shenhe.entity.ShyLiveapply;
14 import com.cnlive.shenhe.entity.ShySites; 15 import com.cnlive.shenhe.entity.ShySites;
@@ -38,7 +39,9 @@ import javax.servlet.ServletOutputStream; @@ -38,7 +39,9 @@ import javax.servlet.ServletOutputStream;
38 import javax.servlet.http.HttpServletResponse; 39 import javax.servlet.http.HttpServletResponse;
39 import javax.servlet.http.HttpSession; 40 import javax.servlet.http.HttpSession;
40 import java.io.*; 41 import java.io.*;
  42 +import java.util.HashMap;
41 import java.util.List; 43 import java.util.List;
  44 +import java.util.Map;
42 45
43 @Controller 46 @Controller
44 @RequestMapping("/liveApply") 47 @RequestMapping("/liveApply")
@@ -55,11 +58,9 @@ public class LiveApplyController { @@ -55,11 +58,9 @@ public class LiveApplyController {
55 @Autowired 58 @Autowired
56 LiveServiceImpl liveService; 59 LiveServiceImpl liveService;
57 60
58 - @Value("${qn_domain}")  
59 - String qn_domain;  
60 -  
61 - @Value("${ks_domain}")  
62 - String ks_domain; 61 +
  62 + @Value("${spring.localhost.url}")
  63 + private String localhost_url;//本机地址
63 64
64 65
65 @Autowired 66 @Autowired
@@ -438,6 +439,30 @@ public class LiveApplyController { @@ -438,6 +439,30 @@ public class LiveApplyController {
438 } 439 }
439 } 440 }
440 } 441 }
  442 +
  443 + /**
  444 + * @Auther: liwei
  445 + * @Date: 2019/11/08 11:17
  446 + * @Description: 直播申请前台通知接口
  447 + */
  448 + @GetMapping("/liveApplyNotice")
  449 + @ResponseBody
  450 + public Map<String, Object> channelNotice() {
  451 + Map<String, Object> map = new HashMap<>();
  452 + ShyLiveapply shyLiveapply = new ShyLiveapply();
  453 + shyLiveapply.setShenhe_type(CommonConst.AUDIT_TYPE_USER);// 审核类型为人工审
  454 + shyLiveapply.setShenhe_state(CommonConst.AUDIT_INTT);
  455 + List<ShyLiveapply> liveApplyList = liveApplyServiceImpl.findshyLiveApply(shyLiveapply);
  456 + if (liveApplyList.size() > 0) {
  457 + logger.info("您有" + liveApplyList.size() + "条新的直播申请,请注意查看!");
  458 + map.put("id", "2");// 第二个提示框,避免冲突
  459 + map.put("title", "新直播申请通知");
  460 + map.put("content", "您有" + liveApplyList.size() + "条新的直播申请,请注意查看!");
  461 + map.put("url", localhost_url + "/liveApply/page?shenhe_state=0&receive=0");
  462 + return map;
  463 + }
  464 + return null;
  465 + }
441 466
442 @PostMapping("/ceshi") 467 @PostMapping("/ceshi")
443 @ResponseBody 468 @ResponseBody
src/main/resources/templates/common/head.html
@@ -111,6 +111,7 @@ @@ -111,6 +111,7 @@
111 } 111 }
112 if(data.isShow_liveApply){ 112 if(data.isShow_liveApply){
113 isShow_liveApply=true; 113 isShow_liveApply=true;
  114 + notice_liveApply();//第一次进来就弹窗
114 } 115 }
115 } 116 }
116 }); 117 });
@@ -121,18 +122,36 @@ @@ -121,18 +122,36 @@
121 initialize(); 122 initialize();
122 t1 = window.setInterval( 123 t1 = window.setInterval(
123 function(){ 124 function(){
124 - if(((parseInt(new Date().getTime()/1000))%(5*60)==0) && isShow_chinnal){  
125 - notice_channel() 125 + if(((parseInt(new Date().getTime()/1000))%(5*60)==0)){//弹窗设置每5分钟启用
  126 + if(isShow_chinnal){
  127 + notice_channel();
  128 + }
  129 + if(isShow_liveApply){
  130 + notice_liveApply();
  131 + }
126 } 132 }
127 },1000); 133 },1000);
128 }); 134 });
129 135
  136 + function notice_liveApply(){
  137 + $.ajax({
  138 + type:'get',
  139 + dataType:'json',
  140 + data:'',
  141 + url: "/channel/channelNotice",
  142 + success:function(data){
  143 + if(data!=null && data!="" ){
  144 + new xWin(data.id,data.title,data.content,data.url);
  145 + }
  146 + }
  147 + });
  148 + }
130 function notice_channel(){ 149 function notice_channel(){
131 $.ajax({ 150 $.ajax({
132 type:'get', 151 type:'get',
133 dataType:'json', 152 dataType:'json',
134 data:'', 153 data:'',
135 - url: "/api/channel/channelNotice", 154 + url: "/liveApply/liveApplyNotice",
136 success:function(data){ 155 success:function(data){
137 if(data!=null && data!="" ){ 156 if(data!=null && data!="" ){
138 new xWin(data.id,data.title,data.content,data.url); 157 new xWin(data.id,data.title,data.content,data.url);