parent
d4ed409963
commit
0cd10f2211
@ -0,0 +1,15 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/taoshihan1991/imaptool/models"
|
||||
)
|
||||
|
||||
func GetRoleList(c *gin.Context){
|
||||
roles:=models.FindRoles()
|
||||
c.JSON(200, gin.H{
|
||||
"code": 200,
|
||||
"msg": "获取成功",
|
||||
"result":roles,
|
||||
})
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package models
|
||||
type Role struct{
|
||||
Id string `json:"role_id"`
|
||||
Name string `json:"role_name"`
|
||||
}
|
||||
func FindRoles()[]Role{
|
||||
var roles []Role
|
||||
DB.Order("id desc").Find(&roles)
|
||||
return roles
|
||||
}
|
Loading…
Reference in new issue