用户接口
<h3>1、注册/登录接口</h3>
<p>请求地址:/diamond/v1/user/login
请求方式:post
YApi地址:<a href="http://121.201.120.132:3000/project/11/interface/api/722">点击打开</a>
请求参数:无</p>
<p>响应参数:</p>
<pre><code>{
"code": 0,
"message": "success",
"data": {
"user": {
"uid": 44932536, //用户id
"openId": "oKGsK6xP50BkrUUO6JITqKUA_-ag", //openid,若未绑定微信,则为空
"nickName": "Jeason", //用户昵称,若未绑定微信,则为空
"headimgurl": "https://thirdwx.qlogo.cn/mmop...", //用户头像,若未绑定微信,则为空
"unionid": "",
"jwt": "eyJhbGciOiJIUzI1NiIsImtpZCI6ImtpdHR...", //token
"new": false
}
}
}</code></pre>
<h3>2、绑定微信</h3>
<p>请求地址:/diamond/v1/user/bind
请求方式:post
YApi地址:<a href="http://121.201.120.132:3000/project/11/interface/api/721">点击打开</a>
请求参数:</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>openId</td>
<td>string</td>
<td>微信的openid</td>
</tr>
<tr>
<td>nickName</td>
<td>string</td>
<td>微信昵称</td>
</tr>
<tr>
<td>headimgurl</td>
<td>string</td>
<td>微信头像地址</td>
</tr>
</tbody>
</table>
<p>响应参数:</p>
<pre><code>{
"code": 0,
"message": "success",
"data": {
"jwt": "eyJhbGciOiJIUzI1NiIsImtpZCI6ImtpdHR...", //token
}
}</code></pre>
<h3>3、通过微信返回的code转换成openid</h3>
<p>请求地址:<a href="https://api.weixin.qq.com/sns/oauth2/access_token">https://api.weixin.qq.com/sns/oauth2/access_token</a>
请求方式:get
YApi地址:无
请求参数:</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>appid</td>
<td>string</td>
<td>微信appid</td>
</tr>
<tr>
<td>secret</td>
<td>string</td>
<td>微信密钥</td>
</tr>
<tr>
<td>code</td>
<td>string</td>
<td>code</td>
</tr>
<tr>
<td>grant_type</td>
<td>string</td>
<td>固定为:authorization_code</td>
</tr>
</tbody>
</table>
<p>响应参数:</p>
<pre><code>{
"openid": "oKGsK65YBF712F2EllGWepBhxduk",
"access_token": "xxxxxxxxxxxxxxxxxxxxxxxxxx"
}</code></pre>
<h3>4、获取微信用户信息</h3>
<p>请求地址:<a href="https://api.weixin.qq.com/sns/userinfo">https://api.weixin.qq.com/sns/userinfo</a>
请求方式:get
YApi地址:无
请求参数:</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>access_token</td>
<td>string</td>
<td>access_token</td>
</tr>
<tr>
<td>openid</td>
<td>string</td>
<td>openid</td>
</tr>
</tbody>
</table>
<p>响应参数:</p>
<pre><code>{
"nickname": "ccccccc",
"headimgurl": "https://xxxxx.jpeg",
"unionid": "u54555"
}</code></pre>
<h3>5、获取用户活跃天数</h3>
<p>请求地址:/diamond/v1/coin/user/queryscore
请求方式:post
YApi地址:无
请求参数:无</p>
<p>响应参数:</p>
<pre><code>{
"code": 0,
"message": "OK",
"data": {
"user_type": 3,
"cur_coin": 0,
"cur_cash": 0,
"today_coin": 0,
"today_cash": 0,
"show_ad_cnt": 140,
"today_ad": 1,
"reward_coin": 0,
"reward_cash": 0,
"ruf": 0,
"today_online": 0,
"active_days": 94, //活跃天数
"creattime": 1641266442
}
}</code></pre>