公众号 和 公众号文章改造

This commit is contained in:
kuang.yife 2024-06-19 16:09:54 +08:00
parent 082c722321
commit 1e749fe5eb
15 changed files with 209 additions and 14 deletions

View File

@ -2,7 +2,9 @@ package com.playlet.web.controller.system;
import java.util.List; import java.util.List;
import com.playlet.common.core.domain.entity.SysUser;
import com.playlet.system.domain.PlayletPublicDetail; import com.playlet.system.domain.PlayletPublicDetail;
import com.playlet.system.service.ISysUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -32,6 +34,9 @@ public class PlayletPublicAccountController extends BaseController
@Autowired @Autowired
private IPlayletPublicAccountService playletPublicAccountService; private IPlayletPublicAccountService playletPublicAccountService;
@Autowired
private ISysUserService sysUserService;
@GetMapping("/wxQrcode/{id}") @GetMapping("/wxQrcode/{id}")
public String wxQrcode(@PathVariable("id") String id, ModelMap mmap) { public String wxQrcode(@PathVariable("id") String id, ModelMap mmap) {
@ -68,6 +73,11 @@ public class PlayletPublicAccountController extends BaseController
{ {
startPage(); startPage();
List<PlayletPublicAccount> list = playletPublicAccountService.selectPlayletPublicAccountList(playletPublicAccount); List<PlayletPublicAccount> list = playletPublicAccountService.selectPlayletPublicAccountList(playletPublicAccount);
list.forEach(model->{
if(model.getManagerId() != null){
model.setManagerName(sysUserService.selectUserById(model.getManagerId()).getUserName());
}
});
return getDataTable(list); return getDataTable(list);
} }
@ -89,8 +99,9 @@ public class PlayletPublicAccountController extends BaseController
* 新增公众号列 * 新增公众号列
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add() public String add(ModelMap modelMap)
{ {
modelMap.put("users",sysUserService.selectUserList(new SysUser()));
return prefix + "/add"; return prefix + "/add";
} }
@ -115,6 +126,7 @@ public class PlayletPublicAccountController extends BaseController
{ {
PlayletPublicAccount playletPublicAccount = playletPublicAccountService.selectPlayletPublicAccountById(id); PlayletPublicAccount playletPublicAccount = playletPublicAccountService.selectPlayletPublicAccountById(id);
mmap.put("playletPublicAccount", playletPublicAccount); mmap.put("playletPublicAccount", playletPublicAccount);
mmap.put("users",sysUserService.selectUserList(new SysUser()));
return prefix + "/edit"; return prefix + "/edit";
} }

View File

@ -46,6 +46,11 @@ public class WxController {
return Result.success(wxService.getWxInfo(openId, accessToken)); return Result.success(wxService.getWxInfo(openId, accessToken));
} }
@ApiOperation(value = "获取jsapi_ticket", httpMethod = "GET")
@GetMapping("/getWxTicket")
@ResponseBody
public Result<String> getWxTicket(){
return Result.success(wxService.getWxTicket());
}
} }

View File

@ -14,4 +14,6 @@ public interface WxService {
String getWxInfo(String openId, String accessToken); String getWxInfo(String openId, String accessToken);
String getWxTicket();
} }

View File

@ -48,7 +48,7 @@ public class PlayletPublicDetailAppServiceImpl implements PlayletPublicDetailApp
PlayletPublicDetail model = iPlayletPublicDetailService.getById(id); PlayletPublicDetail model = iPlayletPublicDetailService.getById(id);
model.setPlayletPublicAccount(iPlayletPublicAccountService.selectPlayletPublicAccountById(model.getPublicId())); model.setPlayletPublicAccount(iPlayletPublicAccountService.selectPlayletPublicAccountById(model.getPublicId()));
// 调用接口查询二维码信息 -- 富文本格式 // 调用接口查询二维码信息 -- 富文本格式
if("01".equals(model.getType())){ if("01".equals(model.getType()) && model.getItemId() != null){
PlayletItem item = iPlayletItemService.getById(model.getItemId()); PlayletItem item = iPlayletItemService.getById(model.getItemId());
fillQrcode(item.getItemId(), model); fillQrcode(item.getItemId(), model);
} }

View File

@ -60,4 +60,16 @@ public class WxServiceImpl implements WxService {
log.info("调用微信获取用户信息,响应内容:{}", result); log.info("调用微信获取用户信息,响应内容:{}", result);
return result; return result;
} }
@Override
public String getWxTicket() {
String accessTokenResult = HttpUtils.sendGet("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx2b7d9259c1188067&secret=919165aae35838480986555f6c03ae6f");
log.info("accessTokenResult : {} ", accessTokenResult);
String accessToken = JSONObject.parseObject(accessTokenResult).getString("access_token");
String url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + accessToken + "&type=jsapi";
log.info("调用微信获取Ticket,入参url:{}", url);
String result = HttpUtils.sendGet(url);
log.info("调用微信获取Ticket,响应内容:{}", result);
return result;
}
} }

