Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

参数过滤bug #29

Open
Liway opened this issue Jun 28, 2021 · 0 comments
Open

参数过滤bug #29

Liway opened this issue Jun 28, 2021 · 0 comments

Comments

@Liway
Copy link

Liway commented Jun 28, 2021

func cacheKey(_ url: String, _ params: Dictionary<String, Any>?, _ dynamicParams: Dictionary<String, Any>?) -> String {
/// c参数重复, params中过滤掉dynamicParams中的参数
if let filterParams = params?.filter({ (key, _) -> Bool in
return dynamicParams?.contains(where: { (key1, _) -> Bool in
return key != key1
}) ?? false
}) {
let str = "(url)" + "(sort(filterParams))"
return MD5(str)
} else {
return MD5(url)
}
}

contains方法命中就会停止本次循环,不能使用!=

MQZHot pushed a commit that referenced this issue Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant