From ff6aa8f298ac4add5b311aeff769e46065864852 Mon Sep 17 00:00:00 2001 From: ZJY <764763903@qq.com> Date: Thu, 16 Sep 2021 15:26:46 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=96=B0=E5=A2=9E=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/demo_config.yaml | 1 + controllers/login.go | 2 ++ models/config.go | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/conf/demo_config.yaml b/conf/demo_config.yaml index d37bdd6..0f113bd 100644 --- a/conf/demo_config.yaml +++ b/conf/demo_config.yaml @@ -11,6 +11,7 @@ containers: AtTime: #填写1-12之间的数 填错自负默认为10 10点容易出现高峰超时。 IsHelp: #填写true或者false false IsOldV4: #填写true或者false false是否新版或者旧版V4 +ApiToken: #为空默认随机禁用 theme: static: ./static master: diff --git a/controllers/login.go b/controllers/login.go index ebad7bf..d0329ff 100644 --- a/controllers/login.go +++ b/controllers/login.go @@ -371,6 +371,7 @@ func (c *LoginController) CkLogin() { if !models.HasPin(ptPin) { models.NewJdCookie(ck) result.Message = fmt.Sprintf("添加成功") + result.Data = ck.Query() jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[] if errs != nil { fmt.Println(errs.Error()) @@ -380,6 +381,7 @@ func (c *LoginController) CkLogin() { ck, _ := models.GetJdCookie(ptPin) ck.InPool(ptKey) result.Message = fmt.Sprintf("更新成功") + result.Data = ck.Query() jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[] if errs != nil { fmt.Println(errs.Error()) diff --git a/models/config.go b/models/config.go index 82cd824..fbe3123 100644 --- a/models/config.go +++ b/models/config.go @@ -1,6 +1,7 @@ package models import ( + "github.com/Mrs4s/MiraiGo/utils" "io" "io/ioutil" "os" @@ -34,6 +35,7 @@ type Yaml struct { CTime string `yaml:"AtTime"` IsHelp bool `yaml:"IsHelp"` IsOldV4 bool `yaml:"IsOldV4"` + ApiToken string `yaml:"ApiToken"` Node string Npm string Python string @@ -102,6 +104,9 @@ func initConfig() { if Config.Npm == "" { Config.Npm = "npm" } + if Config.ApiToken == "" { + Config.ApiToken = utils.RandomString(17) + } if Config.Node == "" { Config.Node = "node" }