package router import ( "epur-pay/api" "epur-pay/api/login" "epur-pay/cache" "epur-pay/model" "epur-pay/pkg/dapi" ) func RouterAppend(R *model.RouterMethod) []*model.RouterMethod { cache.Global.Routers = append(cache.Global.Routers, R) return cache.Global.Routers } func NewRouterFunc() { RouterAppend( &model.RouterMethod{ Name: "测试", Path: "/test", Child: []*model.RouterMethod{ { Name: "测试", Method: "POST", Path: "/test", Leaf: true, F: api.Test, Params: &dapi.InParams{}, }, { Name: "测试", Method: "POST", Path: "/test1", Leaf: true, F: api.Test1, Params: &dapi.InParams{}, }, { Name: "测试2", Method: "POST", Path: "/test2", Leaf: true, F: api.Test2, Params: &dapi.InParams{}, }, }, }, ) RouterAppend( &model.RouterMethod{ Name: "首页", Path: "/index", Leaf: false, Child: []*model.RouterMethod{ { Name: "菜单列表获取", Path: "/getMenuList", Method: "POST", Leaf: true, F: api.GetMenuList, Params: &dapi.InParams{ IsTicket: true, IsAgentAction: true, }, }, { Name: "用户信息获取", Path: "/permission", Method: "POST", Leaf: true, F: api.GetPermissionList, Params: &dapi.InParams{ IsTicket: true, IsAgentAction: true}, }, }, }, ) RouterAppend( &model.RouterMethod{ Name: "配置", Path: "/config", Child: []*model.RouterMethod{ { Name: "获取配置", Method: "POST", Path: "/get", Leaf: true, F: api.GetPermissionList, Params: &dapi.InParams{ IsSaveLog: true, }, }, }, }, ) RouterAppend( &model.RouterMethod{ Name: "登陆", Path: "/login", Child: []*model.RouterMethod{ { Name: "登陆", Method: "POST", Path: "/login", Leaf: true, F: login.SsoLogin, Params: &dapi.InParams{ IsSaveLog: true, }, }, { Name: "注册", Method: "POST", Path: "/register", Leaf: true, F: login.SsoRegister, Params: &dapi.InParams{ IsSaveLog: true, }, }, { Name: "验证码", Method: "POST", Path: "/captcha", Leaf: true, F: login.SsoSendSmsCode, Params: &dapi.InParams{ IsSaveLog: true, }, }, }, }, ) RouterAppend( &model.RouterMethod{ Name: "登陆", Path: "/user", Child: []*model.RouterMethod{ { Name: "用户信息", Method: "POST", Path: "/info", Leaf: true, F: login.UserInfo, Params: &dapi.InParams{ IsTicket: true, }, }, }, }, ) RouterAppend( &model.RouterMethod{ Name: "支付渠道管理", Path: "/pay_channel", Child: []*model.RouterMethod{ { Name: "列表", Method: "POST", Path: "/get", Leaf: true, F: api.GetPayChannel, Params: &dapi.InParams{ IsTicket: true, }, }, { Name: "添加", Method: "POST", Path: "/add", Leaf: true, F: api.AddPayChannel, Params: &dapi.InParams{ IsTicket: true, IsForUpdate: true, }, }, { Name: "编辑", Method: "POST", Path: "/edit", Leaf: true, F: api.EditPayChannel, Params: &dapi.InParams{ IsTicket: true, IsForUpdate: true, }, }, }, }, ) }