Sfoglia il codice sorgente

Merge branch 'master' of http://git.huxiukeji.com/lizhen/yueke

panda 8 mesi fa
parent
commit
eb917c146d

+ 1 - 1
application/api/controller/Lesson.php

@@ -105,7 +105,7 @@ class Lesson extends Api
             $i_data = [
                 'yeah' =>$year,
                 'month'=>$month,
-                'day'  => $j,
+                'day'  => $j.'',
                 'date' => $idate,
                 'week' => $week,
                 'is_today' => 0,

+ 34 - 0
application/api/controller/User.php

@@ -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("账号注销成功");
+    }
+
 
 }

+ 1 - 0
application/api/lang/en/User.php

@@ -4,4 +4,5 @@ return [
     '邮箱已被其他人使用' => 'The email is already in use by someone else',
     '手机号已被其他人使用' => 'The phone number is already in use by someone else',
     '资料更新完成' => 'Data update completed',
+    '账号注销成功' => 'Account cancellation successful',
 ];

+ 1 - 0
application/api/lang/zh-cn/user.php

@@ -38,4 +38,5 @@ return [
     'Change password failure'               => '修改密码失败',
     'Change password successful'            => '修改密码成功',
     'Reset password successful'             => '重置密码成功',
+    'Account has been cancelled'             => '账号已注销',
 ];

+ 9 - 0
application/common/library/Auth.php

@@ -115,6 +115,10 @@ class Auth
                 $this->setError('Account not exist');
                 return false;
             }
+            if ($user['status'] == -1) {
+                $this->setError('Account has been cancelled');
+                return false;
+            }
             if ($user['status'] != 1) {
                 $this->setError('Account is locked');
                 return false;
@@ -232,6 +236,11 @@ class Auth
             return false;
         }
 
+        if ($user->status == -1) {
+            $this->setError('Account has been cancelled');
+            return false;
+        }
+
         if ($user->status != 1) {
             $this->setError('Account is locked');
             return false;