修改自动生成头像在php严格模式下的bug

This commit is contained in:
hdm 2021-02-25 11:36:14 +08:00
parent 356d0df745
commit c3f8bbc9c9
4 changed files with 65 additions and 61 deletions

View File

@ -1,4 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\admin\model;
use think\Model;
@ -47,7 +48,7 @@ class AdminLog extends Model
'Article/post_submit' => '文章',
'Article/delete' => '文章',
'Api/upload' => '附件',
'Login/login_submit'=>'系统'
'Login/login_submit' => '系统',
];
if (!empty($type_array[$type])) {
return $type_array[$type];
@ -65,8 +66,7 @@ class AdminLog extends Model
if (!empty($controller_array[$controller])) {
if ($fun == 'cate_post_submit') {
return '文章分类';
}
else{
} else {
return $controller_array[$controller];
}
} else {

View File

@ -129,7 +129,7 @@ class Login
$param['headimgurl'] = $this->to_avatars($char);
$uid = Db::name('User')->strict(false)->field(true)->insertGetId($param);
add_user_log('reg', $uid, $param);
return to_assign(1, '注册成功', $uid);
return to_assign(1, '注册成功,请登录', $uid);
}
}

View File

@ -235,7 +235,7 @@
if (res.code === 1) {
setTimeout(function () {
window.location.href="{:url('/home/login/index')}";
}, 1500);
}, 2000);
} else {
$('[alt="captcha"]').click();
}

View File

@ -1,5 +1,17 @@
<?php
/*
* Material-Design-Avatars
* https://github.com/lincanbin/Material-Design-Avatars
*
* Copyright 2015 Canbin Lin (lincanbin@hotmail.com)
* http://www.94cb.com/
*
* Licensed under the Apache License, Version 2.0:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Create material deisgn avatars for users just like Gmail or Messager in Android.
*/
declare (strict_types = 1);
namespace avatars;
class MDAvatars
@ -339,15 +351,7 @@ class MDAvatars
$Y = $Height - $Padding - (13 / 196) * $FontSize;
}
// 在圆正中央填入字符
imagettftext($this->Avatar,
$FontSize,
0,
$X,
$Y,
$FontColor,
$this->FontFile,
$this->Char
);
imagettftext($this->Avatar, $FontSize,0,intval($X), intval($Y),$FontColor,$this->FontFile, $this->Char);
}
private function Resize($TargetSize)