fix queryExample
This commit is contained in:
parent
ab282e4bcc
commit
52e88b1cbf
@ -45,12 +45,15 @@ func (l *QueryExampleLogic) QueryExample(req *types.QueryExampleReq) (resp *type
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "示例报告, 获取示例参数失败, %v", err)
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "示例报告, 获取示例参数失败, %v", err)
|
||||||
}
|
}
|
||||||
// 将字符串类型的QueryParams解析为map[string]interface{}
|
secretKey := l.svcCtx.Config.Encrypt.SecretKey
|
||||||
var queryParams map[string]interface{}
|
key, decodeErr := hex.DecodeString(secretKey)
|
||||||
if err := sonic.Unmarshal([]byte(exampleParams.QueryParams), &queryParams); err != nil {
|
if decodeErr != nil {
|
||||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "示例报告, 解析示例参数失败, %v", err)
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "示例报告, 获取AES解密解药失败, %+v", err)
|
||||||
|
}
|
||||||
|
processParamsErr := ProcessQueryParams(exampleParams.QueryParams, &query.QueryParams, key)
|
||||||
|
if processParamsErr != nil {
|
||||||
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "示例报告, 报告参数处理失败: %v", processParamsErr)
|
||||||
}
|
}
|
||||||
query.QueryParams = queryParams
|
|
||||||
// 查询ProductFeatureModel获取产品相关的功能列表
|
// 查询ProductFeatureModel获取产品相关的功能列表
|
||||||
builder := l.svcCtx.ProductFeatureModel.SelectBuilder().Where("product_id = ?", product.Id)
|
builder := l.svcCtx.ProductFeatureModel.SelectBuilder().Where("product_id = ?", product.Id)
|
||||||
productFeatures, err := l.svcCtx.ProductFeatureModel.FindAll(l.ctx, builder, "")
|
productFeatures, err := l.svcCtx.ProductFeatureModel.FindAll(l.ctx, builder, "")
|
||||||
|
Loading…
Reference in New Issue
Block a user