Commit 46bfc13e authored by 刘文胜's avatar 刘文胜

帖子加share_pic字段用于后台设置分享图片,修改分享帖子的逻辑

parent d0959197
......@@ -490,8 +490,10 @@ router.get('/sharev2.js', function(req, res, next) {
}
desc = thread.content?thread.content.replace(/<\/?.+?>/g,"").replace(/&nbsp;/g,"").replace(/\t/g,"").replace(/\n/g,""):'';
// 分享图标:帖子带图片则使用第一张图片,否则使用发帖者的头像
if(thread.images && thread.images[0]){
// 分享图标:帖子设置了share_pic就使用share_pic ,否则帖子带图片则使用第一张图片,否则使用发帖者的头像
if(thread.share_pic){
imgUrl = thread.share_pic;
}else if(thread.images && thread.images[0]){
imgUrl = thread.images[0].urlFileName;
}else{
imgUrl = thread.from.displayIcon || thread.from.icon || thread.info.icon;
......
......@@ -79,7 +79,10 @@ var ForumThreadSchema = new Schema({
images: {//文章图片列表
type : Array
},
share: { //自定义分享
share_pic:{//帖子分享图标
type: String
},
share: { //自定义分享(已弃用,后台管理没有设置的页面了)
type: Schema.Types.ObjectId,
ref: 'ForumShare'
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment