init: 从宝塔同步到 Gitea
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use think\Db;
|
||||
use think\Request;
|
||||
use think\Session;
|
||||
|
||||
class Info extends Common{
|
||||
public function index(){
|
||||
$user_info = Session::get('user_info');
|
||||
$last_login_info = Session::get('last_login_info');
|
||||
$last_login_info['last_login_time'] = date('Y-m-d H:i:s',$last_login_info['last_login_time']);
|
||||
$this->assign('last_login_info',$last_login_info);
|
||||
$this->assign('user_info',$user_info);
|
||||
$system_info = Db::name('system')->where(array('id' => 1))->find();
|
||||
$this->assign('system_info',$system_info);
|
||||
$this->assign('user_info',$user_info);
|
||||
return $this->fetch();
|
||||
}
|
||||
public function pass_edit(){
|
||||
$user_info = Session::get('user_info');
|
||||
$this->assign('user_info',$user_info);
|
||||
return $this->fetch();
|
||||
}
|
||||
//修改密码
|
||||
public function update_password(){
|
||||
$id = $this->request->param('id');
|
||||
$oldPassword = $this->request->param('oldPassword');
|
||||
$newPassword = $this->request->param('newPassword');
|
||||
$confirmNewPassword = $this->request->param('confirmNewPassword');
|
||||
if(!$oldPassword){
|
||||
$msg['status'] = 1;
|
||||
$msg['code'] = '请填写旧密码!';
|
||||
return $msg;
|
||||
}
|
||||
$user_pass = Db::name('admin')->where('id',$id)->value('password');
|
||||
$oldPassword = think_ucenter_md5($oldPassword,UC_AUTH_KEY);
|
||||
if($user_pass != $oldPassword){
|
||||
$msg['status'] = 1;
|
||||
$msg['code'] = '原密码错误';
|
||||
return $msg;
|
||||
}
|
||||
if(!$newPassword){
|
||||
$msg['status'] = 1;
|
||||
$msg['code'] = '请填写新密码!';
|
||||
return $msg;
|
||||
}
|
||||
if(strlen($newPassword) < 6 || strlen($newPassword) > 20){
|
||||
$msg['status'] = 1;
|
||||
$msg['code'] = '密码长度必须是6到20个字符!';
|
||||
return $msg;
|
||||
}
|
||||
if(!$confirmNewPassword){
|
||||
$msg['status'] = 1;
|
||||
$msg['code'] = '请再次填写新密码!';
|
||||
return $msg;
|
||||
}
|
||||
if($newPassword != $confirmNewPassword){
|
||||
$msg['status'] = 1;
|
||||
$msg['code'] = '两次输入的密码不一致!';
|
||||
return $msg;
|
||||
}
|
||||
$newPassword = think_ucenter_md5($newPassword,UC_AUTH_KEY);
|
||||
$is_passwprd = Db::name('admin')->where('id',$id)->update(['password' => $newPassword]);
|
||||
if($is_passwprd == 1){
|
||||
$msg['status'] = 2;
|
||||
$msg['code'] = '修改成功';
|
||||
}else{
|
||||
$msg['status'] = 1;
|
||||
$msg['code'] = '修改失败,请稍后再试';
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
//修改个人信息
|
||||
public function update_info(){
|
||||
$casino_name = $this->request->param('casino_name');
|
||||
$ws_url = $this->request->param('ws_url');
|
||||
$pc_video = $this->request->param('pc_video');
|
||||
$wap_video = $this->request->param('wap_video');
|
||||
$is_update = Db::name('system')->where('id',1)->update(['casino_name' => $casino_name,'ws_url' => $ws_url,'pc_video' => $pc_video,'wap_video' => $wap_video]);
|
||||
if($is_update == 1){
|
||||
$msg['status'] = 2;
|
||||
$msg['code'] = '修改成功';
|
||||
}else{
|
||||
$msg['status'] = 1;
|
||||
$msg['code'] = '修改成功';
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user