|
@@ -16,13 +16,19 @@ class Reg extends Base
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取手机随机验证码
|
|
|
+ * 获取手机随机验证码:未登录
|
|
|
* @return mixed
|
|
|
*/
|
|
|
public function getMCode()
|
|
|
{
|
|
|
$mobile = $this->checkMobileExists(1);
|
|
|
|
|
|
+ $msg = $this->getMcode_action($mobile);
|
|
|
+ return $msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function getMcode_action($mobile)
|
|
|
+ {
|
|
|
$code = $this->mcode($mobile);
|
|
|
$msg = '验证码已发送至您的手机,请注意查收,十分钟之内有效';
|
|
|
$debug = Dever::config('base', 'project')->mobileCode['debug'];
|
|
@@ -32,6 +38,18 @@ class Reg extends Base
|
|
|
return $msg;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取手机随机验证码:已经登录状态
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function getMCodeLogin()
|
|
|
+ {
|
|
|
+ $mobile = $this->checkMobileExists(1, true);
|
|
|
+
|
|
|
+ $msg = $this->getMcode_action($mobile);
|
|
|
+ return $msg;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 检测图形验证码
|
|
|
* @return mixed
|
|
@@ -82,7 +100,7 @@ class Reg extends Base
|
|
|
* 验证手机号是否注册
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function checkMobileExists($state = false)
|
|
|
+ public function checkMobileExists($state = false, $login = false)
|
|
|
{
|
|
|
$param['option_mobile'] = $this->checkMobile();
|
|
|
|
|
@@ -94,8 +112,10 @@ class Reg extends Base
|
|
|
|
|
|
$user = Dever::load('passport/user-one', $param);
|
|
|
|
|
|
- if ($user) {
|
|
|
+ if ($login == false && $user) {
|
|
|
Dever::alert('该手机号已经注册');
|
|
|
+ } elseif ($login == true && !$user) {
|
|
|
+ Dever::alert('该手机号未注册');
|
|
|
}
|
|
|
|
|
|
return $param['option_mobile'];
|
|
@@ -125,7 +145,7 @@ class Reg extends Base
|
|
|
* 验证邮箱是否注册
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function checkEmailExists($state = false)
|
|
|
+ public function checkEmailExists($state = false, $login = false)
|
|
|
{
|
|
|
$param['option_email'] = $this->checkEmail();
|
|
|
|
|
@@ -137,8 +157,10 @@ class Reg extends Base
|
|
|
|
|
|
$user = Dever::load('passport/user-one', $param);
|
|
|
|
|
|
- if ($user) {
|
|
|
+ if ($login == false && $user) {
|
|
|
Dever::alert('该邮箱已经注册');
|
|
|
+ } elseif ($login == true && !$user) {
|
|
|
+ Dever::alert('该邮箱未注册');
|
|
|
}
|
|
|
|
|
|
return $param['option_email'];
|
|
@@ -207,9 +229,8 @@ class Reg extends Base
|
|
|
$baccount = ucfirst($account);
|
|
|
$method = 'check' . $baccount . 'Exists';
|
|
|
|
|
|
- $param['option_' . $account] = $this->$method();
|
|
|
+ $param['option_' . $account] = $this->$method(0, true);
|
|
|
|
|
|
- $this->checkCode($param['option_' . $account]);
|
|
|
|
|
|
$user = Dever::load('passport/user-one', $param);
|
|
|
|
|
@@ -235,7 +256,7 @@ class Reg extends Base
|
|
|
Dever::load('passport/user-update', $param);
|
|
|
|
|
|
if ($id > 0) {
|
|
|
- return $this->save($id);
|
|
|
+ return 1;
|
|
|
$this->refer();
|
|
|
} else {
|
|
|
Dever::alert('修改失败');
|