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
b15cbf4d
Commit
b15cbf4d
authored
Mar 22, 2016
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update h5
parent
ab917852
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
87 deletions
+91
-87
forumThread.js
app/controllers/admin/forumThread.js
+91
-0
forumThread.js
app/controllers/mobile/forumThread.js
+0
-87
No files found.
app/controllers/admin/forumThread.js
View file @
b15cbf4d
...
@@ -1698,3 +1698,94 @@ router.post('/thread/:tid/unEssence', function(req, res, next) {
...
@@ -1698,3 +1698,94 @@ router.post('/thread/:tid/unEssence', function(req, res, next) {
res
.
json
(
returnCode
.
WRONG_PARAM
);
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
});
});
//H5创建子话题文章
router
.
post
(
'/h5/thread/create'
,
function
(
req
,
res
,
next
)
{
var
pid
=
req
.
body
.
pid
;
var
title
=
req
.
body
.
title
;
var
content
=
req
.
body
.
content
;
var
images
=
req
.
body
.
images
;
var
ent_code
=
req
.
body
.
ent_code
;
var
nickName
=
req
.
body
.
nickName
;
var
uid
=
req
.
body
.
openId
;
var
mid
=
req
.
body
.
mid
;
var
icon
=
req
.
body
.
icon
;
var
thread_entity
=
{
pid
:
pid
,
title
:
title
,
content
:
content
,
ent_code
:
ent_code
,
images
:
images
,
type
:
1
,
level
:
2
}
if
(
pid
&&
title
&&
content
&&
ent_code
&&
uid
&&
mid
){
async
.
waterfall
([
function
(
callback
)
{
forumUserService
.
getUserByUid
(
uid
,
callback
);
},
function
(
user
,
callback
)
{
//创建用户
if
(
user
)
{
callback
(
null
,
user
);
}
else
{
var
entity
=
{
mid
:
mid
,
uid
:
uid
,
ent_code
:
ent_code
,
nickName
:
nickName
,
icon
:
icon
};
forumUserService
.
createUser
(
entity
,
function
(
err
,
doc
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
doc
);
}
});
}
},
function
(
user
,
callback
)
{
//获取板块信息
forumThreadService
.
getByConditionsSelectyField
({
_id
:
new
mongoose
.
Types
.
ObjectId
(
pid
),
ent_code
:
ent_code
},
"info"
,
function
(
err
,
doc
)
{
if
(
err
||
!
doc
)
{
console
.
error
(
err
);
callback
(
err
,
null
,
null
);
}
else
{
callback
(
err
,
user
,
doc
.
info
);
}
});
},
function
(
user
,
infoId
,
callback
)
{
//创建文章
thread_entity
.
from
=
user
.
_id
;
thread_entity
.
info
=
infoId
forumThreadService
.
createThread
(
thread_entity
,
function
(
err
,
entity
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'post'
);
forumAboutMEService
.
saveThread
(
entity
);
callback
(
null
,
entity
);
}
});
}
],
function
(
err
,
thread
)
{
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{
data
:
thread
}
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
\ No newline at end of file
app/controllers/mobile/forumThread.js
View file @
b15cbf4d
...
@@ -2208,90 +2208,3 @@ router.get('/thread/:tid/get/subThreads/:type', function(req, res, next) {
...
@@ -2208,90 +2208,3 @@ router.get('/thread/:tid/get/subThreads/:type', function(req, res, next) {
res
.
json
(
returnCode
.
WRONG_PARAM
);
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
});
});
//H5创建子话题文章
router
.
post
(
'/h5/thread/create'
,
function
(
req
,
res
,
next
)
{
var
pid
=
req
.
body
.
pid
;
var
title
=
req
.
body
.
title
;
var
content
=
req
.
body
.
content
;
var
images
=
req
.
body
.
images
;
var
ent_code
=
req
.
body
.
ent_code
;
var
nickName
=
req
.
body
.
nickName
;
var
uid
=
req
.
body
.
openId
;
var
mid
=
req
.
body
.
mid
;
var
thread_entity
=
{
pid
:
pid
,
title
:
title
,
content
:
content
,
ent_code
:
ent_code
,
images
:
images
,
type
:
1
,
level
:
2
}
if
(
pid
&&
title
&&
content
&&
ent_code
&&
uid
&&
mid
){
async
.
waterfall
([
function
(
callback
)
{
forumUserService
.
getUserByUid
(
uid
,
callback
);
},
function
(
user
,
callback
)
{
//创建用户
if
(
user
)
{
callback
(
null
,
user
);
}
else
{
var
entity
=
{
mid
:
mid
,
uid
:
uid
,
ent_code
:
ent_code
,
nickName
:
nickName
};
forumUserService
.
createUser
(
entity
,
function
(
err
,
doc
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
doc
);
}
});
}
},
function
(
user
,
callback
)
{
//获取板块信息
forumThreadService
.
getByConditionsSelectyField
({
_id
:
new
mongoose
.
Types
.
ObjectId
(
pid
),
ent_code
:
ent_code
},
"info"
,
function
(
err
,
doc
)
{
if
(
err
||
!
doc
)
{
console
.
error
(
err
);
callback
(
err
,
null
,
null
);
}
else
{
callback
(
err
,
user
,
doc
.
info
);
}
});
},
function
(
user
,
infoId
,
callback
)
{
//创建文章
thread_entity
.
from
=
user
.
_id
;
thread_entity
.
info
=
infoId
forumThreadService
.
createThread
(
thread_entity
,
function
(
err
,
entity
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'post'
);
forumAboutMEService
.
saveThread
(
entity
);
callback
(
null
,
entity
);
}
});
}
],
function
(
err
,
thread
)
{
if
(
err
){
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{
data
:
thread
}
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
\ 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