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
15a5fea5
Commit
15a5fea5
authored
Oct 12, 2015
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'newfunc_1009_memberlevel' into SANDBOX
parents
3aa004a1
5b2586cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
0 deletions
+82
-0
util.js
app/utils/util.js
+82
-0
No files found.
app/utils/util.js
0 → 100644
View file @
15a5fea5
'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
)
{
_
.
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
.
id
){
items
[
i
].
from
.
exp
=
r
.
exp
;
}
if
(
d
.
to
&&
d
.
to
.
uid
===
r
.
user
.
id
){
items
[
i
].
to
.
exp
=
r
.
exp
;
}
if
(
d
.
commentLevel1From
&&
d
.
commentLevel1From
.
uid
===
r
.
user
.
id
){
items
[
i
].
commentLevel1From
.
exp
=
r
.
exp
;
}
if
(
d
.
commentLevel2From
&&
d
.
commentLevel2From
.
uid
===
r
.
user
.
id
){
items
[
i
].
commentLevel2From
.
exp
=
r
.
exp
;
}
if
(
d
.
commentLevel2ThreadFrom
&&
d
.
commentLevel2ThreadFrom
.
uid
===
r
.
user
.
id
){
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