add 新增IsHelp参数 默认false 默认不填充助力码需要的自己开

This commit is contained in:
ZJY 2021-09-14 00:35:41 +08:00
parent 300f238786
commit 8255ff6c74
3 changed files with 44 additions and 40 deletions

View File

@ -9,6 +9,7 @@ containers:
mode: parallel
limit: 9999
AtTime: #填写1-12之间的数 填错自负默认为10 10点容易出现高峰超时。
IsHelp: #填写true或者false false
theme:
static: ./static
master:

View File

@ -32,6 +32,7 @@ type Yaml struct {
DailyAssetPushCron string `yaml:"daily_asset_push_cron"`
Version string `yaml:"version"`
CTime string `yaml:"AtTime"`
IsHelp bool `yaml:"IsHelp"`
Node string
Npm string
Python string

View File

@ -128,47 +128,49 @@ func (c *Container) write(cks []JdCookie) error {
}
}
c.request("/api/envs", POST, fmt.Sprintf(`[%s]`, strings.Join(hh, ",")))
type AutoGenerated struct {
Code int `json:"code"`
Data []struct {
Value string `json:"value"`
ID string `json:"_id"`
Created int64 `json:"created"`
Status int `json:"status"`
Timestamp string `json:"timestamp"`
Position float64 `json:"position"`
Name string `json:"name"`
Remarks string `json:"remarks,omitempty"`
} `json:"data"`
}
help := getQLHelp(len(cks))
for k := range help {
var data, err = c.request("/api/envs?searchValue=" + k)
a := AutoGenerated{}
err = json.Unmarshal(data, &a)
if err != nil {
continue
}
toDelete := []string{}
for _, env := range a.Data {
toDelete = append(toDelete, fmt.Sprintf("\"%s\"", env.ID))
}
if len(toDelete) > 0 {
c.request("/api/envs", DELETE, fmt.Sprintf(`[%s]`, strings.Join(toDelete, ",")))
}
}
for k, v := range help {
if v == "" {
v = "&"
}
r := map[string]string{
"name": k,
"value": v,
}
d, _ := json.Marshal(r)
c.request("/api/envs", POST, fmt.Sprintf(`[%s]`, string(d)))
}
if Config.IsHelp {
type AutoGenerated struct {
Code int `json:"code"`
Data []struct {
Value string `json:"value"`
ID string `json:"_id"`
Created int64 `json:"created"`
Status int `json:"status"`
Timestamp string `json:"timestamp"`
Position float64 `json:"position"`
Name string `json:"name"`
Remarks string `json:"remarks,omitempty"`
} `json:"data"`
}
help := getQLHelp(len(cks))
for k := range help {
var data, err = c.request("/api/envs?searchValue=" + k)
a := AutoGenerated{}
err = json.Unmarshal(data, &a)
if err != nil {
continue
}
toDelete := []string{}
for _, env := range a.Data {
toDelete = append(toDelete, fmt.Sprintf("\"%s\"", env.ID))
}
if len(toDelete) > 0 {
c.request("/api/envs", DELETE, fmt.Sprintf(`[%s]`, strings.Join(toDelete, ",")))
}
}
for k, v := range help {
if v == "" {
v = "&"
}
r := map[string]string{
"name": k,
"value": v,
}
d, _ := json.Marshal(r)
c.request("/api/envs", POST, fmt.Sprintf(`[%s]`, string(d)))
}
}
}
} else {
if len(c.Delete) > 0 {