1 Star 0 Fork 3

xenon007 / light blog

forked from dalex / light blog 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

light blog

API文档

返回结果demo

{"code":910,"message":"登陆成功","count":1,"data":[{"id":1,"username":"lkk","role":"normal"}]}

http code:200http请求成功,404页面不存在,500系统错误,403无权限

登陆接口

http://your-url/api/signIn/$username/$password

登陆成功:code 910 && message 登陆成功 && data 当前用户登录数据

用户名或密码错误:code 810 && message 用户名或密码错误 && data

已经登陆:code 911 && message 已经登陆 && data 当前用户登录数据

注册接口

http://your-url/api/signUp/$username/$password/$blogType

blogType:1、文字博客 2、图片博客

注册成功:code 900 && message 操作成功 && data

注册失败:code 800 && message 操作失败 && data 原因:用户名长度超过12,或系统错误

注册失败:code 811 && message 用户名被占用 && data 原因:用户名被占用

获取用户身份接口

http://your-url/api/getCurrentUser

获取成功:code 900 && message 操作成功 && data user

获取失败:code 912 && message 尚未登陆 && data

创建新文章接口

http://your-url/api/createNewText

post={title:"", text_type: int, text:""}

text_type:0、默认 1、技术 2、安全 3、学科 4、新奇

提交成功:code 900 && message 操作成功 && data 文章信息

提交失败:code 800 && message 操作失败 && data 原因:参数不正确,其中title和text_type不能为空

提交失败:code 802 && message 请登陆· && data 空` 原因:用户没有登陆

登出接口

http://your-url/api/logout

登出成功:code 900 && message 操作成功 && data

获取文章列表接口

http://your-url/api/getTextList/[$page_num = 1]/[$text_type = -1]/[$author_id = -1]/[$author_name = ""]/[$title = ""]/[$text = ""]/[$create_date = ""]

条件组合搜索:title含有test字符串

http://your-url/api/getTextList/1/-1/-1/NULL/test/[NULL]/[NULL]

$create_date = 2015-06-12 //用于搜索相关年月日的文章

P.S:$author_name、$title、$text都是模糊搜索(LIKE)

查询成功:code 900 && message 操作成功 && data 文章信息 && total 用于判断是否需要分页

通过count判断data中是否有数据

data数组每一项:id,title,text_type(TestTypes),author_id,author_name(int),status,create_date,update_date

获取个人全部文章接口

http://your-url/api/getSelfTextList

查询成功:code 900 && message 操作成功 && data 文章信息

获取个人全部评论接口

http://your-url/api/getSelfCommentList

查询成功:code 900 && message 操作成功 && data 评论信息

删除某条评论(在文章中)接口

http://your-url/api/delTextComment

删除成功:code 900&& message操作成功&& datacomment (list)`

删除失败:code 800 && message 操作失败 && data

删除失败:code 825 && message 没有该条评论 && data 原因:参数不正确

删除评论(自己博客)接口

http://your-url/api/delSelfComment/$comment_id

操作成功:code 900 && message 操作成功 && data comment (list)

操作失败:code 800 && message 操作失败 && data

删除失败:code 825 && message 没有该条评论 && data 原因:参数不正确

通过文章ID获取文章具体和评论内容接口(无分页)

http://your-url/api/getTextAndCommentByTextId/$text_id/[keyword]

查询成功:code 900 && message 操作成功 && data 文章信息

id(int),text_type(TestTypes),title,author(Users),text,visible,status,comments(Comments array),create_date,update_date

其中:Comments id,from(Users),to(如果是评论文章的评论返回null,如果是回复返回User),comment(text)

查询失败:code 803 && message 无相关数据 && data

留言接口

http://your-url/api/postWords/$blog_id/$the_word

提交成功:code 900 && message 操作成功 && data 留言列表

提交失败:code 800 && message 操作失败 && data 原因:参数不正确

某博客留言列表接口

http://your-url/api/getWordsByBlogId/$blog_id/[$page_num = 1]

查询成功:code 900 && message 操作成功 && data 留言列表 && total 用于判断是否需要分页

获取自己博客所有留言接口

http://your-url/api/getSelfWordList

操作成功:code 900 && message 操作成功 && data word (list)

删除留言接口

http://your-url/api/delWordById/$word_id

操作成功:code 900 && message 操作成功 && data word (list)

操作失败:code 826 && message 没有该留言 && data

提交评论接口

http://your-url/api/postComment/$text_id/$toUser = -1/$the_comment

提交成功:code 900 && message 操作成功 && data comment (list)

提交失败:code 800 && message 操作失败 && data 原因:参数不正确

提交失败: code 821 && message 没有该文章 && data 原因:传入的text_id并不存在于数据库

修改博客类型接口

http://your-url/api/changeBlogType/$blog_type(int)

修改成功:code 900 && message 操作成功 && data user

修改失败:code 800 && message 操作失败 && data 原因:参数不正确

