init: 从宝塔同步到 Gitea

This commit is contained in:
root
2026-02-25 01:50:31 +08:00
commit e633c8e27d
2444 changed files with 399341 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace app\jk\controller;
use \think\Controller;
use think\Session;
use think\Request;
use think\Db;
class Common Extends Controller{
public function __construct(){
parent::__construct();
$user_info = Session::get('user_info');
if(empty($user_info)){
$this->redirect('/login/index',302);
exit();
}
}
}
+1214
View File
File diff suppressed because it is too large Load Diff
+49
View File
@@ -0,0 +1,49 @@
<?php
namespace app\jk\controller;
use \think\Controller;
use \think\Session;
use \think\Request;
use \think\Db;
class Login Extends Controller{
public function index(){
return $this->fetch();
}
/**
* 处理登录
*/
public function do_login(){
if(Request::instance()->post()){
// 接收表单提交过来的数据,做数据验证
$username = Request::instance()->post('name');
$password = Request::instance()->post('password');
if(!isset($username) || empty($username)){
die(json_encode(['code'=>0,'msg'=>'用户名不能为空!']));
}
if(!isset($password) || empty($password)){
die(json_encode(['code'=>0,'msg'=>'密码不能为空!']));
}
// 查询客户信息,判断用户名和密码是否正确
$admin_info = Db::name('user')->where('username',$username)->where('agent',2)->find();
if(empty($admin_info)){
die(json_encode(['code'=>0,'msg'=>'用户不存在!']));
}
if(think_ucenter_md5($password,UC_AUTH_KEY) != $admin_info['password']){
die(json_encode(['code'=>0,'msg'=>'密码错误!']));
}
if(!$admin_info['login_token']){
$admin_info['login_token'] = md5($admin_info['encrypt'].$admin_info['password']);
Db::name('user')->where('username',$username)->where('agent',2)->update(['login_token' => $admin_info['login_token']]);
}
Session::set('user_info',$admin_info);
die(json_encode(['code'=>1,'msg'=>'登录成功!','url'=>'/']));
}else{
die(json_encode(['code'=>0,'msg'=>'操作错误!']));
}
}
public function logout(){
Session::set('user_info',"");
$this->redirect('/login/index',302);
}
}