error = '验证码错误'; return false; } if(!$clerk = $this->where(['phone' => $data['user_name'],'status' => 20])->find()){ $this->error = '账号不存在'; return false; } if($clerk['password'] != hema_hash($data['password'])){ $this->error = '密码错误'; return false; } $applet = Applet::get($clerk['applet_id']); $user = UserModel::get($applet['user_id']); $user['user_name'] = $data['user_name']; Session::set('hema_store_foodclerk',[ 'user' => $user, 'applet' => $applet, 'shop_id' => $clerk['shop_id'], 'is_login' => true, ]); return true; } /** * 修改密码 */ public function renew(array $data) { if(strlen($data['password']) < 6){ $this->error = '密码长度不足6位'; return false; } if ($data['password'] != $data['password_confirm']) { $this->error = '两次密码输入不一致'; return false; } $data['password'] = hema_hash($data['password']); return $this->save($data) !== false; } }