公众号 和 公众号文章改造
This commit is contained in:
parent
082c722321
commit
1e749fe5eb
|
|
@ -2,7 +2,9 @@ package com.playlet.web.controller.system;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.playlet.common.core.domain.entity.SysUser;
|
||||
import com.playlet.system.domain.PlayletPublicDetail;
|
||||
import com.playlet.system.service.ISysUserService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
|
@ -32,6 +34,9 @@ public class PlayletPublicAccountController extends BaseController
|
|||
@Autowired
|
||||
private IPlayletPublicAccountService playletPublicAccountService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
|
||||
@GetMapping("/wxQrcode/{id}")
|
||||
public String wxQrcode(@PathVariable("id") String id, ModelMap mmap) {
|
||||
|
|
@ -68,6 +73,11 @@ public class PlayletPublicAccountController extends BaseController
|
|||
{
|
||||
startPage();
|
||||
List<PlayletPublicAccount> list = playletPublicAccountService.selectPlayletPublicAccountList(playletPublicAccount);
|
||||
list.forEach(model->{
|
||||
if(model.getManagerId() != null){
|
||||
model.setManagerName(sysUserService.selectUserById(model.getManagerId()).getUserName());
|
||||
}
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
@ -89,8 +99,9 @@ public class PlayletPublicAccountController extends BaseController
|
|||
* 新增公众号列
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
public String add(ModelMap modelMap)
|
||||
{
|
||||
modelMap.put("users",sysUserService.selectUserList(new SysUser()));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
|
|
@ -115,6 +126,7 @@ public class PlayletPublicAccountController extends BaseController
|
|||
{
|
||||
PlayletPublicAccount playletPublicAccount = playletPublicAccountService.selectPlayletPublicAccountById(id);
|
||||
mmap.put("playletPublicAccount", playletPublicAccount);
|
||||
mmap.put("users",sysUserService.selectUserList(new SysUser()));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ public class WxController {
|
|||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,6 @@ public interface WxService {
|
|||
|
||||
String getWxInfo(String openId, String accessToken);
|
||||
|
||||
String getWxTicket();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class PlayletPublicDetailAppServiceImpl implements PlayletPublicDetailApp
|
|||
PlayletPublicDetail model = iPlayletPublicDetailService.getById(id);
|
||||
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());
|
||||
fillQrcode(item.getItemId(), model);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,4 +60,16 @@ public class WxServiceImpl implements WxService {
|
|||
log.info("调用微信获取用户信息,响应内容:{}", 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,15 +100,20 @@
|
|||
},
|
||||
{
|
||||
field: 'originalContentCount',
|
||||
title: '原创片数'
|
||||
title: '原创篇数'
|
||||
},
|
||||
{
|
||||
field: 'followersCount',
|
||||
title: '关注人数'
|
||||
},
|
||||
{
|
||||
field: 'managerName',
|
||||
title: '运营人员'
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注'
|
||||
title: '备注',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增公众号列')" />
|
||||
<th:block th:include="include :: summernote-css" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
|
|
@ -24,7 +25,15 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">简介:</label>
|
||||
<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 class="form-group">
|
||||
|
|
@ -49,14 +58,16 @@
|
|||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<input name="remark" class="form-control" type="text">
|
||||
<input type="hidden" class="form-control" name="remark">
|
||||
<div class="summernote" id="remark"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<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">
|
||||
var prefix = ctx + "system/playlet/account"
|
||||
|
|
@ -88,6 +99,43 @@
|
|||
$.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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改公众号列')" />
|
||||
<th:block th:include="include :: summernote-css" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
|
|
@ -24,7 +26,7 @@
|
|||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">简介:</label>
|
||||
<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 class="form-group">
|
||||
|
|
@ -33,10 +35,21 @@
|
|||
<input name="authorAlias" th:field="*{authorAlias}" 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="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">
|
||||
<label class="col-sm-3 control-label">头像:</label>
|
||||
<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 class="form-group">
|
||||
|
|
@ -58,14 +71,17 @@
|
|||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
<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">
|
||||
var prefix = ctx + "system/playlet/account";
|
||||
$("#form-account-edit").validate({
|
||||
|
|
@ -77,6 +93,67 @@
|
|||
$.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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -36,6 +36,12 @@
|
|||
<input name="title" class="form-control" type="text">
|
||||
</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">
|
||||
<label class="col-sm-3 control-label">图片附件:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@
|
|||
field: 'title',
|
||||
title: '标题'
|
||||
},
|
||||
{
|
||||
field: 'authorAlias',
|
||||
title: '作者花名'
|
||||
},
|
||||
{
|
||||
field: 'starCount',
|
||||
title: '点赞数'
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@
|
|||
<input name="title" th:field="*{title}" class="form-control" type="text">
|
||||
</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">
|
||||
<label class="col-sm-3 control-label">详情(富文本):</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.playlet.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.playlet.common.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
|
@ -48,6 +49,12 @@ public class PlayletPublicAccount extends BaseEntity
|
|||
@ApiModelProperty(value = "作者花名")
|
||||
private String authorAlias;
|
||||
|
||||
@ApiModelProperty(value = "运营人员id")
|
||||
private Long managerId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String managerName;
|
||||
|
||||
/** 头像 */
|
||||
@Excel(name = "头像")
|
||||
@ApiModelProperty(value = "头像")
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ public class PlayletPublicDetail extends BaseEntity
|
|||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "作者花名")
|
||||
private String authorAlias;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String imgUrl;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<result property="publicType" column="public_type" />
|
||||
<result property="introduction" column="introduction" />
|
||||
<result property="authorAlias" column="author_alias" />
|
||||
<result property="managerId" column="manager_id" />
|
||||
<result property="logoUrl" column="logo_url" />
|
||||
<result property="address" column="address" />
|
||||
<result property="originalContentCount" column="original_content_count" />
|
||||
|
|
@ -22,7 +23,7 @@
|
|||
</resultMap>
|
||||
|
||||
<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>
|
||||
|
||||
<select id="selectPlayletPublicAccountList" parameterType="PlayletPublicAccount" resultMap="PlayletPublicAccountResult">
|
||||
|
|
@ -51,6 +52,7 @@
|
|||
<if test="publicType != null">public_type,</if>
|
||||
<if test="introduction != null">introduction,</if>
|
||||
<if test="authorAlias != null">author_alias,</if>
|
||||
<if test="managerId != null">manager_id,</if>
|
||||
<if test="logoUrl != null">logo_url,</if>
|
||||
<if test="address != null">address,</if>
|
||||
<if test="originalContentCount != null">original_content_count,</if>
|
||||
|
|
@ -66,6 +68,7 @@
|
|||
<if test="publicType != null">#{publicType},</if>
|
||||
<if test="introduction != null">#{introduction},</if>
|
||||
<if test="authorAlias != null">#{authorAlias},</if>
|
||||
<if test="managerId != null">#{managerId},</if>
|
||||
<if test="logoUrl != null">#{logoUrl},</if>
|
||||
<if test="address != null">#{address},</if>
|
||||
<if test="originalContentCount != null">#{originalContentCount},</if>
|
||||
|
|
@ -85,6 +88,7 @@
|
|||
<if test="publicType != null">public_type = #{publicType},</if>
|
||||
<if test="introduction != null">introduction = #{introduction},</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="address != null">address = #{address},</if>
|
||||
<if test="originalContentCount != null">original_content_count = #{originalContentCount},</if>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
<result property="itemNine" column="item_nine" />
|
||||
<result property="itemTen" column="item_ten" />
|
||||
<result property="title" column="title" />
|
||||
<result property="authorAlias" column="author_alias"/>
|
||||
<result property="imgUrl" column="img_url" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
|
|
@ -34,7 +35,7 @@
|
|||
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,
|
||||
title,author_alias,img_url, content, create_by, create_time,
|
||||
update_by, update_time, remark from playlet_public_detail
|
||||
</sql>
|
||||
|
||||
|
|
@ -60,6 +61,7 @@
|
|||
<if test="readCount != null">read_count,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="title != null">title,</if>
|
||||
<if test="authorAlias != null">author_alias,</if>
|
||||
<if test="starCount != null">star_count,</if>
|
||||
<if test="itemOne != null">item_one,</if>
|
||||
<if test="itemTwo != null">item_two,</if>
|
||||
|
|
@ -84,6 +86,7 @@
|
|||
<if test="readCount != null">#{readCount},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="title != null">#{title},</if>
|
||||
<if test="authorAlias != null">#{authorAlias},</if>
|
||||
<if test="starCount != null">#{starCount},</if>
|
||||
<if test="itemOne != null">#{itemOne},</if>
|
||||
<if test="itemTwo != null">#{itemTwo},</if>
|
||||
|
|
@ -112,6 +115,7 @@
|
|||
<if test="readCount != null">read_count = #{readCount},</if>
|
||||
<if test="content != null">content = #{content},</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="itemOne != null">item_one = #{itemOne},</if>
|
||||
<if test="itemTwo != null">item_two = #{itemTwo},</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue