Exemplo n.º 1
0
func (p *Login) LogoutExec(c *gin.Context) {
	session, _, tx, ctx := util.GetSessionLogin(c, "logout")
	defer dfweb.ErrorRecover(c, tx)
	session.SetDelFlag(1)
	bhv.SessionBhv_I.Update(session, tx, ctx)
	c.JSON(200, dfweb.SetSingleFetchResult("OK"))
}
Exemplo n.º 2
0
func (p *SysTable) Exec() {
	p.session, p.login, p.tx, p.ctx = util.GetSessionLogin(p.context, "sysTable")
	defer dfweb.ErrorRecover(p.context, p.tx)
	json := dfweb.GetBodyJson(p.context)
	operationType := (json["operationType"]).(string)
	var data map[string]interface{}
	if df.GetType(json["data"])[0:3] == "map" {
		data = (json["data"]).(map[string]interface{})
	}
	var id float64
	if df.GetType(json["data"]) == "float64" {
		id = (json["data"]).(float64)
	}
	switch operationType {
	case "fetch":
		p.Fetch(data)
	case "add":
		p.Insert(data)
	case "update":
		p.Update(data)
	case "remove":
		p.Delete(id)
	case "getdbs":
		p.GetDbs()
	default:
		panic("SysTable operationType が無効です。 :" + operationType)
	}
}
Exemplo n.º 3
0
func (p *Customer) Exec() {
	p.session, p.login, p.tx, p.ctx = util.GetSessionLogin(p.context, "godbfexan")
	defer dfweb.ErrorRecover(p.context, p.tx)
	json := dfweb.GetBodyJson(p.context)
	transactions := json["transactions"]
	if transactions != nil {
		p.Transaction(transactions.([]interface{}))
		return
	}
	operationType := (json["operationType"]).(string)
	var data map[string]interface{}
	if df.GetType(json["data"])[0:3] == "map" {
		data = (json["data"]).(map[string]interface{})
	}
	var id float64
	if df.GetType(json["data"]) == "float64" {
		id = (json["data"]).(float64)
	}
	switch operationType {
	case "fetch":
		p.Fetch(data)
	case "add":
		p.Insert(data)
	case "update":
		p.Update(data)
	case "remove":
		p.Delete(id)
	default:
		panic("Customer operationType が無効です。 :" + operationType)
	}
}
Exemplo n.º 4
0
func GenerateAuthorizedScreen(
	c *gin.Context, title string, js []string, jslib []string, css []string, script []string) {
	defer func() {
		errx := recover()
		if errx != nil {
			c.String(200, errx.(string))
		}
	}()
	screen := GetScreen(c)
	session, login, tx, _ := util.GetSessionLogin(c, "web")
	if util.CheckAuth(screen, session, login, tx) == false {
		panic("この画面は権限がありません。")
	}
	scripts := util.CreateScript(login, script)
	html := createHtml(title, js, jslib, css, scripts)
	c.Header("Content-Type", "text/html")
	c.String(200, html)
}