初始化

This commit is contained in:
2026-08-08 18:28:49 +08:00
parent 9bef4420e0
commit f082037a6e
854 changed files with 217171 additions and 11 deletions
+20
View File
@@ -0,0 +1,20 @@
/**
* 密码哈希函数(使用 bcrypt,兼容旧版 MD5)
* @deprecated 请使用 app\models\Employee::hashPassword()
*/
function md5_pwd($pwd) {
return password_hash($pwd, PASSWORD_BCRYPT, ['cost' => 12]);
}
/**
* 验证密码(兼容旧版 MD5
* @deprecated 请使用 app\models\Employee::validateLogin()
*/
function verify_pwd($pwd, $hash) {
// 判断是否为 bcryptbcrypt 哈希以 $2y$ 开头)
if (substr($hash, 0, 4) === '$2y$') {
return password_verify($pwd, $hash);
}
// 兼容旧版 MD5
return md5($pwd) === $hash;
}