feat: 开始计划web管理

This commit is contained in:
johlanse 2022-02-16 15:10:38 +08:00
parent f0744edbe8
commit b990d7856f
3 changed files with 18 additions and 7 deletions

View File

@ -30,6 +30,12 @@ type Config struct {
ChatID int64 `json:"chat_id" yaml:"chat_id"`
Proxy string `json:"proxy" yaml:"proxy"`
} `json:"tg" yaml:"tg"`
Web struct {
Account string `json:"account"`
Password string `json:"password"`
Host string `json:"host"`
Port int `json:"port"`
} `json:"web"`
Cron string `json:"cron"`
}
@ -42,6 +48,11 @@ var (
//go:embed config_default.yml
var defaultConfig []byte
// GetConfig
/**
* @Description:
* @return Config
*/
func GetConfig() Config {
file, err := os.ReadFile("./config/config.yml")
if err != nil {

View File

@ -11,14 +11,14 @@ import (
)
type Score struct {
TotalScore int
TodayScore int
Content map[string]Data
TotalScore int `json:"total_score"`
TodayScore int `json:"today_score"`
Content map[string]Data `json:"content"`
}
type Data struct {
CurrentScore int
MaxScore int
CurrentScore int `json:"current_score"`
MaxScore int `json:"max_score"`
}
func GetUserScore(cookies []Cookie) (Score, error) {

View File

@ -313,8 +313,8 @@ func study(bot *Telegram, args []string) {
defer datas.Delete(u)
core.Init()
defer core.Quit()
core.LearnArticle(cookies)
core.LearnVideo(cookies)
go core.LearnArticle(cookies)
go core.LearnVideo(cookies)
WaitStudy(&User{Cookies: cookies})
core.RespondDaily(cookies, "daily")
core.RespondDaily(cookies, "weekly")