mirror of https://github.com/veypi/OneAuth.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
633 B
Go
25 lines
633 B
Go
package app_user
|
|
|
|
import (
|
|
"github.com/veypi/vbase/cfg"
|
|
"github.com/veypi/vbase/models"
|
|
"github.com/veypi/vigo"
|
|
)
|
|
|
|
type appUserIDReq struct {
|
|
AppID string `src:"path@app_id" desc:"应用ID"`
|
|
UserID string `src:"path@user_id" desc:"用户ID"`
|
|
}
|
|
|
|
var _ = Router.Get("/{user_id}", "获取应用用户详情", getAppUser)
|
|
|
|
func getAppUser(x *vigo.X, req *appUserIDReq) (*models.AppUser, error) {
|
|
appUser := &models.AppUser{}
|
|
err := cfg.DB().Where("app_id = ? AND user_id = ?", req.AppID, req.UserID).First(appUser).Error
|
|
if err != nil {
|
|
return nil, vigo.NewError("app_user not found").WithCode(404)
|
|
}
|
|
|
|
return appUser, nil
|
|
}
|