From dcd0a80bd4a95c3d42b7eccfc00ef40a45eb1bbb Mon Sep 17 00:00:00 2001
From: Chrisleung <showerlzy@gmail.com>
Date: Thu, 8 Feb 2018 14:18:47 +0800
Subject: [PATCH] 1. 修复api演示模块返回信息文字错误 2. 修复会员模块,修改,激活邮箱,手机号失败问题

---
 application/admin/command/Install/fastadmin.sql |  3 ++-
 application/api/controller/User.php             | 18 +++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/application/admin/command/Install/fastadmin.sql b/application/admin/command/Install/fastadmin.sql
index 2c54a38..b2d8c41 100755
--- a/application/admin/command/Install/fastadmin.sql
+++ b/application/admin/command/Install/fastadmin.sql
@@ -424,6 +424,7 @@ CREATE TABLE `fa_user` (
   `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
   `token` varchar(50) NOT NULL DEFAULT '' COMMENT 'Token',
   `status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态',
+  `verification` varchar(255) NOT NULL DEFAULT '' COMMENT '验证',
   PRIMARY KEY (`id`),
   KEY `username` (`username`),
   KEY `email` (`email`),
@@ -431,7 +432,7 @@ CREATE TABLE `fa_user` (
 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='会员表';
 
 BEGIN;
-INSERT INTO `fa_user` VALUES (1, 1, 'admin', 'admin', 'c13f62012fd6a8fdf06b3452a94430e5', 'rpR6Bv', 'admin@163.com', '13888888888', '/assets/img/avatar.png', 0, 0, '2017-04-15', '', 0, 1, 1, 1516170492, 1516171614, '127.0.0.1', 0, '127.0.0.1', 1491461418, 0, 1516171614, '', 'normal');
+INSERT INTO `fa_user` VALUES (1, 1, 'admin', 'admin', 'c13f62012fd6a8fdf06b3452a94430e5', 'rpR6Bv', 'admin@163.com', '13888888888', '/assets/img/avatar.png', 0, 0, '2017-04-15', '', 0, 1, 1, 1516170492, 1516171614, '127.0.0.1', 0, '127.0.0.1', 1491461418, 0, 1516171614, '', 'normal','');
 COMMIT;
 
 DROP TABLE IF EXISTS `fa_user_group`;
diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index b3a6345..c2ec265 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -72,11 +72,11 @@ class User extends Api
         }
         if (!Validate::regex($mobile, "^1\d{10}$"))
         {
-            $this->error(__('Mobile incorrect'));
+            $this->error(__('Mobile is incorrect'));
         }
         if (!Sms::check($mobile, $captcha, 'mobilelogin'))
         {
-            $this->error(__('Captcha invalid'));
+            $this->error(__('Captcha is incorrect'));
         }
         $user = \app\common\model\User::getByMobile($mobile);
         if ($user)
@@ -120,11 +120,11 @@ class User extends Api
         }
         if ($email && !Validate::is($email, "email"))
         {
-            $this->error(__('Email incorrect'));
+            $this->error(__('Email is incorrect'));
         }
         if ($mobile && !Validate::regex($mobile, "^1\d{10}$"))
         {
-            $this->error(__('Mobile incorrect'));
+            $this->error(__('Mobile is incorrect'));
         }
         $ret = $this->auth->register($username, $password, $email, $mobile, []);
         if ($ret)
@@ -190,7 +190,7 @@ class User extends Api
         }
         if (!Validate::is($email, "email"))
         {
-            $this->error(__('Mobile incorrect'));
+            $this->error(__('Email is incorrect'));
         }
         if (\app\common\model\User::where('email', $email)->where('id', '<>', $user->id)->find())
         {
@@ -227,7 +227,7 @@ class User extends Api
         }
         if (!Validate::regex($mobile, "^1\d{10}$"))
         {
-            $this->error(__('Mobile incorrect'));
+            $this->error(__('Mobile is incorrect'));
         }
         if (\app\common\model\User::where('mobile', $mobile)->where('id', '<>', $user->id)->find())
         {
@@ -236,7 +236,7 @@ class User extends Api
         $result = Sms::check($mobile, $captcha, 'changemobile');
         if (!$result)
         {
-            $this->error(__('Captcha invalid'));
+            $this->error(__('Captcha is incorrect'));
         }
         $verification = $user->verification;
         $verification->mobile = 1;
@@ -300,7 +300,7 @@ class User extends Api
         }
         if ($mobile && !Validate::regex($mobile, "^1\d{10}$"))
         {
-            $this->error(__('Mobile incorrect'));
+            $this->error(__('Mobile is incorrect'));
         }
         $user = \app\common\model\User::getByMobile($mobile);
         if (!$user)
@@ -310,7 +310,7 @@ class User extends Api
         $ret = Sms::check($mobile, $captcha, 'resetpwd');
         if (!$ret)
         {
-            $this->error(__('Captcha invalid'));
+            $this->error(__('Captcha is incorrect'));
         }
         Sms::flush($mobile, 'resetpwd');
 
--
libgit2 0.24.0