This repository has been archived on 2021-11-25. You can view files and clone it, but cannot push or open issues/pull-requests.
BookFloatingServer/通信准则(草稿).md

87 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# BookFloatingServer服务端通信准则草稿
## 版本v1.0 (20170308)
整个通信采用TCP-Socket连接地址gameharbor.cn 端口55555
后端数据库为MySQL使用用户名为testuser密码为pwdtest只拥有select和insert权限。
### 消息次序
> 客户端先发送JSON字符串服务器进行操作后返回JSON字符串.
> 客户端可随时断开连接,但此连接将不可恢复.
### JSON标准
#### 注册
字段 | 值
-----|----
type | register必须
email | 注册用户Email
nickname | 昵称
school | 学校
pwass | 登录密码(明文)
示例
```
{'type':'register','email':'test@163.com','nickname':'Kirito','school':'QUST','pwass':'dvaLovesU'}
```
**返回值**
字段 | 值
---|---
ret|操作返回值(一般为1时是正常的)
**示例**
```
{'ret':'1'}
```
#### 登录
字段 | 值
---|---
type | login必须
email | 注册时Email
pwass | 登录密码(明文)
**示例**
```
{'type':'login','email':'test@163.com','pwass':'dvaLovesU'}
```
**返回值**
字段|值
---|---
ret|操作返回值(0时为正常)
**示例**
```
{'ret':'0'}
```
#### 上传
字段|值
---|---
type| upload必须
bookname|书名
author|作者
context|内容简介
imageURL|图片地址
**示例**
```
{'type':'upload','bookname':'TAOCP-1','author':'Unknown','context':'This is a good book','imageURL':'pic/upl01.png'}
```
**返回值**
字段|值
---|---
ret|操作返回值(大部分情况下1代表正常)
**示例**
```
{'ret':'1'}
```