mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2026-04-03 20:35:19 +08:00
优化代码
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
type HideTipAction struct {
|
||||
@@ -23,7 +23,7 @@ func (this *HideTipAction) RunPost(params struct {
|
||||
// 保存到文件
|
||||
tipJSON, err := json.Marshal(tipKeyMap)
|
||||
if err == nil {
|
||||
_ = ioutil.WriteFile(Tea.ConfigFile(tipConfigFile), tipJSON, 0666)
|
||||
_ = os.WriteFile(Tea.ConfigFile(tipConfigFile), tipJSON, 0666)
|
||||
}
|
||||
|
||||
this.Success()
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/iwind/TeaGo"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ var tipConfigFile = "tip.cache.json"
|
||||
func init() {
|
||||
TeaGo.BeforeStart(func(server *TeaGo.Server) {
|
||||
// 从配置文件中加载已关闭的tips
|
||||
data, err := ioutil.ReadFile(Tea.ConfigFile(tipConfigFile))
|
||||
data, err := os.ReadFile(Tea.ConfigFile(tipConfigFile))
|
||||
if err == nil {
|
||||
var m = map[string]bool{}
|
||||
err = json.Unmarshal(data, &m)
|
||||
|
||||
Reference in New Issue
Block a user