Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pisns-forum-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
scrmGroup
pisns-forum-api
Commits
8b6d35f8
Commit
8b6d35f8
authored
Aug 11, 2016
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发布帖子时 过滤标题的html标签
parent
a00f9cb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
forumThreadService.js
app/service/forumThreadService.js
+4
-0
util.js
app/utils/util.js
+7
-0
No files found.
app/service/forumThreadService.js
View file @
8b6d35f8
...
...
@@ -13,6 +13,7 @@ var then = require('thenjs');
var
_
=
require
(
'lodash'
);
var
redisThreadList
=
require
(
'../utils/redisThreadList'
);
var
util
=
require
(
'../utils/util'
);
var
listThreadFields
=
{
...
...
@@ -214,6 +215,9 @@ exports.findCommentByPage = function(pageNo, pageSize, q, callback) {
//创建文章
exports
.
createThread
=
function
(
entity
,
callback
)
{
if
(
entity
&&
entity
.
title
){
entity
.
title
=
util
.
removeHTMLTag
(
entity
.
title
);
}
if
(
!
entity
.
share
)
{
var
forum
=
new
ForumThread
(
entity
);
...
...
app/utils/util.js
View file @
8b6d35f8
...
...
@@ -13,6 +13,13 @@ if (env == 'sandbox') {
API_ADDRESS
=
'https://rest.wxpai.cn'
;
}
exports
.
removeHTMLTag
=
function
(
str
)
{
str
=
str
.
replace
(
/<
\/?[^
>
]
*>/g
,
''
);
//去除HTML tag
str
=
str
.
replace
(
/
[
|
]
*
\n
/g
,
'
\
n'
);
//去除行尾空白
str
=
str
.
replace
(
/ /ig
,
''
);
//去掉
return
str
;
}
exports
.
loadLevel
=
function
(
ent_code
,
items
,
callback
){
var
openIds
=
[];
_
.
forEach
(
items
,
function
(
d
,
i
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment