...
|
...
|
@@ -129,6 +129,35 @@ class User extends Api |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取微信手机号
|
|
|
*
|
|
|
* @ApiMethod (POST)
|
|
|
* @param string $token token
|
|
|
* @param string $code Code码
|
|
|
*/
|
|
|
public function thirdMobile()
|
|
|
{
|
|
|
$code = $this->request->post('code');
|
|
|
if (!$code){
|
|
|
$this->error('后台所需参数缺失请完善参数');
|
|
|
}
|
|
|
$token = $this->getToken();
|
|
|
$param = [];
|
|
|
$param['access_token'] = $token;
|
|
|
$param['code'] = $code;
|
|
|
$wxapi = Http::post('https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token='.$token,$param);//请求openid
|
|
|
$wxapi = json_decode($wxapi,true);
|
|
|
if ($wxapi['errcode'] != 0){
|
|
|
$this->error($wxapi['errmsg']);
|
|
|
}
|
|
|
$mobile = $wxapi['phone_info']['purePhoneNumber'];
|
|
|
$user = $this->auth->getUser();
|
|
|
$user->mobile = $mobile;
|
|
|
$user->isUpdate()->save();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (用户优惠券)
|
|
|
* @ApiMethod (POST)
|
...
|
...
|
|