优化
This commit is contained in:
@@ -12,9 +12,14 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type User struct{ service *service.SystemService }
|
||||
type User struct {
|
||||
service *service.UserService
|
||||
auth *service.AuthService
|
||||
}
|
||||
|
||||
func NewUser(service *service.SystemService) *User { return &User{service: service} }
|
||||
func NewUser(user *service.UserService, auth *service.AuthService) *User {
|
||||
return &User{service: user, auth: auth}
|
||||
}
|
||||
|
||||
func (h *User) List(c *gin.Context) {
|
||||
var req dto.UserListRequest
|
||||
@@ -155,7 +160,7 @@ func (h *User) SwitchAuthority(c *gin.Context) {
|
||||
httpx.Fail(c, "参数错误")
|
||||
return
|
||||
}
|
||||
login, err := h.service.SwitchAuthority(c.Request.Context(), claims.ID, req.AuthorityID)
|
||||
login, err := h.auth.SwitchAuthority(c.Request.Context(), claims.ID, req.AuthorityID)
|
||||
if err != nil {
|
||||
httpx.Fail(c, err.Error())
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user