This commit is contained in:
18278715334
2025-12-24 15:55:45 +08:00
parent 7038573a41
commit e1fdf7e77f
5 changed files with 33 additions and 7 deletions

View File

@@ -2,8 +2,11 @@ package agent
import (
"context"
"encoding/hex"
"encoding/json"
"tydata-server/common/ctxdata"
"tydata-server/common/xerr"
"tydata-server/pkg/lzkit/crypto"
"github.com/Masterminds/squirrel"
"github.com/jinzhu/copier"
@@ -61,6 +64,29 @@ func (l *GetAgentCommissionLogic) GetAgentCommission(req *types.GetCommissionReq
}
commission.CreateTime = agentCommissionModel.CreateTime.Format("2006-01-02 15:04:05")
commission.ProductName = product.ProductName
queryModel, queryErr := l.svcCtx.QueryModel.FindOneByOrderId(l.ctx, agentCommissionModel.OrderId)
if queryErr == nil && queryModel != nil {
key := l.svcCtx.Config.Encrypt.SecretKey
keyBytes, decodeErr := hex.DecodeString(key)
if decodeErr != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "获取代理佣金列表, %v", err)
}
// 根据订单号查询query表获取query_params
decryptedData, decryptErr := crypto.AesDecrypt(queryModel.QueryParams, keyBytes)
if decryptErr != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "获取代理佣金列表, %v", err)
}
// 解析query_params从JSON字符串转换为map
if queryModel.QueryParams != "" {
var queryParamsMap map[string]interface{}
if unmarshalErr := json.Unmarshal(decryptedData, &queryParamsMap); unmarshalErr == nil {
commission.QueryParams = queryParamsMap
}
}
}
list = append(list, commission)
}
}