|
@@ -120,44 +120,7 @@ class User extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 注册会员
|
|
|
- *
|
|
|
- * @ApiMethod (POST)
|
|
|
- * @param string $username 用户名
|
|
|
- * @param string $password 密码
|
|
|
- * @param string $email 邮箱
|
|
|
- * @param string $mobile 手机号
|
|
|
- * @param string $code 验证码
|
|
|
- */
|
|
|
- /*public function register()
|
|
|
- {
|
|
|
- $username = $this->request->post('username');
|
|
|
- $password = $this->request->post('password');
|
|
|
- $email = $this->request->post('email');
|
|
|
- $mobile = $this->request->post('mobile');
|
|
|
- $code = $this->request->post('code');
|
|
|
- if (!$username || !$password) {
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
- }
|
|
|
- if ($email && !Validate::is($email, "email")) {
|
|
|
- $this->error(__('Email is incorrect'));
|
|
|
- }
|
|
|
- //if ($mobile && !Validate::regex($mobile, "^1\d{10}$")) {
|
|
|
- // $this->error(__('Mobile is incorrect'));
|
|
|
- //}
|
|
|
- $ret = Sms::check($mobile, $code, 'register');
|
|
|
- if (!$ret) {
|
|
|
- $this->error(__('Captcha is incorrect'));
|
|
|
- }
|
|
|
- $ret = $this->auth->register($username, $password, $email, $mobile, []);
|
|
|
- if ($ret) {
|
|
|
- $data = $this->userInfo('return');
|
|
|
- $this->success(__('Sign up successful'), $data);
|
|
|
- } else {
|
|
|
- $this->error($this->auth->getError());
|
|
|
- }
|
|
|
- }*/
|
|
|
+
|
|
|
|
|
|
//微信登录,预先假注册
|
|
|
public function wechatlogin(){
|
|
@@ -583,15 +546,14 @@ class User extends Api
|
|
|
if (!$result) {
|
|
|
$this->error(__('Captcha is incorrect'));
|
|
|
}
|
|
|
- $verification = $user->verification;
|
|
|
- $verification->mobile = 1;
|
|
|
- $user->verification = $verification;
|
|
|
+
|
|
|
+ Sms::flush($user->mobile, 'changemobile');
|
|
|
+ Sms::flush($mobile, 'changemobile');
|
|
|
+
|
|
|
$user->mobile = $mobile;
|
|
|
$user->simplemobile = $simplemobile;
|
|
|
$user->save();
|
|
|
|
|
|
- Sms::flush($user->mobile, 'changemobile');
|
|
|
- Sms::flush($mobile, 'changemobile');
|
|
|
$this->success();
|
|
|
}
|
|
|
|
|
@@ -639,11 +601,12 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
//新的ios用户
|
|
|
+ $where = [];
|
|
|
$where['mobile'] = $mobile;
|
|
|
- $userData = model('User')->where($where)->find();//老用户
|
|
|
+ $userData = Db::name('user')->where($where)->find();//老用户
|
|
|
if (!empty($userData)) {
|
|
|
if (empty($userData['ios_user_id'])) {
|
|
|
- model('User')->update(['ios_user_id' => $iosUserId],$where);//老用户更新ios_user_id
|
|
|
+ Db::name('user')->where('id',$userData['id'])->update(['ios_user_id' => $iosUserId]);//老用户更新ios_user_id
|
|
|
} else {
|
|
|
if ($userData['ios_user_id'] != $iosUserId) {
|
|
|
$this->error('该手机号已被其他用户绑定');
|
|
@@ -713,11 +676,12 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
//新的openid用户
|
|
|
+ $where = [];
|
|
|
$where['mobile'] = $mobile;
|
|
|
- $userData = model('User')->where($where)->find();//老用户
|
|
|
+ $userData = Db::name('user')->where($where)->find();//老用户
|
|
|
if (!empty($userData)) {
|
|
|
if (empty($userData['wechat_openid'])) {
|
|
|
- model('User')->update(['wechat_openid' => $wechatCode['openid']],$where);//老用户更新openid
|
|
|
+ Db::name('user')->where('id',$userData['id'])->update(['wechat_openid' => $wechatCode['openid']]);//老用户更新openid
|
|
|
} else {
|
|
|
if ($userData['wechat_openid'] != $wechatCode['openid']) {
|
|
|
$this->error('该手机号已被其他用户绑定');
|