|
|
@@ -2,6 +2,7 @@ package valid
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
+ "reflect"
|
|
|
"strings"
|
|
|
|
|
|
"github.com/gogf/gf/errors/gerror"
|
|
|
@@ -17,6 +18,17 @@ func init() {
|
|
|
|
|
|
func IntInChecker(ctx context.Context, rule string, value interface{}, message string, data interface{}) error {
|
|
|
// rule int-in:1,2
|
|
|
+ // fmt.Println(rule, value, value == nil)
|
|
|
+ if value == nil {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ reflectValue := reflect.ValueOf(value)
|
|
|
+ if reflectValue.Kind() == reflect.Ptr {
|
|
|
+ if reflectValue.IsNil() {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
v := gconv.String(value)
|
|
|
allow := strings.Split(rule, ":")
|
|
|
if len(allow) < 2 {
|