|
@@ -464,7 +464,7 @@ class User extends Api
|
|
|
*/
|
|
|
public function profile()
|
|
|
{
|
|
|
- $field_array = ['nickname','introcode','gender','birthday','height','weight','bio','audio_bio','avatar','photo_images','education_id','hobby_ids','job_id','marital_id','tag_ids','wages_id','hometown_cityid','hide_is_finishinfo','wechat_openid'];
|
|
|
+ $field_array = ['nickname','introcode','gender','birthday','height','weight','bio','audio_bio','avatar','photo_images','education_id','hobby_ids','job_id','marital_id','tag_ids','wages_id','hometown_cityid','hide_is_finishinfo'];
|
|
|
|
|
|
$data = [];
|
|
|
foreach($field_array as $key => $field){
|
|
@@ -671,6 +671,9 @@ class User extends Api
|
|
|
$mobile = $this->request->request('mobile');
|
|
|
$captcha = $this->request->request('captcha');
|
|
|
|
|
|
+ if(!empty($this->auth->mobile)){
|
|
|
+ $this->error('已经绑定了手机号');
|
|
|
+ }
|
|
|
if (!$mobile || !$captcha) {
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
@@ -678,7 +681,7 @@ class User extends Api
|
|
|
$this->error(__('Mobile is incorrect'));
|
|
|
}
|
|
|
if (\app\common\model\User::where('mobile', $mobile)->find()) {
|
|
|
- $this->error(__('Mobile already exist'));
|
|
|
+ $this->error('该手机号已被其他用户绑定');
|
|
|
}
|
|
|
$result = Sms::check($mobile, $captcha, 'changemobile');
|
|
|
if (!$result) {
|
|
@@ -695,6 +698,35 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 微信注册来的,绑定手机号
|
|
|
+ *
|
|
|
+ * @ApiMethod (POST)
|
|
|
+ * @param string $mobile 手机号
|
|
|
+ * @param string $captcha 验证码
|
|
|
+ */
|
|
|
+ public function bindopenid()
|
|
|
+ {
|
|
|
+ $user = $this->auth->getUser();
|
|
|
+ $wechat_openid = $this->request->request('wechat_openid');
|
|
|
+
|
|
|
+ if(!empty($this->auth->wechat_openid)){
|
|
|
+ $this->error('已经绑定了微信号');
|
|
|
+ }
|
|
|
+ if (!$wechat_openid) {
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (\app\common\model\User::where('wechat_openid', $wechat_openid)->find()) {
|
|
|
+ $this->error('该微信号已被其他用户绑定');
|
|
|
+ }
|
|
|
+
|
|
|
+ $user->wechat_openid = $wechat_openid;
|
|
|
+ $user->save();
|
|
|
+
|
|
|
+ $this->success('success',$this->userInfo('return'));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 第三方登录
|
|
|
*
|
|
|
* @ApiMethod (POST)
|