Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
4c16e7b5
Unverified
Commit
4c16e7b5
authored
Dec 07, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
⬆
升级 Latke
parent
9e68a261
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
45 deletions
+58
-45
src/main/java/org/b3log/solo/processor/api/B3ArticleReceiver.java
.../java/org/b3log/solo/processor/api/B3ArticleReceiver.java
+36
-26
src/main/java/org/b3log/solo/processor/api/B3CommentReceiver.java
.../java/org/b3log/solo/processor/api/B3CommentReceiver.java
+22
-19
No files found.
src/main/java/org/b3log/solo/processor/api/B3ArticleReceiver.java
View file @
4c16e7b5
...
@@ -78,6 +78,21 @@ public class B3ArticleReceiver {
...
@@ -78,6 +78,21 @@ public class B3ArticleReceiver {
/**
/**
* Adds an article with the specified request.
* Adds an article with the specified request.
* <p>
* <p>
* Request json:
* <pre>
* {
* "article": {
* "oId": "",
* "articleTitle": "",
* "articleContent": "",
* "articleTags": "tag1,tag2,tag3",
* "userB3Key": "",
* "articleEditorType": ""
* }
* }
* </pre>
* </p>
* <p>
* Renders the response with a json object, for example,
* Renders the response with a json object, for example,
* <pre>
* <pre>
* {
* {
...
@@ -89,23 +104,13 @@ public class B3ArticleReceiver {
...
@@ -89,23 +104,13 @@ public class B3ArticleReceiver {
* </p>
* </p>
*
*
* @param context the specified http request context
* @param context the specified http request context
* @param requestJSONObject the specified http servlet request, for example,
* "article": {
* "oId": "",
* "articleTitle": "",
* "articleContent": "",
* "articleTags": "tag1,tag2,tag3",
* "userB3Key": "",
* "articleEditorType": ""
* }
* @throws Exception exception
*/
*/
@RequestProcessing
(
value
=
"/apis/symphony/article"
,
method
=
HttpMethod
.
POST
)
@RequestProcessing
(
value
=
"/apis/symphony/article"
,
method
=
HttpMethod
.
POST
)
public
void
addArticle
(
final
RequestContext
context
,
final
JSONObject
requestJSONObject
)
public
void
addArticle
(
final
RequestContext
context
)
{
throws
Exception
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
final
JSONObject
ret
=
new
JSONObject
();
final
JSONObject
ret
=
new
JSONObject
();
final
JSONObject
requestJSONObject
=
context
.
requestJSON
();
try
{
try
{
final
JSONObject
article
=
requestJSONObject
.
optJSONObject
(
Article
.
ARTICLE
);
final
JSONObject
article
=
requestJSONObject
.
optJSONObject
(
Article
.
ARTICLE
);
...
@@ -151,17 +156,9 @@ public class B3ArticleReceiver {
...
@@ -151,17 +156,9 @@ public class B3ArticleReceiver {
/**
/**
* Updates an article with the specified request.
* Updates an article with the specified request.
* <p>
* <p>
* Re
nders the response with a json object, for example,
* Re
quest json:
* <pre>
* <pre>
* {
* {
* "sc": boolean,
* "msg": ""
* }
* </pre>
* </p>
*
* @param context the specified http request context
* @param requestJSONObject the specified http servlet request, for example,
* "article": {
* "article": {
* "oId": "", // Symphony Article#clientArticleId
* "oId": "", // Symphony Article#clientArticleId
* "articleTitle": "",
* "articleTitle": "",
...
@@ -170,15 +167,28 @@ public class B3ArticleReceiver {
...
@@ -170,15 +167,28 @@ public class B3ArticleReceiver {
* "userB3Key": "",
* "userB3Key": "",
* "articleEditorType": ""
* "articleEditorType": ""
* }
* }
* @throws Exception exception
* }
* </pre>
* </p>
* <p>
* Renders the response with a json object, for example,
* <pre>
* {
* "sc": boolean,
* "msg": ""
* }
* </pre>
* </p>
*
* @param context the specified http request context
*/
*/
@RequestProcessing
(
value
=
"/apis/symphony/article"
,
method
=
HttpMethod
.
PUT
)
@RequestProcessing
(
value
=
"/apis/symphony/article"
,
method
=
HttpMethod
.
PUT
)
public
void
updateArticle
(
final
RequestContext
context
,
final
JSONObject
requestJSONObject
)
public
void
updateArticle
(
final
RequestContext
context
)
{
throws
Exception
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
final
JSONObject
ret
=
new
JSONObject
();
final
JSONObject
ret
=
new
JSONObject
();
renderer
.
setJSONObject
(
ret
);
renderer
.
setJSONObject
(
ret
);
final
JSONObject
requestJSONObject
=
context
.
requestJSON
();
try
{
try
{
final
JSONObject
article
=
requestJSONObject
.
optJSONObject
(
Article
.
ARTICLE
);
final
JSONObject
article
=
requestJSONObject
.
optJSONObject
(
Article
.
ARTICLE
);
...
...
src/main/java/org/b3log/solo/processor/api/B3CommentReceiver.java
View file @
4c16e7b5
...
@@ -108,17 +108,9 @@ public class B3CommentReceiver {
...
@@ -108,17 +108,9 @@ public class B3CommentReceiver {
/**
/**
* Adds a comment with the specified request.
* Adds a comment with the specified request.
* <p>
* <p>
* Re
nders the response with a json object, for example,
* Re
quest json:
* <pre>
* <pre>
* {
* {
* "sc": true
* }
* </pre>
* </p>
*
* @param context the specified http request context
* @param requestJSONObject the specified http servlet request, for example,
* {
* "comment": {
* "comment": {
* "userB3Key": "",
* "userB3Key": "",
* "oId": "",
* "oId": "",
...
@@ -132,16 +124,27 @@ public class B3CommentReceiver {
...
@@ -132,16 +124,27 @@ public class B3CommentReceiver {
* "commentOriginalCommentId": "" // optional, if exists this key, the comment is an reply
* "commentOriginalCommentId": "" // optional, if exists this key, the comment is an reply
* }
* }
* }
* }
* @throws Exception exception
* </pre>
* </p>
* <p>
* Renders the response with a json object, for example,
* <pre>
* {
* "sc": true
* }
* </pre>
* </p>
*
* @param context the specified http request context
*/
*/
@RequestProcessing
(
value
=
"/apis/symphony/comment"
,
method
=
HttpMethod
.
PUT
)
@RequestProcessing
(
value
=
"/apis/symphony/comment"
,
method
=
HttpMethod
.
PUT
)
public
void
addComment
(
final
RequestContext
context
,
final
JSONObject
requestJSONObject
)
public
void
addComment
(
final
RequestContext
context
)
{
throws
Exception
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
final
JSONObject
ret
=
new
JSONObject
();
final
JSONObject
ret
=
new
JSONObject
();
renderer
.
setJSONObject
(
ret
);
renderer
.
setJSONObject
(
ret
);
final
JSONObject
requestJSONObject
=
context
.
requestJSON
();
final
Transaction
transaction
=
commentRepository
.
beginTransaction
();
final
Transaction
transaction
=
commentRepository
.
beginTransaction
();
try
{
try
{
final
JSONObject
symphonyCmt
=
requestJSONObject
.
optJSONObject
(
Comment
.
COMMENT
);
final
JSONObject
symphonyCmt
=
requestJSONObject
.
optJSONObject
(
Comment
.
COMMENT
);
...
...
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