更新数据库加密相关操作

This commit is contained in:
2025-01-15 13:16:48 +08:00
parent 81069274be
commit 262ecc4f5e
12 changed files with 383 additions and 90 deletions

View File

@@ -6,6 +6,7 @@
namespace common\foundation;
use common\services\DataEncryptor;
use Yii;
use yii\helpers\Json;
@@ -132,6 +133,10 @@ class JsonResponseFormatter extends \yii\web\JsonResponseFormatter
if (is_array($value)) {
$value = self::aseEncode($value); // 递归处理子数组
} else {
// 数据库中加密的方法需要解密
if (in_array($key, \Yii::$app->params['database_ase_list']) && is_encrypted($value)) {
$value = (new DataEncryptor(Yii::$app->params['ase_key']))->decrypt($value);
}
if (in_array($key, \Yii::$app->params['aseList'])) {
if (is_string($key)) {
$value = ase_encode($value); // 加密指定键值