mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-10-07 09:01:18 +08:00
简化代码
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
"x_admin/core"
|
||||
"x_admin/core/response"
|
||||
"x_admin/middleware"
|
||||
"x_admin/util"
|
||||
@@ -10,15 +9,15 @@ import (
|
||||
)
|
||||
|
||||
func ProtocolRoute(rg *gin.RouterGroup) {
|
||||
db := core.GetDB()
|
||||
// db := core.GetDB()
|
||||
// permSrv := system.NewSystemAuthPermService(db)
|
||||
// roleSrv := system.NewSystemAuthRoleService(db, permSrv)
|
||||
// adminSrv := system.NewSystemAuthAdminService(db, permSrv, roleSrv)
|
||||
// service := system.NewSystemLoginService(db, adminSrv)
|
||||
|
||||
server := NewSettingProtocolService(db)
|
||||
// server := NewSettingProtocolService(db)
|
||||
|
||||
handle := protocolHandler{Service: server}
|
||||
handle := protocolHandler{}
|
||||
|
||||
rg = rg.Group("/setting", middleware.TokenAuth())
|
||||
rg.GET("/protocol/detail", handle.Detail)
|
||||
@@ -26,12 +25,11 @@ func ProtocolRoute(rg *gin.RouterGroup) {
|
||||
}
|
||||
|
||||
type protocolHandler struct {
|
||||
Service ISettingProtocolService
|
||||
}
|
||||
|
||||
// detail 获取政策信息
|
||||
func (ph protocolHandler) Detail(c *gin.Context) {
|
||||
res, err := ph.Service.Detail()
|
||||
res, err := Service.Detail()
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
@@ -41,5 +39,5 @@ func (ph protocolHandler) save(c *gin.Context) {
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &pReq)) {
|
||||
return
|
||||
}
|
||||
response.CheckAndResp(c, ph.Service.Save(pReq))
|
||||
response.CheckAndResp(c, Service.Save(pReq))
|
||||
}
|
||||
|
Reference in New Issue
Block a user