通过jscode换取openid
<p><strong>简要描述:</strong> </p>
<ul>
<li>通过jscode换取openid</li>
</ul>
<p><strong>请求URL:</strong> </p>
<ul>
<li><code>/backstage/system/getopenid</code></li>
</ul>
<p><strong>请求方式:</strong></p>
<ul>
<li>POST </li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">必选</th>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">jscode</td>
<td style="text-align: left;">是</td>
<td style="text-align: left;">string</td>
<td>小程序应用对应的用户jscode,用来换取openid和session_key</td>
</tr>
</tbody>
</table>
<p><strong>请求示例</strong></p>
<pre><code> {
"jscode": 53246527396456
}</code></pre>
<p><strong>返回示例</strong></p>
<pre><code> 如果是首次登录,需要校验
{
"openid": 53246527396456,//对应小程序的openid
"session_key": 53246527396456,//对应小程序的session-key
"registerflag": 0,
"phone":""
}
如果是曾经校验登录过
{
"openid": 53246527396456,//对应小程序的openid
"session_key": 53246527396456,//对应小程序的session-key
"registerflag": 1,
"phone":""
}</code></pre>
<p><strong>特殊返回参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">必选</th>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">registerflag</td>
<td style="text-align: left;">是</td>
<td style="text-align: left;">string</td>
<td>有0或者是1两个值,1代表已经获取授权过,这是用户生命周期第二次或者第二次以上回到小程序,0则说明是生命周期第一次来到小程序,需要弹出获取授权对话框以让用户贡献自己的各种信息详情给系统</td>
</tr>
</tbody>
</table>