Commit dc7e1124ef9650c36d8a82d2e79c53de3c2ba2c9
1 parent
56785d77
朋友圈
Showing
3 changed files
with
22 additions
and
8 deletions
src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
| @@ -139,6 +139,8 @@ public class ContentControllerApi { | @@ -139,6 +139,8 @@ public class ContentControllerApi { | ||
| 139 | shyContent1.setCallback(json.getString("callbackUrl"));//回调地址 | 139 | shyContent1.setCallback(json.getString("callbackUrl"));//回调地址 |
| 140 | shyContent1.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | 140 | shyContent1.setContent_url(json.getString("pageUrl"));//朋友圈分享的url |
| 141 | shyContent1.setSp_id(json.getInteger("spId"));//spid | 141 | shyContent1.setSp_id(json.getInteger("spId"));//spid |
| 142 | + shyContent1.setAuthor(json.getString("userId"));//用户id | ||
| 143 | + shyContent1.setSource(json.getString("nickName"));//用户昵称 | ||
| 142 | shyContent1.setContent_tag("moment");//图文标签 | 144 | shyContent1.setContent_tag("moment");//图文标签 |
| 143 | shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | 145 | shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 |
| 144 | shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | 146 | shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 |
| @@ -156,7 +158,7 @@ public class ContentControllerApi { | @@ -156,7 +158,7 @@ public class ContentControllerApi { | ||
| 156 | shyContent.setTitle(json.getString("title"));//标题 | 158 | shyContent.setTitle(json.getString("title"));//标题 |
| 157 | shyContent.setTitle_image(json.getString("image"));//用户头像 | 159 | shyContent.setTitle_image(json.getString("image"));//用户头像 |
| 158 | shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 | 160 | shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 |
| 159 | - shyContent.setContent_status(0);//当前朋友圈内容的审核状态 | 161 | + shyContent.setContent_status(1);//当前朋友圈内容的审核状态,先发后审 |
| 160 | String contentTime = json.getString("createTime");//创建时间 | 162 | String contentTime = json.getString("createTime");//创建时间 |
| 161 | if (CommonUtils.isNotEmpty(contentTime)) { | 163 | if (CommonUtils.isNotEmpty(contentTime)) { |
| 162 | Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | 164 | Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); |
| @@ -167,6 +169,8 @@ public class ContentControllerApi { | @@ -167,6 +169,8 @@ public class ContentControllerApi { | ||
| 167 | shyContent.setCallback(json.getString("callbackUrl"));//回调地址 | 169 | shyContent.setCallback(json.getString("callbackUrl"));//回调地址 |
| 168 | shyContent.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | 170 | shyContent.setContent_url(json.getString("pageUrl"));//朋友圈分享的url |
| 169 | shyContent.setSp_id(json.getInteger("spId"));//spid | 171 | shyContent.setSp_id(json.getInteger("spId"));//spid |
| 172 | + shyContent.setAuthor(json.getString("userId"));//用户id | ||
| 173 | + shyContent.setSource(json.getString("nickName"));//用户昵称 | ||
| 170 | shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | 174 | shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 |
| 171 | shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | 175 | shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 |
| 172 | boolean YorN = contentService.impotContent(shyContent); | 176 | boolean YorN = contentService.impotContent(shyContent); |
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
| @@ -193,14 +193,12 @@ public class ContentServiceImpl { | @@ -193,14 +193,12 @@ public class ContentServiceImpl { | ||
| 193 | for (String contentId : contentIds) { | 193 | for (String contentId : contentIds) { |
| 194 | ShyContent content = shyContentMapper.selectByPrimaryKey(Integer.parseInt(contentId)); | 194 | ShyContent content = shyContentMapper.selectByPrimaryKey(Integer.parseInt(contentId)); |
| 195 | JSONObject result = new JSONObject(); | 195 | JSONObject result = new JSONObject(); |
| 196 | -// String type = "fabu";// 1、fabu,2、xiaxian,3、shanchu | ||
| 197 | -// if (state == 2) { | ||
| 198 | -// type = "xiaxian"; | ||
| 199 | -// } else if (state == 3) { | ||
| 200 | -// type = "shanchu"; | ||
| 201 | -// } | ||
| 202 | try { | 196 | try { |
| 203 | - result = Pass.contentPass(content.getContent_id(), state+"", msg, content.getCallback()); | 197 | + if(CommonUtils.isNotEmpty(content.getContent_tag())&&content.getContent_tag().equals("content")){ |
| 198 | + result = Pass.contentPass(content.getContent_id(), state+"", msg, content.getCallback()); | ||
| 199 | + }else if(CommonUtils.isNotEmpty(content.getContent_tag())&&content.getContent_tag().equals("moment")){ | ||
| 200 | + result = Pass.momentPass(content.getContent_id(), state, msg, content.getCallback(),content.getAuthor()); | ||
| 201 | + } | ||
| 204 | } catch (Exception e) { | 202 | } catch (Exception e) { |
| 205 | logger.error("图文审核回调失败,图文id:{}", content.getId()); | 203 | logger.error("图文审核回调失败,图文id:{}", content.getId()); |
| 206 | success = false; | 204 | success = false; |
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
| @@ -107,4 +107,16 @@ public class AuditPass { | @@ -107,4 +107,16 @@ public class AuditPass { | ||
| 107 | Map<String, String> post = httpUtil.post(URL); | 107 | Map<String, String> post = httpUtil.post(URL); |
| 108 | return JSONObject.parseObject(post.get("result")); | 108 | return JSONObject.parseObject(post.get("result")); |
| 109 | } | 109 | } |
| 110 | + public JSONObject momentPass(String content_id, Integer state, String msg, String callback, String userId) { | ||
| 111 | + logger.info("朋友圈回调:content_id:{},state:{},msg:{},userId:{}", content_id, state, msg,userId); | ||
| 112 | + JSONObject json=new JSONObject(); | ||
| 113 | + json.put("userId",userId ); | ||
| 114 | + json.put("momentId",content_id ); | ||
| 115 | + json.put("status",state ); | ||
| 116 | + json.put("msg", msg); | ||
| 117 | + String httpUtilResult = HttpClientUtils.HttpPostWithJson(callback, json.toString()); | ||
| 118 | + logger.info("朋友圈返回数据,httpUtilResult=====" + httpUtilResult); | ||
| 119 | + JSONObject result = JSONObject.parseObject(httpUtilResult); | ||
| 120 | + return result; | ||
| 121 | + } | ||
| 110 | } | 122 | } |