|
@@ -367,18 +367,26 @@ class User extends Api
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 绑定微信手机号
|
|
|
+ * @ApiMethod (POST)
|
|
|
+ * @ApiParams (name=code,description="获取手机号code")
|
|
|
+ */
|
|
|
public function bind_wechat_phone(){
|
|
|
$code = $this->request->post("code");
|
|
|
+ if(!$code){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
$access_token_result = \app\common\service\WxService::getWxAccessToken();
|
|
|
if(!$access_token_result){
|
|
|
- $this->error('请稍后重试');
|
|
|
+ $this->error('请刷新后重试');
|
|
|
}
|
|
|
$access_token = $access_token_result['access_token'];
|
|
|
|
|
|
// 获取手机号
|
|
|
$phone_info = \app\common\service\WxService::getWxphonenumber($access_token,$code);
|
|
|
if(!$phone_info){
|
|
|
- $this->error('请稍后重试!');
|
|
|
+ $this->error('请刷新后重试!');
|
|
|
}
|
|
|
|
|
|
//{"ret":true,"msg":"{\"errcode\":0,\"errmsg\":\"ok\",\"phone_info\":{\"phoneNumber\":\"18206485031\",\"purePhoneNumber\":\"18206485031\",\"countryCode\":\"86\",\"watermark\":{\"timestamp\":1679738067,\"appid\":\"wx20bb65dcc885b693\"}}}"}
|