作者 何书鹏
1 个管道 的构建 通过 耗费 9 秒

2021年4月13之后的获取不到openid

... ... @@ -653,6 +653,7 @@ class User extends Api
"data": {
"session_key": "1qyMwZRVdlBmQLwRYtYSgA==",
"token": "9e4648c7-c640-4e41-b758-dd1a8ef7a7ae",
"openid": "9e4648c7-c640-4e41-b758-dd1a8ef7a7ae",
}
})
*/
... ... @@ -695,6 +696,7 @@ class User extends Api
* @ApiParams (name="sessionKey", type="string", required=true, description="小程序sessionKey")
* @ApiParams (name="iv", type="string", required=true, description="小程序iv")
* @ApiParams (name="encryptData", type="string", required=true, description="小程序encryptData")
* @ApiParams (name="openid", type="string", required=true, description="openid")
* @ApiParams (name="user_id", type="inter", required=false, description="扫码获取的用户ID")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
... ... @@ -727,6 +729,13 @@ class User extends Api
// 获取小程序配置
$app = Wechat::miniProgram();
$user_info = $app->encryptor->decryptData($param['sessionKey'], $param['iv'], $param['encryptData']);
// 2021年4月13之后的获取不到openid
if(empty($user_info['openId'])){
empty($param['openid']) && $this->error('传参缺少openid');
$user_info['openId'] = $param['openid'];
}
// 判断用户是否授权
$where = [
'openid' => $user_info['openId']
... ...
... ... @@ -3394,6 +3394,7 @@
"data": {
"session_key": "1qyMwZRVdlBmQLwRYtYSgA==",
"token": "9e4648c7-c640-4e41-b758-dd1a8ef7a7ae",
"openid": "9e4648c7-c640-4e41-b758-dd1a8ef7a7ae",
}
}</pre>
</div>
... ... @@ -3465,6 +3466,12 @@
<td>小程序encryptData</td>
</tr>
<tr>
<td>openid</td>
<td>string</td>
<td></td>
<td>openid</td>
</tr>
<tr>
<td>user_id</td>
<td>inter</td>
<td></td>
... ... @@ -3501,6 +3508,10 @@
<input type="string" class="form-control input-sm" id="encryptData" required placeholder="小程序encryptData" name="encryptData">
</div>
<div class="form-group">
<label class="control-label" for="openid">openid</label>
<input type="string" class="form-control input-sm" id="openid" required placeholder="openid" name="openid">
</div>
<div class="form-group">
<label class="control-label" for="user_id">user_id</label>
<input type="inter" class="form-control input-sm" id="user_id" placeholder="扫码获取的用户ID" name="user_id">
</div>
... ... @@ -15562,7 +15573,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2021-02-06 19:34:03 </div>
Generated on 2021-04-15 19:45:55 </div>
<div class="col-md-6" align="right">
<a href="./" target="_blank">My Website</a>
</div>
... ...