1 Star 0 Fork 3

Jerry / hackday

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

##打印机项目 git 代码地址:https://git.oschina.net/mrbian/hackday.git ##服务器和返回信息

url:123.206.80.54

port:3030

返回格式说明:

1.成功返回status:true,请求失败返回status:false,

错误信息在msg里面,如果status是false,请先查看msg并联系

{
  "status":"true",
  "msg":{}
}

----------------
{
  "status":"false",
  "msg":"wrong msg content"
}

特别的:如果LoginToken失效或者错误,返回msg特定为"LoginToken",代表需要LoginToken

LoginToken默认一小时失效,如果有有效连接则自动延续一小时

2.注意 url开头是 host:port/api/token/ 的都需要在header中加入

"LoginToken",LoginToken

注意是LoginToken而不是token,后台可以自动根据LoginToken获得用户id

3.下面的请求参数默认必需,默认post方法

4.注意 带有 <> 的路由路径表示那里即使是post方法也需要那种参数去填充!

##登录注册 ###登录 @method post url : host:port/api/login

param 手机号 mobile

param 密码 password

return

{
    "status":"true",
    "msg":
      {
        "userID": "INT",
        "LoginToken": "STRING",
        "token" : "STRING"
      }
}

###注册 @method post url : host:port/api/register

param 手机号 mobile

param 密码 password

param 用户昵称 userName

return

{
    "status":"true",
   " msg":
      {
        "userID": "INT",
        "LoginToken": "STRING",
        "token" : "STRING"
      }
}

###LoginToken失效后得到新的token @method post url : host:port/api/getToken

param token

return

{
    "status":"true",
   " msg":
      {
        "userID": "INT",
        "LoginToken": "STRING",
        "token" : "STRING"
      }
}

###方便测试的debugLogin @Method GET

url : host:port/api/debugLogin

return

这个路由可以获得用户id为1的token

##用户信息 ###获取用户信息 @method post url : host:port/api/token/userinfo

param 想要得到用户信息的用户id AuthorID

return

{
   "status":"true",
   "msg":
     {
         "user":{
             "id":1,
             "mobile":"18340861710",
             "avatar":"http://www.baidu.com",
             "sign":"hello world",
             "userName":"test",
             "token":"VPpBrnWtvWDbVMGXgCvYPBhnkWM=",
             "sex":2,
             "noticeEnable":0,
             "followingEnable":0,
             "followerEnable":0,
             "aboutNotice":0,
             "updateNotice":0
         },
         "follower":[{},{}] || ["false"],   //如果你要看的用户不让看就是["false"]
         "following":[{},{}] || ["false"],  //如果你要看的用户不让看就是["false"]
         "collectedStoriesCount": INT      //收藏的故事数目
     }
}

上传文件 @Method post

url host:port/api/token/upload

这个需要LoginToken

return

{
    "md5":"d41d8cd98f00b204e9800998ecf8427e",
    "location":"http://123.206.80.54:3030/upload/file/402731_head.jpg"
}
The MIT License (MIT) Copyright (c) 2016 卞留念 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

2016.4.8-2016.4.12 展开 收起
NodeJS
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
NodeJS
1
https://gitee.com/jerryhwq/hackday.git
git@gitee.com:jerryhwq/hackday.git
jerryhwq
hackday
hackday
master

搜索帮助