mirror of
https://gitee.com/gokins/gokins.git
synced 2024-11-29 17:57:50 +08:00
22 lines
365 B
Go
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
|
|
}
|