访问饿了么API,获取结账必要信息。
This commit is contained in:
15
business/util/Contain.go
Normal file
15
business/util/Contain.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 判断obj是否在target中,target支持的类型arrary,slice
|
||||||
|
func ContainForInt64Arry(obj int64, target []int64) (bool, error) {
|
||||||
|
for _, value := range target {
|
||||||
|
if value == obj {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false, errors.New("not in array")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user