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
992c5cc4
Commit
992c5cc4
authored
Aug 27, 2015
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1111
parent
ac543813
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
commentTips.js
app/controllers/mobile/commentTips.js
+9
-7
commentTips.js
app/utils/commentTips.js
+8
-8
No files found.
app/controllers/mobile/commentTips.js
View file @
992c5cc4
'use strict'
;
var
express
=
require
(
'express'
),
router
=
express
.
Router
(),
user
=
require
(
'../../utils/user'
),
returnCode
=
require
(
'../../utils/returnCode'
),
commentTips
=
require
(
'../../utils/commentTips'
),
_
=
require
(
'lodash'
);
...
...
@@ -10,8 +11,9 @@ module.exports = function(app) {
};
router
.
get
(
'/commentTips'
,
function
(
req
,
res
,
next
)
{
var
openId
=
req
.
session
.
openUser
.
openId
;
commentTips
.
get
(
openId
,
function
(
err
,
result
){
var
userId
=
user
.
getMobileUser
(
req
);
console
.
log
(
userId
);
commentTips
.
get
(
userId
,
function
(
err
,
result
){
if
(
err
){
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
...
...
@@ -20,9 +22,9 @@ router.get('/commentTips', function(req, res, next) {
});
});
router
.
put
(
'/commentTips'
,
function
(
req
,
res
,
next
)
{
var
openId
=
req
.
session
.
openUser
.
openI
d
;
commentTips
.
incrTips
(
open
Id
,
function
(
err
,
result
){
router
.
put
(
'/commentTips
/:id
'
,
function
(
req
,
res
,
next
)
{
var
userId
=
req
.
params
.
i
d
;
commentTips
.
incrTips
(
user
Id
,
function
(
err
,
result
){
if
(
err
){
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
...
...
@@ -32,8 +34,8 @@ router.put('/commentTips', function(req, res, next) {
});
router
.
put
(
'/commentTips/del'
,
function
(
req
,
res
,
next
)
{
var
openId
=
req
.
session
.
openUser
.
openId
;
commentTips
.
clear
(
open
Id
,
function
(
err
,
result
){
var
userId
=
user
.
getMobileUser
(
req
)
;
commentTips
.
clear
(
user
Id
,
function
(
err
,
result
){
if
(
err
){
res
.
json
(
returnCode
.
UNCHECK_ERROR
(
err
));
}
else
{
...
...
app/utils/commentTips.js
View file @
992c5cc4
...
...
@@ -3,12 +3,12 @@
var
redis
=
global
.
redis
;
var
prefix
=
'comment-tips-'
;
function
getKey
(
open
Id
){
return
prefix
+
open
Id
;
function
getKey
(
user
Id
){
return
prefix
+
user
Id
;
}
exports
.
clear
=
function
(
open
Id
,
callback
){
var
key
=
getKey
(
open
Id
);
exports
.
clear
=
function
(
user
Id
,
callback
){
var
key
=
getKey
(
user
Id
);
if
(
!
redis
){
console
.
log
(
'redis error'
);
return
callback
&&
callback
(
'error'
);
...
...
@@ -18,8 +18,8 @@ exports.clear = function(openId,callback){
});
};
exports
.
incrTips
=
function
(
open
Id
,
callback
){
var
key
=
getKey
(
open
Id
);
exports
.
incrTips
=
function
(
user
Id
,
callback
){
var
key
=
getKey
(
user
Id
);
if
(
!
redis
){
console
.
log
(
'redis error'
);
return
callback
&&
callback
(
'error'
);
...
...
@@ -29,8 +29,8 @@ exports.incrTips=function(openId,callback){
});
};
exports
.
get
=
function
(
open
Id
,
callback
){
var
key
=
getKey
(
open
Id
);
exports
.
get
=
function
(
user
Id
,
callback
){
var
key
=
getKey
(
user
Id
);
if
(
!
redis
){
console
.
log
(
'redis error'
);
return
callback
&&
callback
(
'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