package hook import ( "context" "errors" "wechat-api/ent" ) // CheckDesktopAuth 检查token是否合法同时返回token实例 func CheckDesktopAuth(tokenStr string, client *ent.Client) (*ent.Token, error) { if tokenStr == "" { return nil, errors.New("check auth failed") } token, err := client.Token.Query().Where().Only(context.Background()) if err != nil { return nil, err } return token, nil }