1 Star 0 Fork 0

虎不拉 / waomao

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
index.go 1.98 KB
一键复制 编辑 原始数据 按行查看 历史
虎不拉 提交于 2022-12-29 14:31 . V0.0.1.5 增加前后端登录功能
package groupadmin
import (
"gitee.com/hubula/waomao/common"
"gitee.com/hubula/waomao/conf"
"gitee.com/hubula/waomao/services"
"gitee.com/hubula/waomao/web/viewsmodels"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/mvc"
)
type IndexController struct {
Ctx iris.Context
ServiceADemo services.ADemoService
}
var (
pathModels = "groupadmin"
)
//Get http://localhost:8080/groupadmin
func (c *IndexController) Get() mvc.Result {
pages, layout := common.MuBanPaths(c.Ctx.Request(), "", conf.MbAPath, pathModels, "index.html")
urlpath := c.Ctx.Request().URL.String()
return mvc.View{
Name: pages,
Data: iris.Map{
"Title": "后台管理",
"__Form__": urlpath,
"hhua": "gan" + conf.GroupadminKey + conf.GroupadminVal,
},
Layout: layout,
}
}
func (c *IndexController) PostTologin() {
sess := conf.Sess.Start(c.Ctx)
cant := c.Ctx.PostValue("Cant")
//开发阶段判断,如果为 dev true 直接赋值 admin用户的session ,方便开发
if conf.AdminOpen {
//设置Session
adm1 := &viewsmodels.AdminSession{
Uid: 88,
Username: "guanliyuan",
Now: 0,
Ip: "",
Sign: "",
}
common.LoginSessionSet(c.Ctx, "aadmin_cantkey", adm1)
common.Redirect(c.Ctx.ResponseWriter(), conf.HomePage+"/groupadmin/manager?form=/groupadmin/manager/member/ltom")
return
}
if len(cant) > 11 {
if cant == "189881212222" {
sess.Set("tologin_ck", string("true"))
common.Redirect(c.Ctx.ResponseWriter(), conf.HomePage+"/groupadmin/manager/member/login?cant=gopditlgnrmgan"+conf.GroupadminKey+conf.GroupadminVal)
} else {
common.Redirect(c.Ctx.ResponseWriter(), conf.HomePage+c.Ctx.URLParam("form"))
}
} else {
if cant == "18988" {
sess.Set("tologin_ck", string("true"))
common.Redirect(c.Ctx.ResponseWriter(), conf.HomePage+"/groupadmin/manager/member/login?cant=gopditlgnrmgan"+conf.GroupadminKey+conf.GroupadminVal)
} else {
common.Redirect(c.Ctx.ResponseWriter(), conf.HomePage+c.Ctx.URLParam("form"))
}
}
}
Go
1
https://gitee.com/hubula/waomao.git
git@gitee.com:hubula/waomao.git
hubula
waomao
waomao
ad2cf945125e

搜索帮助