當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Admin.GetMysqlVer方法代碼示例

本文整理匯總了Golang中github.com/blackmady/NoneCMS/app/models.Admin.GetMysqlVer方法的典型用法代碼示例。如果您正苦於以下問題:Golang Admin.GetMysqlVer方法的具體用法?Golang Admin.GetMysqlVer怎麽用?Golang Admin.GetMysqlVer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/blackmady/NoneCMS/app/models.Admin的用法示例。


在下文中一共展示了Admin.GetMysqlVer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Main

func (c App) Main(admin *models.Admin) revel.Result {

	title := "首頁--GoCMS管理係統"

	UserID := utils.GetSession("UserID", c.Session)

	if len(UserID) > 0 {
		UserID, err := strconv.ParseInt(UserID, 10, 64)
		if err != nil {
			revel.WARN.Println(err)
		}

		admin_info := admin.GetById(UserID)

		//判斷是否是係統的分隔符
		separator := "/"
		if os.IsPathSeparator('\\') {
			separator = "\\"
		} else {
			separator = "/"
		}

		config_file := (revel.BasePath + "/conf/config.conf")
		config_file = strings.Replace(config_file, "/", separator, -1)
		config_conf, _ := config.ReadDefault(config_file)

		system_info := make(map[string]string)

		//版本
		version, _ := config_conf.String("website", "website.version")
		system_info["version"] = version

		//前台網站地址
		sitedomain, _ := config_conf.String("website", "website.sitedomain")
		system_info["sitedomain"] = sitedomain

		//操作係統
		system_info["os"] = strings.ToUpper(runtime.GOOS + " " + runtime.GOARCH)

		//Go版本
		system_info["go_varsion"] = strings.ToUpper(runtime.Version())

		//Revel版本
		system_info["revel_varsion"] = strings.ToUpper("Revel 0.11")

		//MySQL版本
		system_info["mysql_varsion"] = admin.GetMysqlVer()

		//服務器監控
		// memory_info, _ := gopsutil.VirtualMemory()
		// system_info["main_server_total_memory"] = utils.FileSize(int(memory_info.Total))
		// system_info["main_server_free_memory"] = utils.FileSize(int(memory_info.Free))
		// system_info["main_server_available_memory"] = utils.FileSize(int(memory_info.Available))
		// system_info["main_server_UsedPercent_memory"] = fmt.Sprintf("%10.2f%%", memory_info.UsedPercent)

		// host, _ := gopsutil.HostInfo()
		// system_info["main_server_Hostname"] = host.Hostname
		// system_info["main_server_OS"] = host.OS
		// system_info["main_server_Platform"] = host.Platform
		// system_info["main_server_PlatformVersion"] = host.PlatformVersion
		// system_info["main_server_PlatformFamily"] = host.PlatformFamily

		//快捷麵板
		admin_panel := new(models.Admin_Panel)
		panel_list := admin_panel.GetPanelList(admin_info)

		c.Render(title, admin_info, system_info, panel_list)
	} else {
		c.Render(title)
	}

	return c.RenderTemplate("App/Main.html")
}
開發者ID:blackmady,項目名稱:GoCMS,代碼行數:73,代碼來源:app.go


注:本文中的github.com/blackmady/NoneCMS/app/models.Admin.GetMysqlVer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。