This commit is contained in:
2025-10-11 18:35:12 +08:00
parent dc5a7c311c
commit 8d581dc03c
8 changed files with 11 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ type Query {
Id int64 `json:"id"` // 主键ID
OrderId int64 `json:"order_id"` // 订单ID
UserId int64 `json:"user_id"` // 用户ID
Product string `json:"product"` // 产品ID
ProductName string `json:"product_name"` // 产品ID
QueryParams map[string]interface{} `json:"query_params"`
QueryData []QueryItem `json:"query_data"`

View File

@@ -75,7 +75,6 @@ func (l *QueryDetailByOrderIdLogic) QueryDetailByOrderId(req *types.QueryDetailB
var query types.Query
query.CreateTime = queryModel.CreateTime.Format("2006-01-02 15:04:05")
query.UpdateTime = queryModel.UpdateTime.Format("2006-01-02 15:04:05")
// 解密查询数据
secretKey := l.svcCtx.Config.Encrypt.SecretKey
key, decodeErr := hex.DecodeString(secretKey)
@@ -104,6 +103,7 @@ func (l *QueryDetailByOrderIdLogic) QueryDetailByOrderId(req *types.QueryDetailB
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告查询, 获取商品信息失败, %v", err)
}
query.ProductName = product.ProductName
query.Product = product.ProductEn
return &types.QueryDetailByOrderIdResp{
Query: query,
}, nil

View File

@@ -95,6 +95,8 @@ func (l *QueryDetailByOrderNoLogic) QueryDetailByOrderNo(req *types.QueryDetailB
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告查询, 获取商品信息失败, %v", err)
}
query.ProductName = product.ProductName
query.Product = product.ProductEn
return &types.QueryDetailByOrderNoResp{
Query: query,
}, nil

View File

@@ -38,6 +38,7 @@ func (l *QueryExampleLogic) QueryExample(req *types.QueryExampleReq) (resp *type
// 创建一个空的Query结构体来存储结果
query := types.Query{
ProductName: product.ProductName,
Product: product.ProductEn,
QueryData: make([]types.QueryItem, 0),
QueryParams: make(map[string]interface{}),
}

View File

@@ -60,7 +60,7 @@ func (l *QueryListLogic) QueryList(req *types.QueryListReq) (resp *types.QueryLi
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告列表查询, 获取商品信息失败, %+v", err)
}
query.ProductName = product.ProductName
query.Product = product.ProductEn
// 检查订单状态,如果订单已退款,则设置查询状态为已退款
order, findOrderErr := l.svcCtx.OrderModel.FindOne(l.ctx, queryModel.OrderId)
if findOrderErr == nil && order.Status == model.OrderStatusRefunded {

View File

@@ -103,6 +103,7 @@ func (l *QueryShareDetailLogic) QueryShareDetail(req *types.QueryShareDetailReq)
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告查询, 获取商品信息失败, %v", err)
}
query.ProductName = product.ProductName
query.Product = product.ProductEn
return &types.QueryShareDetailResp{
Status: "success",
Query: query,

View File

@@ -1656,6 +1656,7 @@ type Query struct {
Id int64 `json:"id"` // 主键ID
OrderId int64 `json:"order_id"` // 订单ID
UserId int64 `json:"user_id"` // 用户ID
Product string `json:"product"` // 产品ID
ProductName string `json:"product_name"` // 产品ID
QueryParams map[string]interface{} `json:"query_params"`
QueryData []QueryItem `json:"query_data"`

View File

@@ -81,6 +81,9 @@ func TestPasswordHash(t *testing.T) {
if PasswordVerify("wrongpassword", hash) {
t.Errorf("PasswordVerify() 应该验证失败,但验证成功了")
}
// 输出加密后的密码,便于人工检查
t.Logf("原始密码: %s, 加密后: %s", tc.password, hash)
})
}
}