gokins/service/db.go
LinskRuis.32G f6e953f37a v1.0.2
2021-07-30 19:23:15 +08:00

22 lines
365 B
Go

package service
import "github.com/gokins/gokins/comm"
func GetIdOrAid(id interface{}, e interface{}) bool {
if id == nil || e == nil {
return false
}
switch id.(type) {
case string:
ids := id.(string)
if ids == "" {
return false
}
}
ok, _ := comm.Db.Where("id=?", id).Get(e)
if !ok {
ok, _ = comm.Db.Where("aid=?", id).Get(e)
}
return ok
}