From c2591eec44bcf71a9369d66174b053759616abb6 Mon Sep 17 00:00:00 2001 From: liangzai <2440983361@qq.com> Date: Thu, 12 Feb 2026 16:54:09 +0800 Subject: [PATCH] f --- .../api/internal/queue/paySuccessNotify.go | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/app/main/api/internal/queue/paySuccessNotify.go b/app/main/api/internal/queue/paySuccessNotify.go index 9c987a7..6d96e54 100644 --- a/app/main/api/internal/queue/paySuccessNotify.go +++ b/app/main/api/internal/queue/paySuccessNotify.go @@ -160,31 +160,40 @@ func (l *PaySuccessNotifyUserHandler) ProcessTask(ctx context.Context, t *asynq. downloadURL := l.buildAuthorizationDownloadURL(authDoc.FileName) userInfo["authorization_url"] = downloadURL - // 为避免重新写回时再次引入大字段,这里也删除 base64 图片字段 - delete(userInfo, "vlphoto_data") - delete(userInfo, "photo_data") - delete(userInfo, "image_base64") - - // 重新序列化用户信息(已去除大字段) + // 1)完整参数(包含图片和授权书 URL)用于后续调用天远接口 updatedDecryptData, marshalErr := json.Marshal(userInfo) if marshalErr != nil { logx.Errorf("序列化用户信息失败: %v", marshalErr) } else { - // 重新加密更新后的数据 - encryptedUpdatedData, encryptErr := crypto.AesEncrypt(updatedDecryptData, key) - if encryptErr != nil { - logx.Errorf("重新加密用户信息失败: %v", encryptErr) + decryptData = updatedDecryptData + + // 2)精简版本(去掉图片类大字段)仅用于持久化到 query.QueryParams + slimUserInfo := make(map[string]interface{}, len(userInfo)) + for k, v := range userInfo { + slimUserInfo[k] = v + } + delete(slimUserInfo, "vlphoto_data") + delete(slimUserInfo, "photo_data") + delete(slimUserInfo, "image_base64") + + slimUpdatedBytes, marshalSlimErr := json.Marshal(slimUserInfo) + if marshalSlimErr != nil { + logx.Errorf("序列化精简用户信息失败: %v", marshalSlimErr) } else { - // 更新查询记录中的参数 - query.QueryParams = string(encryptedUpdatedData) - updateParamsErr := l.svcCtx.QueryModel.UpdateWithVersion(ctx, nil, query) - if updateParamsErr != nil { - logx.Errorf("更新查询参数失败: %v", updateParamsErr) + // 重新加密精简后的数据写回数据库 + encryptedUpdatedData, encryptErr := crypto.AesEncrypt(slimUpdatedBytes, key) + if encryptErr != nil { + logx.Errorf("重新加密精简用户信息失败: %v", encryptErr) } else { - logx.Infof("成功更新查询参数,包含授权书URL: %s", downloadURL) + query.QueryParams = string(encryptedUpdatedData) + updateParamsErr := l.svcCtx.QueryModel.UpdateWithVersion(ctx, nil, query) + if updateParamsErr != nil { + logx.Errorf("更新查询参数失败: %v", updateParamsErr) + } else { + logx.Infof("成功更新查询参数(已精简),包含授权书URL: %s", downloadURL) + } } } - decryptData = updatedDecryptData } }