Commit 888afc2685b9657f3d50a4c651acea8a45f231dd

Authored by 徐近程
1 parent b1f35a16

审核结果更新并通知点播音频

src/main/java/com/cnlive/shenhe/controller/AudioController.java
1 package com.cnlive.shenhe.controller; 1 package com.cnlive.shenhe.controller;
2 2
3 -import com.alibaba.fastjson.JSON; 3 +import com.alibaba.fastjson.JSONObject;
4 import com.cnlive.shenhe.bean.ErrorEnum; 4 import com.cnlive.shenhe.bean.ErrorEnum;
5 import com.cnlive.shenhe.bean.ResponseBean; 5 import com.cnlive.shenhe.bean.ResponseBean;
6 import com.cnlive.shenhe.bean.SessionUser; 6 import com.cnlive.shenhe.bean.SessionUser;
7 import com.cnlive.shenhe.entity.ShyAudio; 7 import com.cnlive.shenhe.entity.ShyAudio;
8 import com.cnlive.shenhe.entity.ShySites; 8 import com.cnlive.shenhe.entity.ShySites;
9 import com.cnlive.shenhe.entity.ShyUsers; 9 import com.cnlive.shenhe.entity.ShyUsers;
10 -import com.cnlive.shenhe.entity.ShyVideos;  
11 import com.cnlive.shenhe.serviceImpl.AudioServiceImpl; 10 import com.cnlive.shenhe.serviceImpl.AudioServiceImpl;
12 import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; 11 import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
13 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; 12 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
  13 +import com.cnlive.shenhe.utils.AuditPass;
14 import com.cnlive.shenhe.utils.CommonConst; 14 import com.cnlive.shenhe.utils.CommonConst;
15 import com.cnlive.shenhe.utils.CommonUtils; 15 import com.cnlive.shenhe.utils.CommonUtils;
16 import com.github.pagehelper.PageInfo; 16 import com.github.pagehelper.PageInfo;
@@ -60,6 +60,9 @@ public class AudioController extends BaseController { @@ -60,6 +60,9 @@ public class AudioController extends BaseController {
60 @Value("${ks_domain}") 60 @Value("${ks_domain}")
61 String ks_domain; 61 String ks_domain;
62 62
  63 + @Autowired
  64 + AuditPass Pass;
  65 +
63 /** 66 /**
64 * 音频数据分页获取 67 * 音频数据分页获取
65 * 68 *
@@ -419,4 +422,44 @@ public class AudioController extends BaseController { @@ -419,4 +422,44 @@ public class AudioController extends BaseController {
419 } 422 }
420 } 423 }
421 } 424 }
  425 +
  426 +
  427 + /**
  428 + * 审核结果更新并通知点播音频
  429 + *
  430 + * @param activity_id 音频id(audioId)
  431 + * @param state 状态码
  432 + * @param attr_tags 常用审核意见(标签)
  433 + * @param msg 审核备注
  434 + * @return
  435 + */
  436 + @PostMapping("/shenheAudio")
  437 + @ResponseBody
  438 + public ResponseBean shenheInfo(Integer id, String activity_id, Integer state, String attr_tags, String msg, String callback, HttpSession session) {
  439 + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
  440 + String userId = sessionUser.getUserId();
  441 + JSONObject result;
  442 + try {
  443 + result = Pass.audioPass(activity_id, state, attr_tags, msg, callback);
  444 + } catch (Exception e) {
  445 + e.printStackTrace();
  446 + System.out.println("音频审核失败");
  447 + return new ResponseBean(ErrorEnum.ERROR);
  448 + }
  449 + if (result == null) {
  450 + System.out.println("音频审核失败且接口错误没有返回信息");
  451 + return new ResponseBean(ErrorEnum.ERROR);
  452 + }
  453 + Integer code = result.getInteger("code");
  454 + if (code != 0) {
  455 + System.out.println("审核失败,code==" + code);
  456 + return new ResponseBean(code, result.getString("msg"));
  457 + }
  458 + state = state == 4 ? 2 : 1;
  459 + int i = audioService.updateAudio(id, userId, null, attr_tags, state, msg);
  460 + if (i == 0) {
  461 + return new ResponseBean(ErrorEnum.ERROR);
  462 + }
  463 + return new ResponseBean(ErrorEnum.SUCCESS);
  464 + }
422 } 465 }
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
@@ -220,10 +220,10 @@ public class AuditPass { @@ -220,10 +220,10 @@ public class AuditPass {
220 } 220 }
221 221
222 //音频回调 222 //音频回调
223 - public JSONObject audioPass(String video_id, int state, String attr_tags, String msg, String callBack) {  
224 - logger.info("点播回调:video_id:{},state:{},attr_tags:{},msg:{}", video_id, state, attr_tags, msg); 223 + public JSONObject audioPass(String audioId, int state, String attr_tags, String msg, String callBack) {
  224 + logger.info("点播音频回调:audioId:{},state:{},attr_tags:{},msg:{}", audioId, state, attr_tags, msg);
225 JSONObject params = new JSONObject(); 225 JSONObject params = new JSONObject();
226 - params.put("video_id", video_id); 226 + params.put("audioId", audioId);
227 params.put("state", state + ""); 227 params.put("state", state + "");
228 params.put("attr_tags", attr_tags); 228 params.put("attr_tags", attr_tags);
229 params.put("msg", msg); 229 params.put("msg", msg);
src/main/resources/templates/page/audioDetail.html
@@ -258,7 +258,7 @@ @@ -258,7 +258,7 @@
258 $("#action_note").hide();//隐藏弹出框 258 $("#action_note").hide();//隐藏弹出框
259 var action_note_type = $("#action_note_type").val(); 259 var action_note_type = $("#action_note_type").val();
260 if (action_note_type == 'reject') { 260 if (action_note_type == 'reject') {
261 - $.post("/videos/shenheVideo", { 261 + $.post("/videos/shenheAudio", {
262 id: id, 262 id: id,
263 activity_id: activity_id, 263 activity_id: activity_id,
264 state: state, 264 state: state,
@@ -289,7 +289,7 @@ @@ -289,7 +289,7 @@
289 return false; 289 return false;
290 } 290 }
291 if (confirm("您确认通过此条点播吗?")) { 291 if (confirm("您确认通过此条点播吗?")) {
292 - $.post("/videos/shenheVideo", { 292 + $.post("/videos/shenheAudio", {
293 id: id, 293 id: id,
294 activity_id: activity_id, 294 activity_id: activity_id,
295 state: state, 295 state: state,