更新处理器
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package processors
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// ValidateParamsAndCallTianyuan 校验入参后按天远产品编号转发
|
||||
func ValidateParamsAndCallTianyuan(ctx context.Context, deps *ProcessorDependencies, tianyuanProductCode string, params []byte, dest interface{}) ([]byte, error) {
|
||||
if err := json.Unmarshal(params, dest); err != nil {
|
||||
return nil, errors.Join(ErrSystem, err)
|
||||
}
|
||||
if err := deps.Validator.ValidateStruct(dest); err != nil {
|
||||
return nil, errors.Join(ErrInvalidParam, err)
|
||||
}
|
||||
return CallTianyuanByProduct(ctx, deps, tianyuanProductCode, params)
|
||||
}
|
||||
Reference in New Issue
Block a user