公众号获取公众号文章详情改造
This commit is contained in:
parent
d78fc63077
commit
082c722321
|
|
@ -11,6 +11,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "公众号*用户评论接口")
|
||||
@RestController
|
||||
|
|
@ -24,6 +26,7 @@ public class PublicDetailCommentAppController {
|
|||
@PostMapping("/add")
|
||||
@ApiOperation(value = "新增用户评论")
|
||||
public Result<String> add(@RequestBody PublicDetailComment detailComment) {
|
||||
detailComment.setCreateTime(new Date());
|
||||
detailCommentAppService.add(detailComment);
|
||||
return Result.success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.playlet.web.controller.system;
|
|||
import java.util.List;
|
||||
|
||||
import com.playlet.system.domain.PlayletPublicAccount;
|
||||
import com.playlet.system.service.IPlayletItemService;
|
||||
import com.playlet.system.service.IPlayletPublicAccountService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -36,6 +37,9 @@ public class PlayletPublicDetailController extends BaseController
|
|||
@Autowired
|
||||
private IPlayletPublicAccountService playletPublicAccountService;
|
||||
|
||||
@Autowired
|
||||
private IPlayletItemService playletItemService;
|
||||
|
||||
|
||||
@GetMapping("/wxQrcode/{id}")
|
||||
public String wxQrcode(@PathVariable("id") String id, ModelMap mmap) {
|
||||
|
|
@ -94,6 +98,7 @@ public class PlayletPublicDetailController extends BaseController
|
|||
@GetMapping("/add")
|
||||
public String add(ModelMap modelMap)
|
||||
{
|
||||
modelMap.put("playletItems", playletItemService.lambdaQuery().list());
|
||||
modelMap.put("publicAccounts", playletPublicAccountService.selectPlayletPublicAccountList(new PlayletPublicAccount()));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
package com.playlet.web.service.app.impl;
|
||||
|
||||
import cn.hutool.crypto.digest.MD5;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.playlet.system.domain.PlayletItem;
|
||||
import com.playlet.system.domain.PlayletPublicAccount;
|
||||
import com.playlet.system.domain.PlayletPublicDetail;
|
||||
import com.playlet.system.service.IPlayletItemService;
|
||||
import com.playlet.system.service.IPlayletPublicAccountService;
|
||||
import com.playlet.system.service.IPlayletPublicDetailService;
|
||||
import com.playlet.web.service.app.PlayletPublicDetailAppService;
|
||||
|
|
@ -12,7 +18,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
|
|
@ -23,6 +31,8 @@ public class PlayletPublicDetailAppServiceImpl implements PlayletPublicDetailApp
|
|||
|
||||
private final IPlayletPublicAccountService iPlayletPublicAccountService;
|
||||
|
||||
private final IPlayletItemService iPlayletItemService;
|
||||
|
||||
@Override
|
||||
public PageInfo<PlayletPublicDetail> getList(PlayletPublicDetail playletPublicDetail, Integer pageNum, Integer pageSize) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
|
|
@ -37,7 +47,61 @@ public class PlayletPublicDetailAppServiceImpl implements PlayletPublicDetailApp
|
|||
public PlayletPublicDetail getById(Long id) {
|
||||
PlayletPublicDetail model = iPlayletPublicDetailService.getById(id);
|
||||
model.setPlayletPublicAccount(iPlayletPublicAccountService.selectPlayletPublicAccountById(model.getPublicId()));
|
||||
// 调用接口查询二维码信息 -- 富文本格式
|
||||
if("01".equals(model.getType())){
|
||||
PlayletItem item = iPlayletItemService.getById(model.getItemId());
|
||||
fillQrcode(item.getItemId(), model);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
protected void fillQrcode(String itemNum, PlayletPublicDetail detail){
|
||||
if(detail.getItemOne() != null){
|
||||
detail.setItemOneUrl(getQrcode(itemNum, detail.getItemOne().toString()));
|
||||
}
|
||||
if(detail.getItemTwo() != null){
|
||||
detail.setItemTwoUrl(getQrcode(itemNum, detail.getItemTwo().toString()));
|
||||
}
|
||||
if(detail.getItemThree() != null){
|
||||
detail.setItemThreeUrl(getQrcode(itemNum, detail.getItemThree().toString()));
|
||||
}
|
||||
if(detail.getItemFour() != null){
|
||||
detail.setItemFourUrl(getQrcode(itemNum, detail.getItemFour().toString()));
|
||||
}
|
||||
if(detail.getItemFive() != null){
|
||||
detail.setItemFiveUrl(getQrcode(itemNum, detail.getItemFive().toString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getQrcode(String itemId, String itemNum){
|
||||
String token = "zlwaiSrEM9KEbilu5f";
|
||||
String timestamp = String.valueOf((int)(System.currentTimeMillis()/1000));
|
||||
String clientId = "10005693";
|
||||
String channelId = "34662";
|
||||
String signKey = MD5.create().digestHex(clientId + token + timestamp);
|
||||
JSONObject body = new JSONObject();
|
||||
body.put("clientId", clientId);
|
||||
body.put("channelId", channelId);
|
||||
body.put("bookId", itemId);
|
||||
body.put("chapterId",itemNum);
|
||||
body.put("signKey", signKey);
|
||||
body.put("timestamp", timestamp);
|
||||
body.put("fromDrId", "69104793291");
|
||||
body.put("referralId", "69104793291");
|
||||
// 调用推广api返回链接
|
||||
String url = "https://video.wqxsw.com/api/v1/channelapi/getminiqrcode";
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
headerMap.put("Content-Type", "application/json");
|
||||
HttpResponse result = HttpUtil.createPost(url).addHeaders(headerMap).body(JSONObject.toJSONString(body)).execute();
|
||||
// String result = HttpUtil.post("https://video.wqxsw.com/api/v1/channelapi/getminiqrcode", body);
|
||||
log.info("请求入参:{}, 地址:{}, 返回:{}", body, url, result.body());
|
||||
JSONObject json = JSONObject.parseObject(result.body());
|
||||
if("1".equals(json.getString("code"))){
|
||||
return json.getString("data");
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,12 +22,14 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-sm-3 control-label">阅读人数:</label>-->
|
||||
<!-- <div class="col-sm-8">-->
|
||||
<!-- <input name="readCount" class="form-control" type="text">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">短剧:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="itemId" name="itemId" class="form-control m-b" required>
|
||||
<option th:each="playletItem:${playletItems}" th:value="${playletItem.id}" th:text="${playletItem.videoName}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">标题:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
@ -50,13 +52,66 @@
|
|||
<div class="summernote" id="content"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-sm-3 control-label">点赞数:</label>-->
|
||||
<!-- <div class="col-sm-8">-->
|
||||
<!-- <input name="starCount" class="form-control" type="text">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集1:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemOne" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集2:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemTwo" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集3:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemThree" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集4:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemFour" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集5:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemFive" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集6:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemSix" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集7:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemSeven" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集8:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemEight" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集9:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemNine" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">剧集10:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="itemTen" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ public class PlayletPublicDetail extends BaseEntity
|
|||
@ApiModelProperty(value = "公众号id")
|
||||
private Long publicId;
|
||||
|
||||
/** 公众号id */
|
||||
@Excel(name = "短剧id")
|
||||
@ApiModelProperty(value = "短剧id")
|
||||
private Long itemId;
|
||||
|
||||
/** 阅读人数 */
|
||||
@Excel(name = "阅读人数")
|
||||
@ApiModelProperty(value = "阅读人数")
|
||||
|
|
@ -57,6 +62,59 @@ public class PlayletPublicDetail extends BaseEntity
|
|||
@ApiModelProperty(value = "点赞数")
|
||||
private String starCount;
|
||||
|
||||
@ApiModelProperty(value = "剧集1")
|
||||
private Integer itemOne;
|
||||
|
||||
@ApiModelProperty(value = "剧集2")
|
||||
private Integer itemTwo;
|
||||
|
||||
@ApiModelProperty(value = "剧集3")
|
||||
private Integer itemThree;
|
||||
|
||||
@ApiModelProperty(value = "剧集4")
|
||||
private Integer itemFour;
|
||||
|
||||
@ApiModelProperty(value = "剧集5")
|
||||
private Integer itemFive;
|
||||
|
||||
@ApiModelProperty(value = "剧集6")
|
||||
private Integer itemSix;
|
||||
|
||||
@ApiModelProperty(value = "剧集7")
|
||||
private Integer itemSeven;
|
||||
|
||||
@ApiModelProperty(value = "剧集8")
|
||||
private Integer itemEight;
|
||||
|
||||
@ApiModelProperty(value = "剧集9")
|
||||
private Integer itemNine;
|
||||
|
||||
@ApiModelProperty(value = "剧集10")
|
||||
private Integer itemTen;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String itemOneUrl;
|
||||
@TableField(exist = false)
|
||||
private String itemTwoUrl;
|
||||
@TableField(exist = false)
|
||||
private String itemThreeUrl;
|
||||
@TableField(exist = false)
|
||||
private String itemFourUrl;
|
||||
@TableField(exist = false)
|
||||
private String itemFiveUrl;
|
||||
@TableField(exist = false)
|
||||
private String itemSixUrl;
|
||||
@TableField(exist = false)
|
||||
private String itemSevenUrl;
|
||||
@TableField(exist = false)
|
||||
private String itemEightUrl;
|
||||
@TableField(exist = false)
|
||||
private String itemNineUrl;
|
||||
@TableField(exist = false)
|
||||
private String itemTenUrl;
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "归属公众号信息")
|
||||
private PlayletPublicAccount playletPublicAccount;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ public class PublicDetailComment extends BaseEntity
|
|||
@ApiModelProperty(value = "用户昵称")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
private String imgUrl;
|
||||
|
||||
/** 评论内容 */
|
||||
@Excel(name = "评论内容")
|
||||
@ApiModelProperty(value = "评论内容")
|
||||
|
|
|
|||
|
|
@ -7,9 +7,20 @@
|
|||
<resultMap type="PlayletPublicDetail" id="PlayletPublicDetailResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="publicId" column="public_id" />
|
||||
<result property="itemId" column="item_id" />
|
||||
<result property="readCount" column="read_count" />
|
||||
<result property="content" column="content" />
|
||||
<result property="starCount" column="star_count" />
|
||||
<result property="itemOne" column="item_one" />
|
||||
<result property="itemTwo" column="item_two" />
|
||||
<result property="itemThree" column="item_three" />
|
||||
<result property="itemFour" column="item_four" />
|
||||
<result property="itemFive" column="item_five" />
|
||||
<result property="itemSix" column="item_six" />
|
||||
<result property="itemSeven" column="item_seven" />
|
||||
<result property="itemEight" column="item_eight" />
|
||||
<result property="itemNine" column="item_nine" />
|
||||
<result property="itemTen" column="item_ten" />
|
||||
<result property="title" column="title" />
|
||||
<result property="imgUrl" column="img_url" />
|
||||
<result property="createBy" column="create_by" />
|
||||
|
|
@ -20,7 +31,11 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectPlayletPublicDetailVo">
|
||||
select id, public_id, read_count,star_count, title,img_url, content, create_by, create_time, update_by, update_time, remark from playlet_public_detail
|
||||
select id, public_id, item_id, read_count,star_count,
|
||||
item_one,item_two,item_three,item_four,item_five,
|
||||
item_six,item_seven,item_eight,item_nine,item_ten,
|
||||
title,img_url, content, create_by, create_time,
|
||||
update_by, update_time, remark from playlet_public_detail
|
||||
</sql>
|
||||
|
||||
<select id="selectPlayletPublicDetailList" parameterType="PlayletPublicDetail" resultMap="PlayletPublicDetailResult">
|
||||
|
|
@ -41,10 +56,21 @@
|
|||
insert into playlet_public_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="publicId != null">public_id,</if>
|
||||
<if test="itemId != null">item_id,</if>
|
||||
<if test="readCount != null">read_count,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="title != null">title,</if>
|
||||
<if test="starCount != null">star_count,</if>
|
||||
<if test="itemOne != null">item_one,</if>
|
||||
<if test="itemTwo != null">item_two,</if>
|
||||
<if test="itemThree != null">item_three,</if>
|
||||
<if test="itemFour != null">item_four,</if>
|
||||
<if test="itemFive != null">item_five,</if>
|
||||
<if test="itemSix != null">item_six,</if>
|
||||
<if test="itemSeven != null">item_seven,</if>
|
||||
<if test="itemEight != null">item_eight,</if>
|
||||
<if test="itemNine != null">item_nine,</if>
|
||||
<if test="itemTen != null">item_ten,</if>
|
||||
<if test="imgUrl != null">img_url,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
|
|
@ -54,10 +80,21 @@
|
|||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="publicId != null">#{publicId},</if>
|
||||
<if test="itemId != null">#{itemId},</if>
|
||||
<if test="readCount != null">#{readCount},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="title != null">#{title},</if>
|
||||
<if test="starCount != null">#{starCount},</if>
|
||||
<if test="itemOne != null">#{itemOne},</if>
|
||||
<if test="itemTwo != null">#{itemTwo},</if>
|
||||
<if test="itemThree != null">#{itemThree},</if>
|
||||
<if test="itemFour != null">#{itemFour},</if>
|
||||
<if test="itemFive != null">#{itemFive},</if>
|
||||
<if test="itemSix != null">#{itemSix},</if>
|
||||
<if test="itemSeven != null">#{itemSeven},</if>
|
||||
<if test="itemEight != null">#{itemEight},</if>
|
||||
<if test="itemNine != null">#{itemNine},</if>
|
||||
<if test="itemTen != null">#{itemTen},</if>
|
||||
<if test="imgUrl != null">#{imgUrl},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
|
|
@ -71,10 +108,21 @@
|
|||
update playlet_public_detail
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="publicId != null">public_id = #{publicId},</if>
|
||||
<if test="itemId != null">#{itemId},</if>
|
||||
<if test="readCount != null">read_count = #{readCount},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="starCount != null">star_count = #{starCount},</if>
|
||||
<if test="itemOne != null">item_one = #{itemOne},</if>
|
||||
<if test="itemTwo != null">item_two = #{itemTwo},</if>
|
||||
<if test="itemThree != null">item_three = #{itemThree},</if>
|
||||
<if test="itemFour != null">item_four = #{itemFour},</if>
|
||||
<if test="itemFive != null">item_five = #{itemFive},</if>
|
||||
<if test="itemSix != null">item_six = #{itemSix},</if>
|
||||
<if test="itemSeven != null">item_seven = #{itemSeven},</if>
|
||||
<if test="itemEight != null">item_eight = #{itemEight},</if>
|
||||
<if test="itemNine != null">item_nine = #{itemNine},</if>
|
||||
<if test="itemTen != null">item_ten = #{itemTen},</if>
|
||||
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
<result property="detailId" column="detail_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="imgUrl" column="img_url" />
|
||||
<result property="content" column="content" />
|
||||
<result property="starCount" column="star_count" />
|
||||
<result property="createBy" column="create_by" />
|
||||
|
|
@ -19,7 +20,7 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectPublicDetailCommentVo">
|
||||
select id, detail_id, user_id, user_name, content, star_count, create_by, create_time, update_by, update_time, remark from public_detail_comment
|
||||
select id, detail_id, user_id, user_name, img_url, content, star_count, create_by, create_time, update_by, update_time, remark from public_detail_comment
|
||||
</sql>
|
||||
|
||||
<select id="selectPublicDetailCommentList" parameterType="PublicDetailComment" resultMap="PublicDetailCommentResult">
|
||||
|
|
|
|||
Loading…
Reference in New Issue