fix DecryptParams
This commit is contained in:
@@ -54,7 +54,7 @@ type ApiApplicationService interface {
|
||||
EncryptParams(ctx context.Context, userID string, cmd *commands.EncryptCommand) (string, error)
|
||||
|
||||
// 解密参数接口
|
||||
DecryptParams(ctx context.Context, userID string, cmd *commands.DecryptCommand) (map[string]interface{}, error)
|
||||
DecryptParams(ctx context.Context, userID string, cmd *commands.DecryptCommand) (interface{}, error)
|
||||
|
||||
// 获取表单配置
|
||||
GetFormConfig(ctx context.Context, apiCode string) (*dto.FormConfigResponse, error)
|
||||
@@ -890,7 +890,7 @@ func (s *ApiApplicationServiceImpl) EncryptParams(ctx context.Context, userID st
|
||||
}
|
||||
|
||||
// DecryptParams 解密参数
|
||||
func (s *ApiApplicationServiceImpl) DecryptParams(ctx context.Context, userID string, cmd *commands.DecryptCommand) (map[string]interface{}, error) {
|
||||
func (s *ApiApplicationServiceImpl) DecryptParams(ctx context.Context, userID string, cmd *commands.DecryptCommand) (interface{}, error) {
|
||||
// 1. 使用前端传来的SecretKey进行解密
|
||||
decryptedData, err := crypto.AesDecrypt(cmd.EncryptedData, cmd.SecretKey)
|
||||
if err != nil {
|
||||
@@ -898,8 +898,8 @@ func (s *ApiApplicationServiceImpl) DecryptParams(ctx context.Context, userID st
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 2. 将解密后的JSON字节数组转换为map
|
||||
var result map[string]interface{}
|
||||
// 2. 将解密后的JSON字节数组转换为通用结构
|
||||
var result interface{}
|
||||
err = json.Unmarshal(decryptedData, &result)
|
||||
if err != nil {
|
||||
s.logger.Error("反序列化解密数据失败", zap.Error(err))
|
||||
|
||||
Reference in New Issue
Block a user