View File

@ -100,15 +100,20 @@
}, },
{ {
field: 'originalContentCount', field: 'originalContentCount',
title: '原创数' title: '原创数'
}, },
{ {
field: 'followersCount', field: 'followersCount',
title: '关注人数' title: '关注人数'
}, },
{
field: 'managerName',
title: '运营人员'
},
{ {
field: 'remark', field: 'remark',
title: '备注' title: '备注',
visible: false
}, },
{ {
title: '操作', title: '操作',

View File

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('新增公众号列')" /> <th:block th:include="include :: header('新增公众号列')" />
<th:block th:include="include :: summernote-css" />
<th:block th:include="include :: bootstrap-fileinput-css"/> <th:block th:include="include :: bootstrap-fileinput-css"/>
</head> </head>
<body class="white-bg"> <body class="white-bg">
@ -24,7 +25,15 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">简介:</label> <label class="col-sm-3 control-label">简介:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="introduction" class="form-control" type="text"> <textarea name="introduction" class="form-control" th:rows="4"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">运营人员:</label>
<div class="col-sm-8">
<select id="managerId" name="managerId" class="form-control m-b" required>
<option th:each="user:${users}" th:value="${user.userId}" th:text="${user.userName}"></option>
</select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -49,14 +58,16 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">备注</label> <label class="col-sm-3 control-label">用户协议</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="remark" class="form-control" type="text"> <input type="hidden" class="form-control" name="remark">
<div class="summernote" id="remark"></div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: summernote-js" />
<th:block th:include="include :: bootstrap-fileinput-js"/> <th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "system/playlet/account" var prefix = ctx + "system/playlet/account"
@ -88,6 +99,43 @@
$.operate.save(prefix + "/add", $('#form-account-add').serialize()); $.operate.save(prefix + "/add", $('#form-account-add').serialize());
} }
} }
$(function() {
$('.summernote').summernote({
lang: 'zh-CN',
height: 300,
dialogsInBody: true,
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
});
</script> </script>
</body> </body>
</html> </html>

View File

@ -2,6 +2,8 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('修改公众号列')" /> <th:block th:include="include :: header('修改公众号列')" />
<th:block th:include="include :: summernote-css" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -24,7 +26,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">简介:</label> <label class="col-sm-3 control-label">简介:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="introduction" th:field="*{introduction}" class="form-control" type="text"> <textarea name="introduction" th:field="*{introduction}" th:rows="4" class="form-control"></textarea>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -33,10 +35,21 @@
<input name="authorAlias" th:field="*{authorAlias}" class="form-control" type="text"> <input name="authorAlias" th:field="*{authorAlias}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">运营人员:</label>
<div class="col-sm-8">
<select id="managerId" name="managerId" class="form-control m-b" required>
<option th:each="user:${users}" th:value="${user.userId}" th:text="${user.userName}" th:field="*{managerId}"></option>
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">头像:</label> <label class="col-sm-3 control-label">头像:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="logoUrl" th:field="*{logoUrl}" class="form-control" type="text"> <input name="logoUrl" th:field="*{logoUrl}" type="text" hidden="hidden">
<div class="file-loading">
<input id="logoUrlFile" name="file" type="file">
</div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -58,14 +71,17 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">备注</label> <label class="col-sm-3 control-label">用户协议</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text"> <input type="hidden" class="form-control" th:field="*{remark}">
<div class="summernote" id="remark"></div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: summernote-js" />
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "system/playlet/account"; var prefix = ctx + "system/playlet/account";
$("#form-account-edit").validate({ $("#form-account-edit").validate({
@ -77,6 +93,67 @@
$.operate.save(prefix + "/edit", $('#form-account-edit').serialize()); $.operate.save(prefix + "/edit", $('#form-account-edit').serialize());
} }
} }
// 详情页
$("#logoUrlFile").fileinput({
uploadUrl: ctx + 'tool/oss/uploadFromPlaylet',
maxFileCount: 1,
dropZoneEnabled: false, //是否显示拖拽区域
showPreview: false,
autoReplace: true
}).on('fileuploaded', function (event, data, previewId, index) {
console.log(data);
if(data.response.success){
$("input[name='logoUrl']").val(data.response.msg)
}else {
alert("上传失败!");
}
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
$("input[name='logoUrl']").val('')
})
$(function() {
$('.summernote').each(function(i) {
$('#' + this.id).summernote({
lang: 'zh-CN',
dialogsInBody: true,
height: 300,
callbacks: {
onChange: function(contents, $edittable) {
$("input[name='" + this.id + "']").val(contents);
},
onImageUpload: function(files) {
var obj = this;
var data = new FormData();
data.append("file", files[0]);
$.ajax({
type: "post",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$('#' + obj.id).summernote('insertImage', result.url);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
}
});
var content = $("input[name='" + this.id + "']").val();
$('#' + this.id).summernote('code', content);
})
});
</script> </script>
</body> </body>
</html> </html>

View File

@ -36,6 +36,12 @@
<input name="title" class="form-control" type="text"> <input name="title" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">作者花名:</label>
<div class="col-sm-8">
<input name="authorAlias" class="form-control" type="text">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">图片附件:</label> <label class="col-sm-3 control-label">图片附件:</label>
<div class="col-sm-8"> <div class="col-sm-8">

View File

@ -85,6 +85,10 @@
field: 'title', field: 'title',
title: '标题' title: '标题'
}, },
{
field: 'authorAlias',
title: '作者花名'
},
{ {
field: 'starCount', field: 'starCount',
title: '点赞数' title: '点赞数'

View File

@ -22,6 +22,12 @@
<input name="title" th:field="*{title}" class="form-control" type="text"> <input name="title" th:field="*{title}" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">作者花名:</label>
<div class="col-sm-8">
<input name="authorAlias" th:field="*{authorAlias}" class="form-control" type="text">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">详情(富文本)</label> <label class="col-sm-3 control-label">详情(富文本)</label>
<div class="col-sm-8"> <div class="col-sm-8">

View File

@ -1,6 +1,7 @@
package com.playlet.system.domain; package com.playlet.system.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.playlet.common.core.domain.BaseEntity; import com.playlet.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@ -48,6 +49,12 @@ public class PlayletPublicAccount extends BaseEntity
@ApiModelProperty(value = "作者花名") @ApiModelProperty(value = "作者花名")
private String authorAlias; private String authorAlias;
@ApiModelProperty(value = "运营人员id")
private Long managerId;
@TableField(exist = false)
private String managerName;
/** 头像 */ /** 头像 */
@Excel(name = "头像") @Excel(name = "头像")
@ApiModelProperty(value = "头像") @ApiModelProperty(value = "头像")

View File

@ -56,6 +56,9 @@ public class PlayletPublicDetail extends BaseEntity
@ApiModelProperty(value = "标题") @ApiModelProperty(value = "标题")
private String title; private String title;
@ApiModelProperty(value = "作者花名")
private String authorAlias;
@ApiModelProperty(value = "图片") @ApiModelProperty(value = "图片")
private String imgUrl; private String imgUrl;

View File

@ -10,6 +10,7 @@
<result property="publicType" column="public_type" /> <result property="publicType" column="public_type" />
<result property="introduction" column="introduction" /> <result property="introduction" column="introduction" />
<result property="authorAlias" column="author_alias" /> <result property="authorAlias" column="author_alias" />
<result property="managerId" column="manager_id" />
<result property="logoUrl" column="logo_url" /> <result property="logoUrl" column="logo_url" />
<result property="address" column="address" /> <result property="address" column="address" />
<result property="originalContentCount" column="original_content_count" /> <result property="originalContentCount" column="original_content_count" />
@ -22,7 +23,7 @@
</resultMap> </resultMap>
<sql id="selectPlayletPublicAccountVo"> <sql id="selectPlayletPublicAccountVo">
select id, name, public_type, introduction, author_alias, logo_url, address, original_content_count, followers_count, create_by, create_time, update_by, update_time, remark from playlet_public_account select id, name, public_type, introduction, author_alias, manager_id, logo_url, address, original_content_count, followers_count, create_by, create_time, update_by, update_time, remark from playlet_public_account
</sql> </sql>
<select id="selectPlayletPublicAccountList" parameterType="PlayletPublicAccount" resultMap="PlayletPublicAccountResult"> <select id="selectPlayletPublicAccountList" parameterType="PlayletPublicAccount" resultMap="PlayletPublicAccountResult">
@ -51,6 +52,7 @@
<if test="publicType != null">public_type,</if> <if test="publicType != null">public_type,</if>
<if test="introduction != null">introduction,</if> <if test="introduction != null">introduction,</if>
<if test="authorAlias != null">author_alias,</if> <if test="authorAlias != null">author_alias,</if>
<if test="managerId != null">manager_id,</if>
<if test="logoUrl != null">logo_url,</if> <if test="logoUrl != null">logo_url,</if>
<if test="address != null">address,</if> <if test="address != null">address,</if>
<if test="originalContentCount != null">original_content_count,</if> <if test="originalContentCount != null">original_content_count,</if>
@ -66,6 +68,7 @@
<if test="publicType != null">#{publicType},</if> <if test="publicType != null">#{publicType},</if>
<if test="introduction != null">#{introduction},</if> <if test="introduction != null">#{introduction},</if>
<if test="authorAlias != null">#{authorAlias},</if> <if test="authorAlias != null">#{authorAlias},</if>
<if test="managerId != null">#{managerId},</if>
<if test="logoUrl != null">#{logoUrl},</if> <if test="logoUrl != null">#{logoUrl},</if>
<if test="address != null">#{address},</if> <if test="address != null">#{address},</if>
<if test="originalContentCount != null">#{originalContentCount},</if> <if test="originalContentCount != null">#{originalContentCount},</if>
@ -85,6 +88,7 @@
<if test="publicType != null">public_type = #{publicType},</if> <if test="publicType != null">public_type = #{publicType},</if>
<if test="introduction != null">introduction = #{introduction},</if> <if test="introduction != null">introduction = #{introduction},</if>
<if test="authorAlias != null">author_alias = #{authorAlias},</if> <if test="authorAlias != null">author_alias = #{authorAlias},</if>
<if test="managerId != null">manager_id = #{managerId},</if>
<if test="logoUrl != null">logo_url = #{logoUrl},</if> <if test="logoUrl != null">logo_url = #{logoUrl},</if>
<if test="address != null">address = #{address},</if> <if test="address != null">address = #{address},</if>
<if test="originalContentCount != null">original_content_count = #{originalContentCount},</if> <if test="originalContentCount != null">original_content_count = #{originalContentCount},</if>

View File

@ -22,6 +22,7 @@
<result property="itemNine" column="item_nine" /> <result property="itemNine" column="item_nine" />
<result property="itemTen" column="item_ten" /> <result property="itemTen" column="item_ten" />
<result property="title" column="title" /> <result property="title" column="title" />
<result property="authorAlias" column="author_alias"/>
<result property="imgUrl" column="img_url" /> <result property="imgUrl" column="img_url" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
@ -34,7 +35,7 @@
select id, public_id, item_id, read_count,star_count, select id, public_id, item_id, read_count,star_count,
item_one,item_two,item_three,item_four,item_five, item_one,item_two,item_three,item_four,item_five,
item_six,item_seven,item_eight,item_nine,item_ten, item_six,item_seven,item_eight,item_nine,item_ten,
title,img_url, content, create_by, create_time, title,author_alias,img_url, content, create_by, create_time,
update_by, update_time, remark from playlet_public_detail update_by, update_time, remark from playlet_public_detail
</sql> </sql>
@ -60,6 +61,7 @@
<if test="readCount != null">read_count,</if> <if test="readCount != null">read_count,</if>
<if test="content != null">content,</if> <if test="content != null">content,</if>
<if test="title != null">title,</if> <if test="title != null">title,</if>
<if test="authorAlias != null">author_alias,</if>
<if test="starCount != null">star_count,</if> <if test="starCount != null">star_count,</if>
<if test="itemOne != null">item_one,</if> <if test="itemOne != null">item_one,</if>
<if test="itemTwo != null">item_two,</if> <if test="itemTwo != null">item_two,</if>
@ -84,6 +86,7 @@
<if test="readCount != null">#{readCount},</if> <if test="readCount != null">#{readCount},</if>
<if test="content != null">#{content},</if> <if test="content != null">#{content},</if>
<if test="title != null">#{title},</if> <if test="title != null">#{title},</if>
<if test="authorAlias != null">#{authorAlias},</if>
<if test="starCount != null">#{starCount},</if> <if test="starCount != null">#{starCount},</if>
<if test="itemOne != null">#{itemOne},</if> <if test="itemOne != null">#{itemOne},</if>
<if test="itemTwo != null">#{itemTwo},</if> <if test="itemTwo != null">#{itemTwo},</if>
@ -112,6 +115,7 @@
<if test="readCount != null">read_count = #{readCount},</if> <if test="readCount != null">read_count = #{readCount},</if>
<if test="content != null">content = #{content},</if> <if test="content != null">content = #{content},</if>
<if test="title != null">title = #{title},</if> <if test="title != null">title = #{title},</if>
<if test="authorAlias != null">author_alias = #{authorAlias},</if>
<if test="starCount != null">star_count = #{starCount},</if> <if test="starCount != null">star_count = #{starCount},</if>
<if test="itemOne != null">item_one = #{itemOne},</if> <if test="itemOne != null">item_one = #{itemOne},</if>
<if test="itemTwo != null">item_two = #{itemTwo},</if> <if test="itemTwo != null">item_two = #{itemTwo},</if>