|
@@ -91,6 +91,9 @@ class User extends Api
|
|
|
}
|
|
|
$user = \app\common\model\User::getByMobile($mobile);
|
|
|
if ($user) {
|
|
|
+ if ($user->status == -1) {
|
|
|
+ $this->error(__('Account has been cancelled'));
|
|
|
+ }
|
|
|
if ($user->status != 1) {
|
|
|
$this->error(__('Account is locked'));
|
|
|
}
|
|
@@ -366,5 +369,36 @@ class User extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 注销账号
|
|
|
+ *
|
|
|
+ * @param string $mobile 手机号
|
|
|
+ * @param string $captcha 验证码
|
|
|
+ */
|
|
|
+ public function cancleUser()
|
|
|
+ {
|
|
|
+ $captcha = input("emailcaptcha");
|
|
|
+ if (!$captcha) {
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+
|
|
|
+ $email = $this->auth->email;
|
|
|
+ $ret = Ems::check($email, $captcha, 'resetpwd');
|
|
|
+ if (!$ret) {
|
|
|
+ $this->error(__('Captcha is incorrect'));
|
|
|
+ }
|
|
|
+ Ems::flush($email, 'resetpwd');
|
|
|
+
|
|
|
+ $user = $this->auth->getUser();
|
|
|
+
|
|
|
+ $user->status = -1;
|
|
|
+
|
|
|
+ $user->save();
|
|
|
+
|
|
|
+ $this->auth->logout();
|
|
|
+
|
|
|
+ $this->success("账号注销成功");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|