Apply .gitignore rules
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"common/connection"
|
||||
"sync"
|
||||
|
||||
_ "admincenter/internal/admin"
|
||||
_ "common/resultStatus"
|
||||
"common/webServer"
|
||||
)
|
||||
|
||||
var (
|
||||
wg sync.WaitGroup
|
||||
)
|
||||
|
||||
func init() {
|
||||
// 设置WaitGroup需要等待的数量,只要有一个服务器出现错误都停止服务器
|
||||
wg.Add(1)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
//加载配置
|
||||
loadConfig()
|
||||
|
||||
// 启动webserver
|
||||
go webServer.Start(&wg)
|
||||
|
||||
// 阻塞等待,以免main线程退出
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// loadConfig 用于加载配置信息。
|
||||
// 该函数会读取配置文件或环境变量中的设置,并根据这些设置初始化程序所需的配置。
|
||||
// 目前函数的实现为空,需要根据实际的配置加载逻辑进行填充。
|
||||
func loadConfig() {
|
||||
|
||||
//构建数据库
|
||||
connection.BuildDB()
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package managecenterModel
|
||||
|
||||
// 服务器状态
|
||||
type MaintainType int32
|
||||
|
||||
const (
|
||||
// 计划维护
|
||||
Con_MaintainType_PlanMaintain MaintainType = 1
|
||||
|
||||
// 开始维护
|
||||
Con_MaintainType_BeginMaintain MaintainType = 2
|
||||
|
||||
// 结束维护
|
||||
Con_MaintainType_EndMaintain MaintainType = 3
|
||||
)
|
||||
@@ -0,0 +1,66 @@
|
||||
package debugUtil
|
||||
|
||||
import (
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
var (
|
||||
isDebug = false
|
||||
code Code = Code_Bold
|
||||
foregroundColor ForegroundColor = Foreground_Purple
|
||||
backgroundColor BackgroundColor = BackgroundColor_Black
|
||||
|
||||
colorObj = color.New(foregroundColor, code)
|
||||
)
|
||||
|
||||
// 设置DEBUG状态
|
||||
// _isDebug:是否是DEBUG
|
||||
func SetDebug(_isDebug bool) {
|
||||
isDebug = _isDebug
|
||||
}
|
||||
|
||||
// 是否处于调试状态
|
||||
func IsDebug() bool {
|
||||
return isDebug
|
||||
}
|
||||
|
||||
// 设置显示信息
|
||||
func SetDisplayInfo(_code Code, _foregroundColor ForegroundColor, _backgroundColor BackgroundColor) {
|
||||
code = _code
|
||||
foregroundColor = _foregroundColor
|
||||
backgroundColor = _backgroundColor
|
||||
|
||||
colorObj = color.New(foregroundColor, code)
|
||||
}
|
||||
|
||||
// Print formats using the default formats for its operands and writes to standard output.
|
||||
// Spaces are added between operands when neither is a string.
|
||||
// It returns the number of bytes written and any write error encountered.
|
||||
func Print(a ...interface{}) {
|
||||
if !isDebug {
|
||||
return
|
||||
}
|
||||
|
||||
_, _ = colorObj.Print(a...)
|
||||
}
|
||||
|
||||
// Printf formats according to a format specifier and writes to standard output.
|
||||
// It returns the number of bytes written and any write error encountered.
|
||||
func Printf(format string, a ...interface{}) {
|
||||
if !isDebug {
|
||||
return
|
||||
}
|
||||
|
||||
_, _ = colorObj.Printf(format, a...)
|
||||
}
|
||||
|
||||
// Println formats using the default formats for its operands and writes to standard output.
|
||||
// Spaces are always added between operands and a newline is appended.
|
||||
// It returns the number of bytes written and any write error encountered.
|
||||
func Println(a ...interface{}) {
|
||||
if !isDebug {
|
||||
return
|
||||
}
|
||||
|
||||
_, _ = colorObj.Println(a...)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package impl_localfile
|
||||
|
||||
// 包名不能采用中分线,而且前面的包已经说明了是log包,这个子文件夹不需要在加上log
|
||||
Reference in New Issue
Block a user