This commit is contained in:
taoser 2021-10-12 16:50:02 +08:00
parent de91c8b1dd
commit 82985869c8
4 changed files with 26 additions and 14 deletions

View File

@ -5,7 +5,9 @@ namespace app;
class Request extends \think\Request class Request extends \think\Request
{ {
//过滤空格 //过滤空格
protected $filter = ['trim','htmlspecialchars','strip_tags']; //protected $filter = ['trim','htmlspecialchars','strip_tags'];
//protected $filter = ['trim']; //protected $filter = ['trim','htmlspecialchars'];
//protected $filter = ['trim','strip_tags'];
protected $filter = ['trim'];
} }

View File

@ -12,10 +12,11 @@ class Sign extends AdminController
//添加签到积分规则 //添加签到积分规则
public function add() public function add()
{ {
if(Request::isPost()){
$data = Request::only(['days','score']); $data = Request::only(['days','score']);
$day = UserSignrule::where('days',$data['days'])->find(); $day = UserSignrule::where('days',(int)$data['days'])->find();
//$day = Db::name('user_signrule')->where('days',$data['days'])->find(); //$day = Db::name('user_signrule')->where('days',$data['days'])->find();
if($day){ if(!is_null($day)){
$res = ['code'=>-1,'msg'=>'不能重复设置']; $res = ['code'=>-1,'msg'=>'不能重复设置'];
} else { } else {
$result = UserSignrule::create($data); $result = UserSignrule::create($data);
@ -27,6 +28,7 @@ class Sign extends AdminController
} }
return json($res); return json($res);
} }
}
//删除签到积分规则 //删除签到积分规则
public function delete($id) public function delete($id)

View File

@ -117,6 +117,12 @@ class User extends BaseController
if(!$result){ if(!$result){
$this->error($validate->getError()); $this->error($validate->getError());
} else { } else {
//防止重复的email
$resEmail = Db::name('user')->where('email',$data['email'])->where('id','<>',$this->uid)->find();
if(!is_null($resEmail)){
return ['code'=>-1,'msg'=>'email已存在,请更换!'];
}
//若更换email需重新激活
$mail = Db::name('user')->where('id',$this->uid)->value('email'); $mail = Db::name('user')->where('id',$this->uid)->value('email');
if($data['email'] !== $mail){ if($data['email'] !== $mail){
$data['active'] = 0; $data['active'] = 0;

View File

@ -29,6 +29,8 @@ return [
'taglib_begin' => '{', 'taglib_begin' => '{',
// 标签库标签结束标记 // 标签库标签结束标记
'taglib_end' => '}', 'taglib_end' => '}',
'default_filter' => 'htmlspecialchars',
//模板输出替换 //模板输出替换
'tpl_replace_string' => [ 'tpl_replace_string' => [
'__STATIC__'=>'/static/layui', '__STATIC__'=>'/static/layui',