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
e6ca87b5
Commit
e6ca87b5
authored
Apr 17, 2015
by
邓军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pv/uv log
parent
c8c21d23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
25 deletions
+69
-25
httpService.js
app/service/httpService.js
+69
-25
No files found.
app/service/httpService.js
View file @
e6ca87b5
...
...
@@ -3,29 +3,73 @@
// var REMOTE_URL='http://127.0.0.1:3011/admin/forum/http/receive';
var
ACTION_KEY
=
{
'post'
:
'FORUM_THREAD_POST'
,
'share'
:
'FORUM_THREAD_SHARE'
,
'share_timeline'
:
'FORUM_THREAD_SHARE_TIMELINE'
,
'comment'
:
'FORUM_THREAD_COMMENT'
,
'thread_praise'
:
'FORUM_THREAD_PRAISE'
,
'comment_praise'
:
'FORUM_COMMENT_PRAISE'
,
'reply'
:
'FORUM_COMMENT_REPLY'
,
'user_from_share'
:
'FORUM_USER_FROM_SHARE'
}
exports
.
sendRequest
=
function
(
ent_code
,
mid
,
action
,
messageid
,
integral
,
exp
){
var
obj
=
{
tag
:
'member'
,
key
:
'forum'
,
action
:
ACTION_KEY
[
action
],
mid
:
mid
,
entcode
:
ent_code
,
messageid
:
messageid
||
''
,
integral
:
integral
||
0
,
exp
:
exp
||
0
};
redis
.
lpush
(
'adapter-redis-to-ons'
,
JSON
.
stringify
(
obj
),
function
(
err
,
reply
){
if
(
err
)
{
console
.
error
(
err
);
}
});
'post'
:
'FORUM_THREAD_POST'
,
'share'
:
'FORUM_THREAD_SHARE'
,
'share_timeline'
:
'FORUM_THREAD_SHARE_TIMELINE'
,
'comment'
:
'FORUM_THREAD_COMMENT'
,
'thread_praise'
:
'FORUM_THREAD_PRAISE'
,
'comment_praise'
:
'FORUM_COMMENT_PRAISE'
,
'reply'
:
'FORUM_COMMENT_REPLY'
,
'user_from_share'
:
'FORUM_USER_FROM_SHARE'
};
var
mongoose
=
require
(
'mongoose'
);
var
moment
=
require
(
'moment'
);
var
ForumPVLog
=
mongoose
.
model
(
'ForumPVLog'
);
var
ForumUVLog
=
mongoose
.
model
(
'ForumUVLog'
);
exports
.
sendRequest
=
function
(
ent_code
,
mid
,
action
,
messageid
,
integral
,
exp
)
{
var
obj
=
{
tag
:
'member'
,
key
:
'forum'
,
action
:
ACTION_KEY
[
action
],
mid
:
mid
,
entcode
:
ent_code
,
messageid
:
messageid
||
''
,
integral
:
integral
||
0
,
exp
:
exp
||
0
};
redis
.
lpush
(
'adapter-redis-to-ons'
,
JSON
.
stringify
(
obj
),
function
(
err
,
reply
)
{
if
(
err
)
{
console
.
error
(
err
);
}
});
};
exports
.
createLog
=
function
(
log
)
{
if
(
log
)
{
var
forumPVLog
=
new
ForumPVLog
(
log
);
var
forumUVLog
=
new
ForumUVLog
(
log
);
forumPVLog
.
save
(
function
(
err
,
pv
)
{
if
(
err
)
{
console
.
error
(
err
);
}
else
{
var
nowTime
=
moment
(
new
Date
()).
format
(
'YYYY-MM-DD'
);
var
startTime
=
nowTime
+
" 00:00:00"
;
var
entTime
=
nowTime
+
" 23:59:59"
;
var
q
=
{
created
:
{
'$gte'
:
startTime
,
'$lte'
:
entTime
},
user
:
log
.
fid
};
ForumUVLog
.
find
(
q
,
function
(
err
,
uv
)
{
if
(
err
)
{
console
.
error
(
err
);
}
else
if
(
uv
.
length
==
0
)
{
console
.
log
(
ForumUVLog
);
forumUVLog
.
save
(
function
(
err
,
uv
){
if
(
err
){
console
.
error
(
err
);
}
});
}
});
}
});
}
else
{
console
.
error
(
'没有日志信息'
);
}
};
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