x
This commit is contained in:
+12
-5
@@ -74,8 +74,8 @@ var GetUserNumber = func() int {
|
|||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func initWebBot() {
|
||||||
core.RegistFuncs["Broadcast2WebUser"] = Broadcast2WebUser
|
if adapter == nil {
|
||||||
adapter = &core.Factory{}
|
adapter = &core.Factory{}
|
||||||
adapter.Init("web", "default")
|
adapter.Init("web", "default")
|
||||||
adapter.SetIsAdmin(func(s string) bool {
|
adapter.SetIsAdmin(func(s string) bool {
|
||||||
@@ -95,10 +95,17 @@ func init() {
|
|||||||
sendWebMessage(&message)
|
sendWebMessage(&message)
|
||||||
return ""
|
return ""
|
||||||
})
|
})
|
||||||
core.GinApi(core.GET, "/api/web_chat", func(ctx *gin.Context) {
|
}
|
||||||
// if adapter == nil {
|
}
|
||||||
|
|
||||||
// }
|
func init() {
|
||||||
|
core.RegistFuncs["Broadcast2WebUser"] = Broadcast2WebUser
|
||||||
|
go func() {
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
initWebBot()
|
||||||
|
}()
|
||||||
|
core.GinApi(core.GET, "/api/web_chat", func(ctx *gin.Context) {
|
||||||
|
initWebBot()
|
||||||
rid := ctx.Query("rid")
|
rid := ctx.Query("rid")
|
||||||
ctt := ctx.Query("ctt")
|
ctt := ctx.Query("ctt")
|
||||||
token, _ := ctx.Cookie("token")
|
token, _ := ctx.Cookie("token")
|
||||||
|
|||||||
+1
-4
@@ -31,7 +31,7 @@ var CarryGroups = MakeBucket("CarryGroups")
|
|||||||
var carryCounter int64
|
var carryCounter int64
|
||||||
|
|
||||||
// LOGIC
|
// LOGIC
|
||||||
func init() {
|
func initCarry() {
|
||||||
AddCommand([]*common.Function{
|
AddCommand([]*common.Function{
|
||||||
{
|
{
|
||||||
Rules: []string{`raw [\s\S]+`},
|
Rules: []string{`raw [\s\S]+`},
|
||||||
@@ -198,10 +198,7 @@ func init() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
// VAR Watch
|
|
||||||
func init() {
|
|
||||||
setCgs()
|
setCgs()
|
||||||
storage.Watch(CarryGroups, nil, func(old, new, key string) *storage.Final {
|
storage.Watch(CarryGroups, nil, func(old, new, key string) *storage.Final {
|
||||||
console.Log("已更新搬运数据")
|
console.Log("已更新搬运数据")
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
var DataHome = utils.GetDataHome()
|
var DataHome = utils.GetDataHome()
|
||||||
|
|
||||||
func Init() {
|
func Init() {
|
||||||
|
|
||||||
sillyGirl = MakeBucket("sillyGirl")
|
sillyGirl = MakeBucket("sillyGirl")
|
||||||
_, err := os.Stat(DataHome)
|
_, err := os.Stat(DataHome)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -27,6 +28,8 @@ func Init() {
|
|||||||
initToHandleMessage()
|
initToHandleMessage()
|
||||||
sillyGirl.Set("compiled_at", compiled_at)
|
sillyGirl.Set("compiled_at", compiled_at)
|
||||||
console.Log("编译版本:%s", compiled_at)
|
console.Log("编译版本:%s", compiled_at)
|
||||||
|
initWeb()
|
||||||
|
initCarry()
|
||||||
sillyGirl.Set("started_at", time.Now().Format("2006-01-02 15:04:05"))
|
sillyGirl.Set("started_at", time.Now().Format("2006-01-02 15:04:05"))
|
||||||
storage.Watch(sillyGirl, "compiled_at", func(old, new, key string) *storage.Final {
|
storage.Watch(sillyGirl, "compiled_at", func(old, new, key string) *storage.Final {
|
||||||
if old != new {
|
if old != new {
|
||||||
@@ -148,4 +151,5 @@ func Init() {
|
|||||||
initWebPluginList()
|
initWebPluginList()
|
||||||
go initPluginList()
|
go initPluginList()
|
||||||
initPluginPublish()
|
initPluginPublish()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -43,7 +43,7 @@ func Cors() gin.HandlerFunc {
|
|||||||
|
|
||||||
var Server *gin.Engine
|
var Server *gin.Engine
|
||||||
|
|
||||||
func init() {
|
func initWeb() {
|
||||||
for _, arg := range os.Args { //处理升级
|
for _, arg := range os.Args { //处理升级
|
||||||
if arg == "-r" { //准备程序->原程序
|
if arg == "-r" { //准备程序->原程序
|
||||||
rfix := ".ready.exe"
|
rfix := ".ready.exe"
|
||||||
@@ -351,13 +351,14 @@ func init() {
|
|||||||
Now: new,
|
Now: new,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
go func() {
|
|
||||||
// logs.Info("Http服务(%s)开始运行", port)
|
// logs.Info("Http服务(%s)开始运行", port)
|
||||||
logs.Info("管理员面板:")
|
logs.Info("管理员面板:")
|
||||||
logs.Info(" > 本机: http://localhost:%s", port)
|
logs.Info(" > 本机: http://localhost:%s", port)
|
||||||
local_ip := getLocalIP()
|
local_ip := getLocalIP()
|
||||||
sillyGirl.Set("local_ip", local_ip)
|
|
||||||
logs.Info(" > 局域网: http://%s:%s", local_ip, port)
|
logs.Info(" > 局域网: http://%s:%s", local_ip, port)
|
||||||
|
sillyGirl.Set("local_ip", local_ip)
|
||||||
|
go func() {
|
||||||
if err := srvs[0].ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
if err := srvs[0].ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||||
logs.Error("Http服务运行失败:%s", err.Error())
|
logs.Error("Http服务运行失败:%s", err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user