f
This commit is contained in:
@@ -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 {
|
||||
// 重新加密精简后的数据写回数据库
|
||||
encryptedUpdatedData, encryptErr := crypto.AesEncrypt(slimUpdatedBytes, key)
|
||||
if encryptErr != nil {
|
||||
logx.Errorf("重新加密精简用户信息失败: %v", encryptErr)
|
||||
} else {
|
||||
// 更新查询记录中的参数
|
||||
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)
|
||||
logx.Infof("成功更新查询参数(已精简),包含授权书URL: %s", downloadURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
decryptData = updatedDecryptData
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user