c
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1156,9 +1156,10 @@ type BindMobileResp struct {
|
||||
}
|
||||
|
||||
type Commission struct {
|
||||
ProductName string `json:"product_name"`
|
||||
Amount float64 `json:"amount"`
|
||||
CreateTime string `json:"create_time"`
|
||||
ProductName string `json:"product_name"`
|
||||
Amount float64 `json:"amount"`
|
||||
CreateTime string `json:"create_time"`
|
||||
QueryParams map[string]interface{} `json:"query_params,omitempty"`
|
||||
}
|
||||
|
||||
type CreateMenuReq struct {
|
||||
|
||||
Reference in New Issue
Block a user