gin-blog/internal/service/auth.go
2021-05-31 17:40:47 +08:00

22 lines
411 B
Go

package service
import "errors"
type AuthRequest struct {
AppKey string `form:"app_key" binding:"required"`
AppSecret string `form:"app_secret" binding:"required"`
}
func (svc *Service) CheckAuth(param *AuthRequest) error {
auth, err := svc.dao.GetAuth(param.AppKey, param.AppSecret)
if err != nil {
return err
}
if auth.ID > 0 {
return nil
}
return errors.New("auth info does not exist")
}