# go-doc **Repository Path**: eastc/go-doc ## Basic Information - **Project Name**: go-doc - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-03-19 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [TOC] ## 协议说明 ----------- ### 协议类型 HTTP ### 编码 UTF-8(注:GET请求时参数值需要URL编码) ### 响应格式 JSON data对应内容为响应主体数据 ### 日期格式 yyyy-MM-dd HH:mm:ss ### 响应码code说明 0为成功,其他失败 ## API ### 1.1 账户操作 #### 1.1.1 登录 **接口地址:http://192.168.10.116/go-user/account/login** 请求方式:POST | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | user_name | 用户名 | String | 是 | | password | 密码 | String | 是 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | id | 用户id | String | 是 | 请求示例: ```json { "password": "lijie", "user_name": "lijie" } ``` 应答示例: ```json { "code": "0", "data": { "id": "9" }, "message": "SUCCESS" } ``` #### 1.1.2 退出 **接口地址:http://192.168.10.116/go-user/account/logout** 请求方式:GET | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ```json ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` ### 1.2 个人中心 #### 1.2.1 获取基本信息 **接口地址:http://192.168.10.116/go-user/user/getBaseInfo** 请求方式:不限 | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | user_id | 查询的用户id | String | 否 | 优先使用,和user_name二选一 | user_name | 查询的用户名 | String | 否 | 和user_id二选一 > 如果user_id和user_name都不存在,则返回当前用户的信息 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | user_id | 用户id | String | 是 | | user_name | 用户名 | String | 是 | | type | 类型 | String | 是 | 0-学员 1-老师 2-总教练 | gender| 性别 | String | 是 | 1-男,2-女 | avatar | 头像 | String | 是 | | avatar_frame | 头像框 | String | 否 | | dan_grading | 段位/棋力 | String | 是 | | school_name | 棋校 | String | 是 | | honour | 称号 | String | 是 | | end_time | 会员到期时间 | String | 是 | | remainder_currency | 现有棋币 | String | 是 | | historical_currency | 棋币记录 | String | 是 | | total_rank | 总榜-排名 | String | 是 | | play_chess_rank | 对弈榜-排名 | String | 是 | | practice_rank | 练习榜-排名 | String | 是 | | school_rank | 棋校排行 | String | 是 | | week_play_chess_rank | 对弈周榜-排名 | String | 是 | | week_practice_rank | 对弈练习榜-排名 | String | 是 | | play_chess_notify| 对局提醒 | int | 是 | 0-不提醒 1-提醒 | friend_online_notify| 上线提醒 | int | 是 | 0-不提醒 1-提醒 | play_chess_invitation| 邀请提醒 | int | 是 | 0-禁止邀请 1-允许邀请 请求地址示例: ``` { "user_id": "9" } ``` 应答示例: ```json { "code": "0", "data": { "honour": "http://goxh.oss-cn-shenzhen.aliyuncs.com/app-user/avatar/9/java.jpg?Expires=1526485227&OSSAccessKeyId=LTAIDHKubPVFAsTB&Signature=E5ZpSSlcROQq/CfAvaVucw7JdWg=", "historical_currency": "0", "user_name": "lijie", "end_time": "2018-02-11 11:00:01", "remainder_currency": "0", "school_name": "昆明a", "avatar": "http://goxh.oss-cn-shenzhen.aliyuncs.com/app-user/avatar/9/java.jpg?Expires=1526485227&OSSAccessKeyId=LTAIDHKubPVFAsTB&Signature=E5ZpSSlcROQq/CfAvaVucw7JdWg=", "type": "0", "friend_online_notify": "1", "avatar_frame": "http://goxh.oss-cn-shenzhen.aliyuncs.com/app-user/avatar/9/java.jpg?Expires=1526485227&OSSAccessKeyId=LTAIDHKubPVFAsTB&Signature=E5ZpSSlcROQq/CfAvaVucw7JdWg=", "play_chess_notify": "1", "play_chess_invitation": "1", "total_rank": "4", "week_practice_rank": "4", "user_id": "9", "school_rank": "4", "dan_grading": "6", "play_chess_rank": "4", "week_play_chess_rank": "4", "practice_rank": "4" }, "message": "SUCCESS" } ``` #### 1.2.2 查看个人档案 **接口地址:http://192.168.10.116/go-user/user/getArchiveInfo** 请求方式:GET | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | user_id | 查询的用户id | String | 否 | 优先使用,和user_name二选一 | user_name | 查询的用户名 | String | 否 | 和user_id二选一 > 如果user_id和user_name都不存在,则返回当前用户的信息 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | user_name | 用户名 | String | 是 | | certificate_number | 证书编号 | String | 是 | | dan_grading | 棋力 | int | | | type | 身份 | int | | 0-学员 1-老师 2-总教练 | address | 地址 | String | | | phone | 电话 | String | | | qq | qq号 | String | | | wechat | 微信号 | String | | | unit | 学校 | String | | | school_name | 棋校 | String | | TODO | school_code | 棋校代号 | String | | TODO | chief_coach_name | 棋校校长 | String | | | teacher_name | 授课老师 | String | | 请求地址示例: ``` ``` 应答示例: ```json ``` #### 1.2.3 编辑个人档案(待定) **接口地址:http://192.168.10.116/go-user/user/editProfile** 请求方式:POST | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | qq | qq | String | 否 | | password | 密码 | String | 否 | | phone | 手机 | String | 否 | | wechat | 微信号 | String | 否 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ```json { "qq": "12345678", "password": "lijie", "phone": "17682327158", "wechat": "helloworld" } ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` #### 1.2.4 获取设置 **接口地址:http://192.168.10.116/go-user/user/getSetting** 请求方式:不限 | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | play_chess_notify| 对局提醒 | int | 是 | 0-不提醒 1-提醒 | friend_online_notify| 上线提醒 | int | 是 | 0-不提醒 1-提醒 | play_chess_invitation| 邀请提醒 | int | 是 | 0-禁止邀请 1-允许邀请 请求示例: ``` http://192.168.10.116/go-user/user/getSetting ``` 应答示例: ```json { "code": "0", "data": { "play_chess_notify": "1", "play_chess_invitation": "1", "user_id": "11", "friend_online_notify": "0" }, "message": "SUCCESS" } ``` #### 1.2.5 修改设置 **接口地址:http://192.168.10.116/go-user/user/updateSetting** 请求方式:post | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | play_chess_notify| 对局提醒 | int | 是 | 0-不提醒 1-提醒 | friend_online_notify| 上线提醒 | int | 是 | 0-不提醒 1-提醒 | play_chess_invitation| 邀请提醒 | int | 是 | 0-禁止邀请 1-允许邀请 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ``` { "play_chess_notify": "1", "play_chess_invitation": "1", "friend_online_notify": "1" } ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` #### 1.2.6 修改位置 **接口地址:http://192.168.10.116/go-user/user/updateLocation** 请求方式:post | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | location| 位置 | int | 是 | 0-其他位置,1-吃子大厅,2-中级大厅,3-高级大厅,4-比赛大厅,5-吃子对弈,6-中级对弈,7高级对弈,8比赛对弈 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ``` { "location": "1" } ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` ### 1.3 上传文件(OSS) #### 1.3.0 上传头像 **接口地址:http://192.168.10.116/go-user/user/uploadAvatar** 请求方式:POST 上传示例: ```html
``` #### 1.3.1 web端上传-获取签名 请阅读:https://help.aliyun.com/document_detail/31926.html?spm=5176.doc31925.6.632.5EWr9n **接口地址:http://192.168.10.116/go-user/oss/getWebSign/{type}** 请求方式:GET | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | type | 类型 | String | 是 | avatar-上传头像 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | accessid | accessid | String | 是 | | policy | 用户表单上传的策略policy | String | 是 | | dir | 上传目录 | String | 是 | | host | 上传地址 | String | 是 | | expire | 当前上传策略失效时间 | String | 是 | *单位:秒*。不发送到OSS。在这个失效时间之前,都可以利用这个policy上传文件,所以没有必要每次上传,都去后端取签名。 | callback | 回调 | String | 是 | 请求示例: ``` http://192.168.10.116/go-user/oss/getWebSign/avatar ``` 应答示例: ```json { "code": "0", "data": { "accessid": "LTAIDHKubPVFAsTB", "policy": "eyJleHBpcmF0aW9uIjoiMjAxNy0xMS0xNVQwMjoxODo0Ny4zMjZaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3NjAwMF0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJhcHAtdXNlci9hdmF0YXIvMTEiXV19", "signature": "PsEWQTpHY4us3Y/5yPKLxgCEgUM=", "dir": "app-user/avatar/11", "host": "http://goxh.oss-cn-shenzhen.aliyuncs.com", "callback": "eyJjYWxsYmFja1VybCI6Imh0dHA6Ly8zOS4xMDguMTczLjE5ODo4MDgxL2dvLXVzZXIvb3NzL2NhbGxiYWNrIiwiY2FsbGJhY2tCb2R5IjoiZmlsZW5hbWU9JHtvYmplY3R9JnR5cGU9YXZhdGFyJnVzZXJJZD0xMSZzaWduPTYwODE4QzNENDYxQzU1RUZBNjBFN0VCODg4NzZFNTEwIiwiY2FsbGJhY2tCb2R5VHlwZSI6ImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCJ9", "expire": "1510712327" }, "message": "SUCCESS" } ``` 上传示例: ```html OSS表单上传(PostObject)
``` > 请替换#{} #### 1.3.2 获取oss文件访问地址 **接口地址:http://192.168.10.116/go-user/oss/getUrl** 请求方式:POST | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | key | 服务端返回的文件路径 | String | 是 | 如获取用户基本信息返回的头像avatar字段 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | url | 访问地址 | String | 是 | 有效期24小时。可通过解析Expires参数(单位:秒)判断url地址是否已过期。 请求示例: ```json { "key": "app-user/avatar/11/u=1841068248,308987211&fm=23&gp=0.jpg" } ``` 应答示例: ```json { "code": "0", "data": { "url": "http://goxh.oss-cn-shenzhen.aliyuncs.com/app-user/avatar/11/u%3D1841068248%2C308987211%26fm%3D23%26gp%3D0.jpg?Expires=1510822240&OSSAccessKeyId=LTAIDHKubPVFAsTB&Signature=NGo58f0YLbBPjGgN6w75t2JOAQA%3D" }, "message": "SUCCESS" } ``` ### 1.4 支付 #### 1.4.1 续费 > 1个月45元,3个月120元,6个月200元,一年360元 **接口地址:http://192.168.10.116/go-user/pay/renewal** 请求方式:POST | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | amount | 待支付的金额 | String | 是 | 单位:分 | pay_type | 支付方式 | String | 是 | 1-支付宝 6-微信 | months | 续期的月数 | String | 是 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | out_trade_no | 订单号 | String | 是 | | qrcode | 二维码地址 | String | 是 支付宝支付-请求示例: ```json { pay_type: "1", months: "1", amount: "4500" } ``` 应答示例: ```json { "qrcode": "https://qr.alipay.com/bax09768de26yfdl6lwn20d4", "out_trade_no": "201801250932110000097207" } ``` 微信支付-请求示例: ```json { pay_type: "6", months: "1", amount: "4500" } ``` 应答示例: ```json { "out_trade_no": "201801250948100000094858", "qrcode": "weixin://wxpay/bizpayurl?pr=LaZNQHS", "prepayid": "wx20180125094825a08e740fd30407299646" } ``` #### 1.4.2 充值棋币 > 1元=100棋币,可以任选充值金额。(必须是一元的整数倍) **接口地址:http://192.168.10.116/go-user/pay/recharge** 请求方式:POST | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | amount | 待支付的金额 | String | 是 | 单位:分 | pay_type | 支付方式 | String | 是 | 1-支付宝 6-微信 | currency | 棋币数 | String | 是 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | out_trade_no | 订单号 | String | 是 | | qrcode | 二维码地址 | String | 是 请求示例: ```json { pay_type: "1", currency: "100", amount: "100" } ``` 应答示例: ```json { "qrcode": "https://qr.alipay.com/bax09768de26yfdl6lwn20d4", "out_trade_no": "201801250932110000097207" } ``` #### 1.4.3 查询支付宝、微信支付结果(http) **接口地址:http://192.168.10.116/go-user/pay/queryOrder/{out_trade_no}** 请求方式:GET | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | out_trade_no | 订单编号 | String | 是 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | out_trade_no | 订单编号 | String | 是 | trade_no | 微信/支付宝系统生成的交易单号 | String | 是 | receipt_amount | 实付金额 | String | 是 | 整数型字符串 单位:分,取值范围[1,10000000000] total_amount | 订单总金额 | String | 是 | 整数型字符串 单位:分,取值范围[1,10000000000] pay_time | 付款时间 | String | 是 | 格式:20161102173255 pay_type | 支付方式 | int | 是 | 1:支付宝手机扫码支付 6:微信扫码支付 pay_channel | 付款渠道 | String | 是 | 请求示例: ``` http://192.168.10.116/go-user/pay/queryOrder/201801251541560000093752 ``` 应答示例: ```json { "code": "0", "data": { "gmt_create": "2018-01-25 15:41:57", "goods_name": "支付测试", "gmt_modified": "2018-01-25 15:44:05", "business_data": "{\"months\":1}", "pay_time": "2018-01-25 15:44:05", "out_trade_no": "201801251541560000093752", "payer_no": "898***@qq.com", "total_amount": "1", "business_type": "1", "handled": "1", "creater": "9", "pay_channel": "PCREDIT", "trade_no": "2018012521001004030596910457", "pay_type": "1", "payer_id": "2088502888271030", "receipt_amount": "1", "id": "6", "state": "1" }, "message": "SUCCESS" } ``` 异常响应示例: ``` { "code": "715", "message": "等待买家付款" } ``` #### 1.4.4 推送支付宝、微信支付结果(WebSocket) > 如果浏览器不支持WebSocket,清使用对应的http协议接口轮询 **接口地址:ws://192.168.10.116/go-user/ws/queryOrder?out_trade_no={out_trade_no}** | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | out_trade_no | 订单编号 | String | 是 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | out_trade_no | 订单编号 | String | 是 | trade_no | 微信/支付宝系统生成的交易单号 | String | 是 | receipt_amount | 实付金额 | String | 是 | 整数型字符串 单位:分,取值范围[1,10000000000] total_amount | 订单总金额 | String | 是 | 整数型字符串 单位:分,取值范围[1,10000000000] pay_time | 付款时间 | String | 是 | 格式:2018-01-25 15:44:05 pay_type | 支付方式 | int | 是 | 1:支付宝手机扫码支付 6:微信扫码支付 请求地址示例: ``` ws://192.168.10.116/go-user/ws/queryOrder?out_trade_no=201801251541560000093752 ``` 支付成功时服务器推送示例: ```json { "code": "0", "data": { "gmt_create": "2018-01-25 15:41:57", "goods_name": "支付测试", "gmt_modified": "2018-01-25 15:44:05", "business_data": "{\"months\":1}", "pay_time": "2018-01-25 15:44:05", "out_trade_no": "201801251541560000093752", "payer_no": "898***@qq.com", "total_amount": "1", "business_type": "1", "handled": "1", "creater": "9", "pay_channel": "PCREDIT", "trade_no": "2018012521001004030596910457", "pay_type": "1", "payer_id": "2088502888271030", "receipt_amount": "1", "id": "6", "state": "1" }, "message": "SUCCESS" } ``` 服务端发送命令 | 描述 | ---|---| OK | 连接成功 | ### 1.5 物品 #### 1.5.1 物品查询 **接口地址:http://192.168.10.116/go-user/goods/list** 请求方式:POST | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | good_category_id | 物品分类 | String | 是 | 1-头像 2-头像框 3-称号 | level | 等级 | String | 否 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | id | 物品id | String | 是 | good_category_id | 物品分类 | String | 是 | 1-头像 2-头像框 3-称号 | level | 等级 | String | 是 | name | 物品名称 | String | 是 | currency | 物品价格(棋币) | String | 是 | image_url | 物品图片地址 | String | 是 | gmt_create | 创建时间 | String | 是 | user_id | 创建时间 | String | 否 | 如果当前用户已经购买,则此项显示当前用户id,否则不显示 | gender| 性别 | String | 否 | 1-男,2-女 如果头像,则显示头像的性别 请求示例: ```json { "good_category_id": "1" } ``` 应答示例: ```json { "code": "0", "data": [{ "gmt_create": "2018-01-22 21:36:38", "level": "1", "user_id": "11", "image_url": "http://goxh.oss-cn-shenzhen.aliyuncs.com/app-user/avatar/11/u=1841068248,308987211&fm=23&gp=0.jpg?Expires=1516962954&OSSAccessKeyId=LTAIDHKubPVFAsTB&Signature=ErZLCnKWJ8D7Ur+iinbmVuqaj0U=", "name": "一级头像", "currency": "100", "good_category_id": "1", "id": "1" }, { "gmt_create": "2018-01-22 21:37:07", "level": "2", "image_url": "http://goxh.oss-cn-shenzhen.aliyuncs.com/app-user/avatar/11/u=1841068248,308987211&fm=23&gp=0.jpg?Expires=1516962954&OSSAccessKeyId=LTAIDHKubPVFAsTB&Signature=ErZLCnKWJ8D7Ur+iinbmVuqaj0U=", "name": "二级头像", "currency": "200", "good_category_id": "1", "id": "2" }, { "gmt_create": "2018-01-22 21:39:41", "level": "3", "image_url": "http://goxh.oss-cn-shenzhen.aliyuncs.com/app-user/avatar/11/u=1841068248,308987211&fm=23&gp=0.jpg?Expires=1516962954&OSSAccessKeyId=LTAIDHKubPVFAsTB&Signature=ErZLCnKWJ8D7Ur+iinbmVuqaj0U=", "name": "三级头像", "currency": "300", "good_category_id": "1", "id": "3" }], "message": "SUCCESS" } ``` #### 1.5.2 购买:头像框、称号、头像 **接口地址:http://192.168.10.116/go-user/goods/buy** 请求方式:POST | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | good_id | 物品id | String | 是 | | currency | 棋币数 | String | 是 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | remainder_currency | 剩余棋币数 | String | 是 | 请求示例: ```json { good_id: "1", currency: "100" } ``` 应答示例: ```json { "code": "0", "data": { "remainder_currency": 4900 }, "message": "SUCCESS" } ``` 异常响应示例: ``` { "code": "714", "message": "余额不足" } ``` #### 1.5.3 设置用户个人中心显示的默认物品 **接口地址:http://192.168.10.116/go-user/user/setDefaultGoods/{good_id}** 请求方式:get | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | good_id | 物品id | String | 是 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ``` http://192.168.10.116/go-user/user/setDefaultGoods/1 ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` #### 1.5.4 显示用户自己上传的头像 **接口地址:http://192.168.10.116/go-user/user/showUploadAvatar** 请求方式:get | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | upload_avatar | 用户上传的头像地址 | String | 是 | 请求示例: ``` http://192.168.10.116/go-user/user/showUploadAvata ``` 应答示例: ```json { "code": "0", "data": { "upload_avatar": "http://goxh.oss-cn-shenzhen.aliyuncs.com/app-user/avatar/11/u=1841068248,308987211&fm=23&gp=0.jpg?Expires=1517059951&OSSAccessKeyId=LTAIDHKubPVFAsTB&Signature=zqx8V8HCUEbJJfwKOvipoNUwfms=" }, "message": "SUCCESS" } ``` 异常应答示例: ```json { "code": "549", "message": "文件未上传" } ``` #### 1.5.5 使用上传的头像 **接口地址:http://192.168.10.116/go-user/user/useUploadAvatar** 请求方式:get | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ``` http://192.168.10.116/go-user/user/useUploadAvatar ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` ### 1.6 我的好友 #### 1.6.1 显示好友/黑名单列表 **接口地址:http://192.168.10.116/go-user/friend/listPage** 请求方式:post | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | page_size | 页面大小 | int | 否 | 默认5 | | current_page | 当前页 | int | 否 | 从1开始,默认1 | | type | 朋友类型 | int | 是 | 1-好友 0-黑名单 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | page_size | 页面大小 | int | 是 | | current_page | 当前页 | int | 是 | | total_row | 总记录数 | int | 是 | | total_page | 总页码 | int | 是 | | records | 列表记录 | json数组 | 是 | *包含以下字段* | **参数** | **名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|--------------| | seq_no | 序号 | int | 是 | | friend_id | 朋友id | int | 是 | 即用户id | user_name | 名称 | String | 是 | | dan_grading | 段位 | int | 是 | | status | 状态 | int | 是 | 0-离线 1-在线 | location | 位置 | String | 否 | 好友在线时,查找位置,可直接取本字段 请求示例: ``` { "type": "1", "current_page": "1", "page_size": "5" } ``` 应答示例: ```json { "code": "0", "data": { "total_row": 1, "records": [{ "seq_no": 1, "friend_id": 10, "user_name": "lijie123", "dan_grading": 6, "status": 0 }], "total_page": 1, "current_page": 1, "page_size": 5 }, "message": "SUCCESS" } ``` #### 1.6.2 删除朋友 **接口地址:http://192.168.10.116/go-user/friend/delete/{friend_id}** 请求方式:get | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | friend_id| 朋友id | int | 是 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ``` http://192.168.10.116/go-user/friend/delete/1 ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` #### 1.6.3 添加朋友(好友/黑名单) **接口地址:http://192.168.10.116/go-user/friend/add** 请求方式:post | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | friend_id| 朋友id | int | 是 | 即朋友的user_id | type| 朋友类型 | int | 是 | 0-黑名单 1-好友 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ``` { "friend_id": "9", "type": "0" } ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` ### 1.7 我的邮件 #### 1.7.1 发送邮件 **接口地址:http://192.168.10.116/go-user/email/send** 请求方式:post | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | to_member_name| 收件人 | String | 是 | | email_title| 标题 | Stirng | 是 | | content| 内容 | Stirng | 是 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ``` { "to_member_name": "lijie123", "content": "老铁,一块开黑", "email_title": "开黑了" } ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` #### 1.7.2 邮件列表 **接口地址:http://192.168.10.116/go-user/email/listPage** 请求方式:post | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | page_size | 页面大小 | int | 否 | 默认5 | | current_page | 当前页 | int | 否 | 从1开始,默认1 | | type | 邮件类型 | int | 是 | 1-收件箱 2-发件箱 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | page_size | 页面大小 | int | 是 | | current_page | 当前页 | int | 是 | | total_row | 总记录数 | int | 是 | | total_page | 总页码 | int | 是 | | records | 列表记录 | json数组 | 是 | *包含以下字段* | **参数** | **名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|--------------| | id | 邮件ID | int | 是 | | from_member_name | 发件人名称 | String | 是 | | to_member_name | 收件人名称 | String | 是 | | email_title | 邮件标题 | String | 是 | | gmt_create | 发送/接收时间 | String | 是 | | state | 邮件是否已读 | String | 否 | 收件箱时返回,0-未读 1-已读 请求示例: ``` { "to_member_name": "lijie123", "content": "老铁,一块开黑", "email_title": "开黑了" } ``` 应答示例: ```json { "code": "0", "data": { "total_row": 2, "records": [{ "gmt_create": "2018-01-28 22:35:38", "from_member_name": "lijie1", "id": "3", "to_member_name": "lijie", "email_title": "哈喽" }, { "gmt_create": "2018-01-28 22:31:24", "from_member_name": "lijie1", "id": "1", "to_member_name": "lijie123", "email_title": "开黑了" }], "total_page": 1, "current_page": 1, "page_size": 5 }, "message": "SUCCESS" } ``` #### 1.7.3 查看邮件详情 **接口地址:http://192.168.10.116/go-user/email/getDetails/{email_id}** 请求方式:post | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | email_id | 邮件ID | int | 是 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | from_member_name | 发件人名称 | String | 是 | | to_member_name | 收件人名称 | String | 是 | | email_title | 邮件标题 | String | 是 | | content | 邮件内容 | String | 是 | | gmt_create | 发送/接收时间 | String | 是 | | type | 邮件类型 | String | 是 | 1-收件 2-发件 | state | 邮件是否已读 | String | 否 | 收件箱时返回,0-未读 1-已读 请求示例: ``` http://192.168.10.116/go-user/email/getDetails/1 ``` 应答示例: ```json { "code": "0", "data": { "gmt_create": "2018-01-28 22:31:24", "from_member_id": "11", "to_member_id": "10", "ip": "127.0.0.1", "from_member_name": "lijie1", "id": "1", "to_member_name": "lijie123", "type": "2", "content": "老铁,一块开黑", "email_title": "开黑了" }, "message": "SUCCESS" } ``` #### 1.7.4 删除邮件 **接口地址:http://192.168.10.116/go-user/email/delete/{email_id}** 请求方式:get | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | email_id | 邮件ID | int | 是 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| 请求示例: ``` http://192.168.10.116/go-user/email/delete/1 ``` 应答示例: ```json { "code": "0", "message": "SUCCESS" } ``` ### 1.8 其他接口 #### 1.8.1 获取公共资源(大厅公告、背景音乐等) **接口地址:http://192.168.10.116/go-user/other/getConfig/{config_id}** 请求方式:get | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | config_id | 配置id | int | 是 | 2-大厅音乐 3-藏宝阁音乐 4-大厅公告 5-藏宝阁榜单说明 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | value | 目标资源 | String | 是 | 请求示例: ``` http://192.168.10.116/go-user/other/getConfig/2 ``` 应答示例: ```json { "code": "0", "data": { "value": "http://goxh.oss-cn-shenzhen.aliyuncs.com/app/bgm/%E9%99%88%E5%A5%95%E8%BF%85%20-%20%E4%B8%8D%E8%A6%81%E8%AF%B4%E8%AF%9D.mp3?Expires=1517467790&OSSAccessKeyId=LTAIDHKubPVFAsTB&Signature=%2FBLC9Km2BrdG6Vald8xTGb%2FQqz0%3D" }, "message": "SUCCESS" } ``` ### 1.9 题库接口 PS:用户做对36题或36题以上为考试合格,做对题目小于36题则为不合格,用户考试时间为60分钟 #### 1.9.1 判断是否正在考试 **接口地址:http://192.168.10.116/go-user/exam/isExamining** 请求方式:get 使用场景:首次进入考试入口调用。 接口说明:主要是为了解决考试中途异常退出造成的考试中断。 | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | tournamentId | 赛事id | int | 是 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | examining | 是否正在考试 | boolean | 是 | true-正在考试 1-没有正在参加的考试 | currentExam | 当前考试信息 | json | 否 | examining=true时返回,主要包括以下字段 | totalNum| 已完成的试题个数 | int | 是 | | correctNum| 正确的个数 | int | 是 | | recordId| 本次考试记录id | int | 是 | | startTime| 考试的开始时间 | long | 是 | 单位:毫秒 | systemTime| 当前的系统时间 | long | 是 | 单位:毫秒 请求示例: ``` ``` 应答示例: ```json { "code": "0", "data": { "currentExam": { "correctNum": 0, "recordId": 14, "startTime": 1551167516000, "systemTime": 1551167520187, "totalNum": 0 }, "examining": true }, "message": "SUCCESS" } ``` #### 1.9.2 开始考试-获取考题 **接口地址:http://192.168.10.116/go-user/exam/getToExamineQuestionInfo** 请求方式:get | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | tournamentId | 赛事id | int | 是 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | tournamentId| 赛事id | int | 是 | | startTime| 考试的开始时间 | long | 是 | 倒计时使用,单位:毫秒 | systemTime| 当前的系统时间 | long | 是 | 倒计时使用,单位:毫秒 | timeLength| 考试时长 | int | 是 | 倒计时使用,单位:秒钟 | question | 试题内容 | json | 是 |包括下面字段 | questonId | 题目id | int | 是 | | knowledgeName | 知识点名称 | string | 是 | | chessBoard | 棋盘 | json | 否 | 围棋选择题、图形选择题和围棋题必传,包含blackChessList(黑棋)和whiteChessList(白棋)两个字段 | title | 题目 | string | 是 | | type| 问题类型 | int | 是 | 1.文字选择题 2.围棋选择题 3.围棋题 4.图形选择题 | options | 选项 | json array | 否 | 字段包含以下字段(围棋题不返回) | sort | 选项顺序 | int | 是 | 1-A 2-B 3-C 4-D | optionContent | 选项内容 | string or 数组 | 是 | 文字选择题和图形选择题时为string类型,围棋选择题时为一维数组,围棋题时不返回 | optionId | 选项id | int | 是 | 请求示例: ``` ``` 应答示例: type=1 ```json { "code": "0", "data": { "question": { "knowledgeId": 4, "knowledgeName": "围棋常识", "options": [{ "optionContent": "中国", "optionId": 445, "sort": 1 }, { "optionContent": "美国", "optionId": 446, "sort": 2 }, { "optionContent": "日本", "optionId": 447, "sort": 3 }, { "optionContent": "韩国", "optionId": 448, "sort": 4 }], "questionId": 108, "title": "围棋是哪个国家发明的", "type": 1 }, "startTime": 1553930068000, "systemTime": 1553932327804, "timeLength": 3600, "tournamentId": 62 }, "message": "SUCCESS" } ``` type=2 ```json { "code": "0", "data": { "question": { "chessBoard": { "blackChessList": [ [8, 3], [6, 3], [7, 4], [7, 5], [10, 12] ], "whiteChessList": [ [6, 6] ] }, "knowledgeId": 6, "knowledgeName": "围棋常识", "options": [{ "optionContent": [1, 6], "optionId": 72, "sort": 1 }, { "optionContent": [4, 4], "optionId": 73, "sort": 2 }, { "optionContent": [11, 6], "optionId": 74, "sort": 3 }, { "optionContent": [1, 1], "optionId": 75, "sort": 4 }], "questionId": 4, "title": "以下棋盘,黑棋应该落在哪个位置", "type": 2 }, "tournamentId": 18, "startTime": 1551378165623, "systemTime": 1551378165720, "timeLength": 1800 }, "message": "SUCCESS" } ``` type=3 ```json { "code": "0", "data": { "question": { "chessBoard": { "blackChessList": [ [8, 6], [8, 7], [9, 7], [10, 7] ], "whiteChessList": [ [8, 5], [7, 6], [7, 7], [9, 6], [8, 8], [9, 8], [10, 8], [10, 6], [11, 6], [12, 7], [11, 8] ] }, "knowledgeId": 6, "knowledgeName": "围棋常识", "questionId": 48, "title": "哈喽", "type": 3 }, "tournamentId": 109, "startTime": 1553564641381, "systemTime": 1553564641506, "timeLength": 3600 }, "message": "SUCCESS" } ``` type=4 ```json { "code": "0", "data": { "question": { "chessBoard": { "blackChessList": [ [6, 2], [4, 4], [3, 3], [7, 3], [6, 5], [3, 9], [6, 10], [6, 8], [5, 7] ], "whiteChessList": [ [4, 2], [4, 5], [6, 3], [8, 5], [7, 6], [8, 8], [8, 7] ] }, "knowledgeId": 6, "knowledgeName": "围棋常识", "options": [{ "optionContent": "几个子围住一个交叉点,术语叫做‘’眼‘’做眼的目的是防止棋子被对方提去。", "optionId": 59, "sort": 1 }, { "optionContent": "围棋,起源于中国,中国古代称为“弈”", "optionId": 60, "sort": 2 }, { "optionContent": "现代围棋由日本发展而来,取消了座子规则,黑先白后,使围棋的变化更加复杂多变。围棋也被认为是世界上最复杂的棋盘游戏。", "optionId": 61, "sort": 3 }, { "optionContent": "围棋,是一种策略性两人棋类游戏,中国古时称“弈”,西方名称“Chess”", "optionId": 62, "sort": 4 }], "questionId": 5, "title": "以下棋盘,白旗应该如何落子", "type": 3 }, "tournamentId": 19, "startTime": 1551378391340, "systemTime": 1551378391365, "timeLength": 1800 }, "message": "SUCCESS" } ``` #### 1.9.3 保存考试答案 **接口地址:http://192.168.10.116/go-user/exam/saveAnswer** 请求方式:post 接口说明: 围棋题时,用户每落一个子,即调一次本接口,如果接口不返回move参数,则当前题结束 | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | tournamentId| 赛事id | int | 是 | | questionId| 当前试题id | int | 是 | | optionId | 用户选择的选项id | int | 否 | 文字选择题、围棋选择题和图形选择题时必传 | move | 用户在棋盘上落子的坐标位置 | json | 否 | 围棋题时必传,包含以下字段 | pointX | 横坐标 | int | 否 | | pointY | 纵坐标 | int | 否 | | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | totalNum| 已完成的试题个数 | int | 是 | | correctNum| 正确的个数 | int | 是 | | correct| 当前试题的回答结果 | boolean | 是 | true-正确 false-错误 | deadStone | 用户落子后的提子信息 | json array | 否 | | move | 机器落子 | json array | 否 | | afterMoveDeadStone | 机器落子后的提子信息 | json array | 否 | | finished | 考试是否结束 | boolean | 是 | true-结束 false-未结束 | passed | 考试是否通过 | boolean | 是 | true-通过 false-未通过 | danGradingAfterPass | 通过后的段位 | string | 否 | 考试通过后返回 文字选择题、围棋选择题、图形选择题 请求示例: ```json { "optionId": 58, "questionId": 6, "tournamentId": 7 } ``` 应答示例: ```json { "code": "0", "data": { "correct": false, "correctNum": 1, "totalNum": 1 }, "message": "SUCCESS" } ``` 围棋题 请求示例: ```json { "move": { "pointX": 9, "pointY": 5 }, "questionId": 48, "recordId": 104 } ``` 应答示例: ```json { "code": "0", "data": { "afterMoveDeadStone": [{ "pointX": 8, "pointY": 7 }, { "pointX": 8, "pointY": 6 }, { "pointX": 10, "pointY": 7 }, { "pointX": 9, "pointY": 7 }], "correct": true, "correctNum": 1, "move": { "pointX": 11, "pointY": 7 }, "totalNum": 3 }, "message": "SUCCESS" } ``` #### 1.9.4 获取历史考试记录 **接口地址:http://192.168.10.116/go-user/exam/listPageHistoryRecords** 请求方式:get | **输入参数** | 参数名称 | 类型 | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | pageSize | 每页显示条数 | int | 是 | | currentPage| 当前页 | int | 是 | 从1开始 | **输出参数** | **参数名称** | **类型** | 必填 | 参数说明 | |-------------------|----------------|------------|------|-----------------| | pageSize | 页面大小 | int | 是 | | currentPage | 当前页 | int | 是 | | totalRow | 总记录数 | int | 是 | | totalPage | 总页码 | int | 是 | | records | 列表记录 | json数组 | 是 | *包含以下字段* | totalNum| 已完成的试题个数 | int | 是 | | correctNum| 正确的个数 | int | 是 | | tournamentId| 赛事id | string | 是 | | tournamentName| 赛事名字 | string | 是 | | startTime | 开始时间 | string | 时 | 如:2019-04-19 17:48:40 | endTime | 结束时间 | string | 时 | 如:2019-04-19 17:48:40 | grade | 赛事段位 | int | 是 | | pass | 考试是否通过 | boolean | 是 | true-通过 false-未通过 请求示例: ```json http://xx:xx/go-user/exam/listPageHistoryRecords?pageSize=5¤tPage=1 ``` 应答示例: ```json { "code": "0", "data": { "totalRow": 1, "records": [{ "correctNum": 3, "endTime": "2019-04-19 17:50:32", "gmtCreate": "2019-04-19 17:48:39", "gmtModified": "2019-04-19 18:57:08", "grade": 0, "id": 54, "pass": false, "startTime": "2019-04-19 17:48:40", "status": 1, "totalNum": 4, "tournamentId": 62, "tournamentName": "测试请勿报名", "userId": 3572, "userName": "尚东昌" }], "totalPage": 1, "pageSize": 5, "currentPage": 1 }, "message": "SUCCESS" } ```