# 徽章活动相关接口 ### 说明 1. 通用返回格式, errcode=0 表示无错误 2. 如无特别说明, 以下接口的Response格式指的是 data 字段 3. 接口名中带*的表示, 需要验证token, token可以设置header的Authorization: Bearer JWT_token, 或Post body的token字段, 或Get的query token ```json { "errcode": Number, "errmsg": String, "data": {} } ``` ### 1. 钱包预登录 #### Request - URL:`/api/user/login` - 方法:`GET` #### Response ```json { "nonce": String, "tips": String } ``` ### 2. 钱包登录 客户端在获得钱包地址后,须先调用预登录方法获取nonce和tips, 然后调用钱包进行EIP-721签名. 登录成功后返回的jwt需要保存至本地存储, 再次载入后, 可解析并获取exp字段, 判断当前token是否已经过期 #### Request - URL:`/api/user/login` - 方法:`POST` - 头部: - Content-type: application/json - Body: ```json { "nonce": Number, "signature": String, "account": String } ``` #### Response ```json { "token": String, } ``` ### 3. *检查当前用户claim状态 #### Request - URL:`/api/user/status` - 方法:`GET` - 头部: - Authorization: Bearer JWT_token - 参数: - `uid`(用户 ID) #### Response - 类型:对象 - 属性: - `account`(对象):用户账户信息。 - `user`(对象):认证用户的信息。 ### 4. *用户申请claim #### Request - URL:`/api/user/claim` - 方法:`POST` - 头部: - Authorization: Bearer JWT_token - Body: 空对象 `{}`。 #### Response ```json { "taskId": String, } ``` ### 5.* 检查claim任务的状态 #### Request - URL:`/api/user/claim/:taskId` - 方法:`GET` - 头部: - Authorization: Bearer JWT_token #### Response ```json { "status": Number, "txHashList": [String], } ```