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
27bf9dff
Commit
27bf9dff
authored
Jul 30, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
25827f1e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
25 deletions
+98
-25
forumIdentifyUser.js
app/controllers/admin/forumIdentifyUser.js
+7
-2
forumInfo.js
app/controllers/admin/forumInfo.js
+39
-9
forumThread.js
app/controllers/admin/forumThread.js
+34
-7
forumInfo.js
app/controllers/mobile/forumInfo.js
+15
-0
forumThread.js
app/controllers/mobile/forumThread.js
+1
-0
forumLimitActionRefService.js
app/service/forumLimitActionRefService.js
+1
-6
forumThreadService.js
app/service/forumThreadService.js
+1
-1
No files found.
app/controllers/admin/forumIdentifyUser.js
View file @
27bf9dff
...
...
@@ -72,7 +72,7 @@ router.post('/user/identifyUser',function(req,res,next){
}
});
}
else
{
res
.
json
(
'success'
);
res
.
json
(
{
result
:
'success'
,
userId
:
req
.
session
.
mobileForumUser
.
userId
}
);
}
});
//微信分享带来用户
...
...
@@ -115,7 +115,12 @@ router.post('/user/checkLimitAction', function(req, res, next) {
forumLimitActionRefService
.
getLimitActionRefByMid
(
userId
,
function
(
err
,
forumLimitActionRef
){
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
'success'
);
var
returnObject
=
{
errcode
:
'success'
,
configs
:
configs
,
data
:
array
}
res
.
json
(
returnObject
);
}
else
{
// 获取到用户行为限制记录
if
(
forumLimitActionRef
){
...
...
app/controllers/admin/forumInfo.js
View file @
27bf9dff
...
...
@@ -2,12 +2,14 @@
var
express
=
require
(
'express'
),
router
=
express
.
Router
(),
returnCode
=
require
(
'../../utils/returnCode'
),
_
=
require
(
'lodash'
);
_
=
require
(
'lodash'
),
then
=
require
(
'thenjs'
);
var
mongoose
=
require
(
'mongoose'
);
var
ForumInfo
=
mongoose
.
model
(
'ForumInfo'
);
var
forumInfoService
=
require
(
'../../service/forumInfoService'
);
var
forumThreadService
=
require
(
'../../service/forumThreadService'
);
var
forumGroupService
=
require
(
'../../service/forumGroupService'
);
module
.
exports
=
function
(
app
)
{
...
...
@@ -17,15 +19,43 @@ module.exports = function(app) {
//新增论坛板块
router
.
post
(
'/info/create'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
req
.
body
.
ent_code
=
req
.
session
.
user
.
ent_code
;
forumInfoService
.
createInfo
(
req
.
body
,
function
(
err
,
info
){
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
{
'id'
:
info
.
_id
};
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
var
entity
=
req
.
body
;
var
ent_code
=
entity
.
ent_code
=
req
.
session
.
user
.
ent_code
;
then
(
function
(
cont
){
//获取所有版块组
forumGroupService
.
getAll
({
ent_code
:
ent_code
},
1
,
100
,
function
(
err
,
groups
){
cont
(
err
,
groups
);
});
}).
then
(
function
(
cont
,
groups
){
//判断是否存在版块组
if
(
groups
&&
groups
.
items
.
length
>
0
){
cont
(
null
,
groups
.
items
[
0
]);
}
else
{
//创建默认版块组
var
group
=
{
name
:
'默认分组'
,
ent_code
:
ent_code
};
forumGroupService
.
createGroup
(
group
,
function
(
err
,
group
){
cont
(
err
,
group
);
});
}
}).
then
(
function
(
cont
,
group
){
if
(
group
){
//创建版块
entity
.
group
=
group
.
_id
;
forumInfoService
.
createInfo
(
req
.
body
,
function
(
err
,
info
){
cont
(
err
,
info
);
});
}
else
{
cont
(
'group error'
);
}
}).
then
(
function
(
cont
,
info
){
rs
.
data
=
{
'id'
:
info
.
_id
};
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}).
fail
(
function
(
err
,
cont
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
});
});
...
...
app/controllers/admin/forumThread.js
View file @
27bf9dff
...
...
@@ -615,6 +615,18 @@ router.post('/thread/comment/add', function(req, res, next) {
}
});
}
else
{
var
icon
=
req
.
session
.
user
.
headPic
;
if
(
icon
.
indexOf
(
'http://'
)
==
-
1
){
icon
=
req
.
host
!=
'piplus.wxpai.cn'
?
'http://img3.wxpai.cn/'
+
icon
:
'http://img2.wxpai.cn/'
+
icon
;
}
if
(
icon
&&
(
!
user
.
icon
||
user
.
icon
!==
icon
)){
forumUserService
.
updateUserById
(
user
.
_id
,{
icon
:
icon
},
function
(
err
){
if
(
err
){
console
.
log
(
err
);
}
});
}
entity
.
from
=
user
;
callback
();
}
...
...
@@ -644,16 +656,31 @@ router.post('/thread/comment/add', function(req, res, next) {
},
function
(
callback
){
// 添加评论
forumCommentService
.
createComment
(
entity
,
function
(
err
,
resul
t
)
{
forumCommentService
.
createComment
(
entity
,
function
(
err
,
commen
t
)
{
if
(
err
)
{
callback
(
err
);
}
else
{
var
returnData
=
{
comment
:
result
,
errorcode
:
0
,
errormsg
:
'请求成功'
}
callback
(
null
,
returnData
);
forumThreadService
.
getById
(
tid
,
function
(
err
,
thread
){
var
comments
=
thread
.
comments
;
var
array
=
[];
if
(
comments
&&
comments
.
length
>
0
)
{
array
=
comments
;
}
array
.
push
(
comment
.
_id
);
forumThreadService
.
updateThreadById
(
tid
,
{
comments
:
array
,
$inc
:
{
comment_count
:
1
}
},
function
(
err
,
result
)
{
var
returnData
=
{
comment
:
comment
,
errorcode
:
0
,
errormsg
:
'请求成功'
}
callback
(
null
,
returnData
);
});
});
}
});
}
...
...
app/controllers/mobile/forumInfo.js
View file @
27bf9dff
...
...
@@ -19,6 +19,21 @@ module.exports = function(app) {
app
.
use
(
'/v1/forum'
,
router
);
};
//新增论坛板块
router
.
get
(
'/info/list/all'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
var
ent_code
=
req
.
session
.
user
.
ent_code
;
forumInfoService
.
getAllByGid
({
ent_code
:
ent_code
},
1
,
100
,
function
(
err
,
datas
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
datas
.
items
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
});
//新增论坛板块
router
.
post
(
'/info/create'
,
function
(
req
,
res
,
next
)
{
var
rs
=
{};
...
...
app/controllers/mobile/forumThread.js
View file @
27bf9dff
...
...
@@ -138,6 +138,7 @@ router.post('/thread/create', function(req, res, next) {
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
if
(
isProhibition
){
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
...
...
app/service/forumLimitActionRefService.js
View file @
27bf9dff
...
...
@@ -204,8 +204,8 @@ exports.checkLimitActionProhibitionOfSpeech = function(userId,callback) {
//检查用户是否被禁加积分
exports
.
checkLimitActionProhibitionAddIntegral
=
function
(
userId
,
callback
)
{
var
isProhibition
=
false
;
if
(
userId
){
var
isProhibition
=
false
;
getLimitActionRef
(
userId
,
function
(
err
,
forumLimitActionRef
){
if
(
err
)
{
console
.
error
(
err
);
...
...
@@ -228,11 +228,6 @@ exports.checkLimitActionProhibitionAddIntegral = function(userId,callback) {
}
}
}
if
(
isProhibition
){
console
.
log
(
'Integral:!送积分'
);
}
else
{
console
.
log
(
'Integral:送积分'
);
}
callback
(
null
,
isProhibition
);
}
else
{
callback
(
null
,
isProhibition
);
...
...
app/service/forumThreadService.js
View file @
27bf9dff
...
...
@@ -811,7 +811,7 @@ exports.updateRecommendByThreadId = function(threadId, callback) {
},
{
recommend
:
1
},
function
(
err
,
doc
)
{
callback
(
err
,
null
);
callback
(
err
,
doc
);
});
};
//根据文章ID更新文章为不推荐
...
...
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