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
183b5bab
Commit
183b5bab
authored
Oct 15, 2015
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'newfunc_1009_memberlevel'
parents
934cc31b
8ab47f24
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
630 additions
and
461 deletions
+630
-461
forumAboutMe.js
app/controllers/mobile/forumAboutMe.js
+30
-24
forumInfo.js
app/controllers/mobile/forumInfo.js
+196
-175
forumThread.js
app/controllers/mobile/forumThread.js
+322
-262
util.js
app/utils/util.js
+82
-0
No files found.
app/controllers/mobile/forumAboutMe.js
View file @
183b5bab
...
...
@@ -2,9 +2,11 @@
var
express
=
require
(
'express'
),
router
=
express
.
Router
(),
user
=
require
(
'../../utils/user'
),
util
=
require
(
'../../utils/util'
),
returnCode
=
require
(
'../../utils/returnCode'
),
_
=
require
(
'lodash'
);
var
forumAboutMEService
=
require
(
'../../service/forumAboutMEService'
);
var
forumAboutMEService
=
require
(
'../../service/forumAboutMEService'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/v1/forum'
,
router
);
...
...
@@ -13,15 +15,17 @@ module.exports = function(app) {
router
.
get
(
'/aboutme/me2other'
,
function
(
req
,
res
,
next
)
{
var
userId
=
user
.
getMobileUser
(
req
);
var
entcode
=
req
.
session
.
user
.
ent_code
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
console
.
log
(
userId
);
console
.
log
(
entcode
);
forumAboutMEService
.
me2other
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
if
(
err
)
{
forumAboutMEService
.
me2other
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
}
else
{
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
result
.
items
,
function
(){
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
});
}
});
});
...
...
@@ -29,15 +33,17 @@ router.get('/aboutme/me2other', function(req, res, next) {
router
.
get
(
'/aboutme/other2me'
,
function
(
req
,
res
,
next
)
{
var
userId
=
user
.
getMobileUser
(
req
);
var
entcode
=
req
.
session
.
user
.
ent_code
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
console
.
log
(
userId
);
console
.
log
(
entcode
);
forumAboutMEService
.
other2me
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
if
(
err
)
{
forumAboutMEService
.
other2me
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
results
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
}
else
{
util
.
loadLevel
(
req
.
session
.
user
.
ent_code
,
results
.
items
,
function
(){
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
});
}
});
});
...
...
@@ -45,12 +51,12 @@ router.get('/aboutme/other2me', function(req, res, next) {
router
.
get
(
'/aboutme/he2other/:id/:entcode'
,
function
(
req
,
res
,
next
)
{
var
userId
=
req
.
params
.
id
;
var
entcode
=
req
.
params
.
entcode
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
forumAboutMEService
.
me2other
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
if
(
err
)
{
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
forumAboutMEService
.
me2other
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
}
else
{
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
}
});
...
...
@@ -59,13 +65,13 @@ router.get('/aboutme/he2other/:id/:entcode', function(req, res, next) {
router
.
get
(
'/aboutme/other2he/:id/:entcode'
,
function
(
req
,
res
,
next
)
{
var
userId
=
req
.
params
.
id
;
var
entcode
=
req
.
params
.
entcode
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
forumAboutMEService
.
other2me
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
if
(
err
)
{
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
forumAboutMEService
.
other2me
(
entcode
,
userId
,
pageNo
,
pageSize
,
function
(
err
,
result
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
}
else
{
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
}
});
});
\ No newline at end of file
});
app/controllers/mobile/forumInfo.js
View file @
183b5bab
This diff is collapsed.
Click to expand it.
app/controllers/mobile/forumThread.js
View file @
183b5bab
This diff is collapsed.
Click to expand it.
app/utils/util.js
0 → 100644
View file @
183b5bab
'use strict'
;
var
_
=
require
(
'lodash'
);
var
request
=
require
(
'request'
);
var
env
=
process
.
env
.
NODE_ENV
;
var
API_ADDRESS
=
'http://localhost:8080'
;
if
(
env
==
'sandbox'
)
{
API_ADDRESS
=
'http://rest.wxpai.cn'
;
}
else
if
(
env
==
'production'
)
{
API_ADDRESS
=
'https://rest.wxpai.cn'
;
}
exports
.
loadLevel
=
function
(
ent_code
,
items
,
callback
){
var
openIds
=
[];
_
.
forEach
(
items
,
function
(
d
,
i
)
{
if
(
d
.
from
&&
d
.
from
.
uid
){
openIds
.
push
(
d
.
from
.
uid
);
}
if
(
d
.
to
&&
d
.
to
.
uid
){
openIds
.
push
(
d
.
to
.
uid
);
}
if
(
d
.
commentLevel1From
&&
d
.
commentLevel1From
.
uid
){
openIds
.
push
(
d
.
commentLevel1From
.
uid
);
}
if
(
d
.
commentLevel2From
&&
d
.
commentLevel2From
.
uid
){
openIds
.
push
(
d
.
commentLevel2From
.
uid
);
}
if
(
d
.
commentLevel2ThreadFrom
&&
d
.
commentLevel2ThreadFrom
.
uid
){
openIds
.
push
(
d
.
commentLevel2ThreadFrom
.
uid
);
}
});
request
.
post
({
url
:
API_ADDRESS
+
'/v1.0/internal/member/list/byopenids'
,
json
:
{
"entCode"
:
ent_code
,
"openIds"
:
openIds
}
},
function
(
e
,
r
,
body
)
{
if
(
body
&&
body
.
data
)
{
//console.log(body.data);
_
.
forEach
(
items
,
function
(
d
,
i
)
{
if
(
items
[
i
].
toObject
)
{
items
[
i
]
=
items
[
i
].
toObject
();
}
_
.
forEach
(
body
.
data
,
function
(
r
,
j
)
{
if
(
d
.
from
&&
d
.
from
.
uid
===
r
.
user
.
openId
){
items
[
i
].
from
.
exp
=
r
.
exp
;
}
if
(
d
.
to
&&
d
.
to
.
uid
===
r
.
user
.
openId
){
items
[
i
].
to
.
exp
=
r
.
exp
;
}
if
(
d
.
commentLevel1From
&&
d
.
commentLevel1From
.
uid
===
r
.
user
.
openId
){
items
[
i
].
commentLevel1From
.
exp
=
r
.
exp
;
}
if
(
d
.
commentLevel2From
&&
d
.
commentLevel2From
.
uid
===
r
.
user
.
openId
){
items
[
i
].
commentLevel2From
.
exp
=
r
.
exp
;
}
if
(
d
.
commentLevel2ThreadFrom
&&
d
.
commentLevel2ThreadFrom
.
uid
===
r
.
user
.
openId
){
items
[
i
].
commentLevel2ThreadFrom
.
exp
=
r
.
exp
;
}
});
if
(
d
.
from
&&
!
items
[
i
].
from
.
exp
){
items
[
i
].
from
.
exp
=
0
;
}
if
(
d
.
to
&&
!
items
[
i
].
to
.
exp
){
items
[
i
].
to
.
exp
=
0
;
}
if
(
d
.
commentLevel1From
&&
!
items
[
i
].
commentLevel1From
.
exp
){
items
[
i
].
commentLevel1From
.
exp
=
0
;
}
if
(
d
.
commentLevel2From
&&
!
items
[
i
].
commentLevel2From
.
exp
){
items
[
i
].
commentLevel2From
.
exp
=
0
;
}
if
(
d
.
commentLevel2ThreadFrom
&&
!
items
[
i
].
commentLevel2ThreadFrom
.
exp
){
items
[
i
].
commentLevel2ThreadFrom
.
exp
=
0
;
}
});
}
return
callback
&&
callback
();
});
};
\ No newline at end of file
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