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
f2a348e7
Commit
f2a348e7
authored
Aug 04, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
迁移标签 归属于板块
parent
c9834909
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
25 deletions
+67
-25
forumTag.js
app/controllers/admin/forumTag.js
+9
-4
forumThread.js
app/controllers/admin/forumThread.js
+14
-10
forumInfo.js
app/controllers/mobile/forumInfo.js
+27
-0
forumTag.js
app/models/forumTag.js
+6
-0
forumTagService.js
app/service/forumTagService.js
+1
-1
httpService.js
app/service/httpService.js
+10
-10
No files found.
app/controllers/admin/forumTag.js
View file @
f2a348e7
...
...
@@ -97,9 +97,10 @@ router.get('/tag/:tid/get', function(req, res, next) {
//查询所有标签
router
.
get
(
'/tag/list'
,
function
(
req
,
res
,
next
)
{
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
tagName
=
req
.
query
.
tagName
||
''
;
var
pageNo
=
req
.
query
.
pageNo
||
1
,
pageSize
=
req
.
query
.
pageSize
||
10
,
tagName
=
req
.
query
.
tagName
||
''
,
info
=
req
.
query
.
info
||
''
;
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
...
...
@@ -109,6 +110,9 @@ router.get('/tag/list', function(req, res, next) {
$regex
:
tagName
,
$options
:
'i'
};
}
if
(
info
){
conditions
.
info
=
info
;
}
forumTagService
.
getAllTag
(
conditions
,
pageNo
,
pageSize
,
function
(
err
,
results
){
if
(
err
){
...
...
@@ -118,4 +122,5 @@ router.get('/tag/list', function(req, res, next) {
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
}
});
});
\ No newline at end of file
});
app/controllers/admin/forumThread.js
View file @
f2a348e7
...
...
@@ -18,7 +18,6 @@ var httpService = require('../../service/httpService');
var
userUtil
=
require
(
'../../utils/user'
);
var
async
=
require
(
'async'
);
var
_
=
require
(
'lodash'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/admin/forum'
,
router
);
...
...
@@ -110,7 +109,7 @@ router.get('/thread/:tid/get', function(req, res, next) {
var
tid
=
req
.
params
.
tid
||
null
;
var
rs
=
{};
if
(
tid
)
{
async
.
paralle
l
([
async
.
waterfal
l
([
function
(
callback
)
{
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
if
(
err
)
{
...
...
@@ -120,14 +119,19 @@ router.get('/thread/:tid/get', function(req, res, next) {
}
});
},
function
(
callback
)
{
forumTagService
.
getAllTag
({
ent_code
:
req
.
session
.
user
.
ent_code
},
1
,
100
,
function
(
err
,
results
)
{
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
callback
(
null
,
results
);
}
});
function
(
thread
,
callback
)
{
if
(
thread
&&
thread
.
info
&&
thread
.
info
.
_id
){
forumTagService
.
getAllTag
({
ent_code
:
req
.
session
.
user
.
ent_code
,
info
:
thread
.
info
.
_id
},
1
,
100
,
function
(
err
,
results
)
{
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
callback
(
null
,
[
thread
,
results
]);
}
});
}
else
{
callback
(
null
,[
thread
]);
}
}
],
function
(
err
,
results
)
{
if
(
err
)
{
...
...
app/controllers/mobile/forumInfo.js
View file @
f2a348e7
...
...
@@ -9,6 +9,7 @@ var ForumInfo = mongoose.model('ForumInfo');
var
forumInfoService
=
require
(
'../../service/forumInfoService'
);
var
forumThreadService
=
require
(
'../../service/forumThreadService'
);
var
forumUserThreadControlService
=
require
(
'../../service/forumUserThreadControlService'
);
var
forumTagService
=
require
(
'../../service/forumTagService'
);
var
httpService
=
require
(
'../../service/httpService'
);
var
user
=
require
(
'../../utils/user'
);
...
...
@@ -423,3 +424,29 @@ router.get('/info/:fid/serachThreads', function(req, res, next) {
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
//获取标签列表
router
.
get
(
'/info/:fid/tags'
,
function
(
req
,
res
,
next
)
{
var
fid
=
req
.
params
.
fid
||
null
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
1000
;
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
info
:
fid
,
type
:
1
};
if
(
fid
)
{
forumTagService
.
getAllTag
(
conditions
,
pageNo
,
pageSize
,
function
(
err
,
results
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
app/models/forumTag.js
View file @
f2a348e7
...
...
@@ -13,6 +13,12 @@ var ForumTagSchema = new Schema({
type
:
String
,
require
:
true
,
},
info
:{
//板块
type
:
Schema
.
Types
.
ObjectId
,
require
:
true
,
index
:
true
,
ref
:
'ForumInfo'
},
type
:
{
// 标签类型 1、前后台通用 2、后台使用
type
:
Number
,
require
:
true
,
...
...
app/service/forumTagService.js
View file @
f2a348e7
...
...
@@ -72,7 +72,7 @@ exports.getAllTag= function(conditions,pageNo,pageSize,callback) {
}
else
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
ForumTag
.
find
(
conditions
,
null
,
{
skip
:
skip
,
limit
:
limit
,
sort
:
'created'
},
function
(
err
,
docs
){
ForumTag
.
find
(
conditions
,
null
,
{
skip
:
skip
,
limit
:
limit
,
sort
:
'created'
,
populate
:
'info'
},
function
(
err
,
docs
){
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
...
...
app/service/httpService.js
View file @
f2a348e7
...
...
@@ -33,11 +33,11 @@ exports.sendRequest = function(ent_code, mid, action, messageid, integral, exp)
integral
:
integral
||
0
,
exp
:
exp
||
0
};
redis
.
lpush
(
'adapter-redis-to-ons'
,
JSON
.
stringify
(
obj
),
function
(
err
,
reply
)
{
if
(
err
)
{
console
.
error
(
err
);
}
});
//
redis.lpush('adapter-redis-to-ons', JSON.stringify(obj), function(err, reply) {
//
if (err) {
//
console.error(err);
//
}
//
});
};
//推送文章记录
...
...
@@ -56,11 +56,11 @@ var sendThreadLogRequest = function(open_id, user_agent, origin_ip, method, nick
"source_channel"
:
source_channel
,
//分享入口渠道(0:官方直接分享;1:微信朋友圈;2:微信好友;3:QQ好友;4:腾讯微博;5:广告组;6:自媒体;)
"source_open_id"
:
source_open_id
//分享人的open_id
};
redis
.
publish
(
'__pi_front_access_log_old__'
,
JSON
.
stringify
(
obj
),
function
(
err
,
reply
)
{
if
(
err
)
{
console
.
error
(
err
);
}
});
//
redis.publish('__pi_front_access_log_old__', JSON.stringify(obj), function(err, reply) {
//
if (err) {
//
console.error(err);
//
}
//
});
};
var
getClientIP
=
function
(
req
)
{
...
...
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