获取博客类型列表接口

http://your-url/api/getBlogTypeList

获取成功:code 900 && message 操作成功 && data BlogType(list)

获取文章类型列表接口

http://your-url/api/getTextTypeList

获取成功:code 900 && message 操作成功 && data TextType(list)

获取链接类型列表接口

http://your-url/api/getLinkTypeList

获取成功:code 900 && message 操作成功 && data LinkType(list)

删除文章接口(当前用户自己的文章)

http://your-url/api/delTextById/$text_id

操作成功:code 900 && message 操作成功 && data text (list)

无该文章:code 821 && message 没有该文章 && data 原因:传入的text_id并不存在于用户的文章库中

操作失败:修改失败:code 800 && message 操作失败 && data

修改文章接口(当前用户自己的文章)

http://your-url/api/updateText/$text_id

post={title:"", text_type: int, text:""} 参数不能缺少

操作成功:code 900 && message 操作成功 && data 文章信息

无该文章:code 821 && message 没有该文章 && data 原因:传入的text_id并不存在于用户的文章库中

修改失败:code 800 && message 操作失败 && data 原因:传入的post参数错误

添加链接接口

http://your-url/api/addNewLink

post={title:"", url:"", hint:"", type:int} 参数不能缺少

操作成功:code 900 && message 操作成功 && data link (list)

操作失败:code 800 && message 操作失败 && data 原因:传入的post参数错误

url格式错误:code 831 && message 超链接格式错误 $$ data

删除连接接口

http://your-url/api/delLink/$link_id

操作成功:code 900 && message 操作成功 && data link (list)

无该链接:code 823 && message 没有该链接 && data 原因:传入的link_id并不存在于用户的数据库中

修改链接接口

http://your-url/api/updateLink/$link_id

操作成功:code 900 && message 操作成功 && data link (list)

无该链接:code 823 && message 没有该链接 && data 原因:传入的link_id并不存在于用户的数据库中

操作失败:code 800 && message 操作失败 && data 原因:传入的post参数错误

url格式错误:code 831 && message 超链接格式错误 $$ data

添加用户接口

http://your-url/api/addUser/$username/$password/$role

操作成功:code 900 && message 操作成功 && data user (list)

操作失败:code 800 && message 操作失败 && data 原因:用户名被占用

操作是被:code 801 && message 非法输入 && data 原因:role_id不能是0

修改用户密码接口

http://your-url/api/updateUserPassword/$user_id/$password

操作成功:code 900 && message 操作成功 && data

操作失败:code 800 && message 操作失败 && data 原因:没有修改

操作失败:code 824 && message 无相关用户 && data

修改用户角色接口

http://your-url/api/updateUserRole/$user_id/$role

操作成功:code 900 && message 操作成功 && data user (list)

操作失败:code 800 && message 操作失败 && data 原因:没有修改

操作失败:code 824 && message 无相关用户 && data

操作失败:code 801 && message 非法输入 && data 原因:role_id不能是0

设置推荐文章接口(自己)

http://your-url/api/textRecommend/$text_id

操作成功:code 900 && message 操作成功 && data text (list)

操作失败:code 800 && message 操作失败 && data

操作失败:code 821 && message 无相关文章 && data

取消推荐文章接口(自己)

http://your-url/api/textUndoRecommend/$text_id

同上

设置置顶文章接口(管理员)

http://your-url/api/textSetTop/$text_id

同上

取消置顶文章接口(管理员)

http://your-url/api/textUndoTop/$text_id

同上

设置文章不可见接口(管理员)

http://your-url/api/textSetVisible/$text_id

同上

取消文章不可见接口(管理员)

http://your-url/api/textSetInvisible/$text_id

同上

设置评论可见接口

http://your-url/api/commentSetVisible/$comment_id

操作成功:code 900 && message 操作成功 && data comment (list)

操作失败:code 800 && message 操作失败 && data

操作失败:code 825 && message 没有该评论 && data

设置评论不可见接口

http://your-url/api/commentSetInvisible/$comment_id

同上

获取所有用户列表接口(for admin)

http://your-url/api/getUserList

操作成功:code 900 && message 操作成功 && data User (list)

获取博客链接列表接口

http://your-url/api/getLinkList/$blog_id

操作成功:code 900 && message 操作成功 && data Link (list)

获取自己博客所有连接接口

http://your-url/api/getSelfLinkList

操作成功:code 900 && message 操作成功 && data Link (list)

获取所有文章接口(管理员)

http://your-url/api/getAllText

操作成功:code 900 && message 操作成功 && data Text (list)

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2015 dalex Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

用Phalcon实现后端,用Angular实现前端,数据库使用Mysql,实现一个MVC分离的博客系统。 展开 收起
PHP
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/tnt-box/light-blog.git
git@gitee.com:tnt-box/light-blog.git
tnt-box
light-blog
light blog
master

搜索帮助