Browse Source

optimize /admin/login-options

Tao Chen 1 year ago
parent
commit
7082111b34
1 changed files with 1 additions and 8 deletions
  1. 1 8
      http/controller/admin/login.go

+ 1 - 8
http/controller/admin/login.go

@@ -11,7 +11,6 @@ import (
11 11
 	"Gwen/service"
12 12
 	"fmt"
13 13
 	"github.com/gin-gonic/gin"
14
-	"gorm.io/gorm"
15 14
 )
16 15
 
17 16
 type Login struct {
@@ -91,13 +90,7 @@ func (ct *Login) Logout(c *gin.Context) {
91 90
 // @Failure 500 {object} response.ErrorResponse
92 91
 // @Router /admin/login-options [post]
93 92
 func (ct *Login) LoginOptions(c *gin.Context) {
94
-	res := service.AllService.OauthService.List(1, 100, func(tx *gorm.DB) {
95
-		tx.Select("op").Order("id")
96
-	})
97
-	var ops []string
98
-	for _, v := range res.Oauths {
99
-		ops = append(ops, v.Op)
100
-	}
93
+	ops := service.AllService.OauthService.GetOauthProviders()
101 94
 	response.Success(c, gin.H{
102 95
 		"ops":      ops,
103 96
 		"register": global.Config.App.Register,