更新数据库加密相关操作
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
namespace admin\foundation;
|
||||
|
||||
use common\jobs\LogJob;
|
||||
use common\services\DataEncryptor;
|
||||
use Yii;
|
||||
use yii\base\UserException;
|
||||
use yii\helpers\Json;
|
||||
@@ -49,6 +50,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); // 加密指定键值
|
||||
|
||||
Reference in New Issue
Block a user