优先去掉忽略的参数
This commit is contained in:
+7
-6
@@ -13,14 +13,14 @@ import (
|
||||
)
|
||||
|
||||
type platform struct {
|
||||
ingoreKeys []string
|
||||
ignoreKeys []string
|
||||
logger loggerx.LoggerInterface
|
||||
}
|
||||
|
||||
func NewPlatform(opts ...Option) *platform {
|
||||
options := newOptions(opts...)
|
||||
return &platform{
|
||||
ingoreKeys: options.ignoreKeys,
|
||||
ignoreKeys: options.ignoreKeys,
|
||||
logger: options.logger,
|
||||
}
|
||||
}
|
||||
@@ -30,12 +30,13 @@ func (l *platform) GetSign(ctx context.Context, signKey string, params map[strin
|
||||
if signKey == "" {
|
||||
return "", ErrorSignKeyIsEmpty
|
||||
}
|
||||
if len(params) == 0 {
|
||||
return "", ErrorSignParamIsEmpty
|
||||
|
||||
for _, val := range l.ignoreKeys {
|
||||
delete(params, val)
|
||||
}
|
||||
|
||||
for _, val := range l.ingoreKeys {
|
||||
delete(params, val)
|
||||
if len(params) == 0 {
|
||||
return "", ErrorSignParamIsEmpty
|
||||
}
|
||||
|
||||
// 排序
|
||||
|
||||
Reference in New Issue
Block a user