Пример #1
0
func (c Servers) Index(serverId string) revel.Result {
	user := c.SessionGetUser()
	servers := models.SelectServerListByUserId(user.UserId)
	var server = models.Server{}
	if serverId != "" {
		server = models.SelectServerOneByServerId(serverId)
	} else {
		if len(servers) > 0 {
			server = servers[0]
		}
	}

	jsonBody := models.Api{}
	// json.Unmarshal([]byte(server.Content), &jsonBody)
	json.Unmarshal([]byte(server.Content), &jsonBody)
	var admin bool = true
	return c.Render(servers, jsonBody, server, admin)
}
Пример #2
0
func (c Servers) List() revel.Result {
	user := c.SessionGetUser()
	servers := models.SelectServerListByUserId(user.UserId)
	return c.Render(servers)
}