前端目录调整

This commit is contained in:
molong
2022-05-12 21:23:18 +08:00
parent fe38e19924
commit a37870c93b
145 changed files with 3090 additions and 7244 deletions

View File

@@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\services\auth;
use app\model\user\Users;
class LoginService{
public function authLogin($request){
$params = $request->post();
$map = [];
foreach($params as $field => $value){
if(in_array($field, ['username', 'email', 'mobile']) && $field != 'password'){
$map[$field] = $value;
}
}
$user = Users::where($map)->field(['uid','username', 'password', 'email', 'avatar', 'department_id', 'status'])->findOrEmpty();
if (!$user->isEmpty()) {
if(password_verify(base64_decode($params['password']), $user->password)){
throw new \think\Exception('密码不正确!', 100002);
}elseif($user->status != 1){
throw new \think\Exception('当前用户不可用', 100003);
}else{
return $user->append(['token']);
}
}else{
throw new \think\Exception('当前用户不存在', 100001);
}
}
}