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
{
//过滤空格
protected $filter = ['trim','htmlspecialchars','strip_tags'];
//protected $filter = ['trim'];
//protected $filter = ['trim','htmlspecialchars','strip_tags'];
//protected $filter = ['trim','htmlspecialchars'];
//protected $filter = ['trim','strip_tags'];
protected $filter = ['trim'];
}

View File

@ -12,20 +12,22 @@ class Sign extends AdminController
//添加签到积分规则
public function add()
{
$data = Request::only(['days','score']);
$day = UserSignrule::where('days',$data['days'])->find();
//$day = Db::name('user_signrule')->where('days',$data['days'])->find();
if($day){
$res = ['code'=>-1,'msg'=>'不能重复设置'];
} else {
$result = UserSignrule::create($data);
if($result){
$res = ['code'=>0,'msg'=>'设置积分成功'];
if(Request::isPost()){
$data = Request::only(['days','score']);
$day = UserSignrule::where('days',(int)$data['days'])->find();
//$day = Db::name('user_signrule')->where('days',$data['days'])->find();
if(!is_null($day)){
$res = ['code'=>-1,'msg'=>'不能重复设置'];
} else {
$res = ['code'=>-1,'msg'=>'保存失败'];
$result = UserSignrule::create($data);
if($result){
$res = ['code'=>0,'msg'=>'设置积分成功'];
} else {
$res = ['code'=>-1,'msg'=>'保存失败'];
}
}
return json($res);
}
return json($res);
}
//删除签到积分规则

View File

@ -117,6 +117,12 @@ class User extends BaseController
if(!$result){
$this->error($validate->getError());
} 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');
if($data['email'] !== $mail){
$data['active'] = 0;

View File

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