This commit is contained in:
cdle 2021-08-17 22:21:30 +08:00
parent 648d97ca24
commit 92ebe5152d

View File

@ -113,20 +113,18 @@ func initContainer() {
func (c *Container) write(cks []JdCookie) error {
switch c.Type {
case "ql":
if c.Version == "2.8" {
if len(c.Delete) > 0 {
c.request("/api/envs", DELETE, fmt.Sprintf(`[%s]`, strings.Join(c.Delete, ",")))
}
d := ""
hh := []string{}
if len(cks) != 0 {
for _, ck := range cks {
if ck.Available == True {
d += fmt.Sprintf("pt_key=%s;pt_pin=%s;\\n", ck.PtKey, ck.PtPin)
hh = append(hh, fmt.Sprintf(`{"name":"JD_COOKIE","value":"pt_key=%s;pt_pin=%s;","remarks":"%s"}`, ck.PtKey, ck.PtPin, ck.Note))
}
}
c.request("/api/envs", POST, `{"name":"JD_COOKIE","value":"`+d+`"}`)
c.request("/api/envs", POST, fmt.Sprintf(`[%s]`, strings.Join(hh, ",")))
type AutoGenerated struct {
Code int `json:"code"`
Data []struct {
@ -165,7 +163,7 @@ func (c *Container) write(cks []JdCookie) error {
"value": v,
}
d, _ := json.Marshal(r)
c.request("/api/envs", POST, string(d))
c.request("/api/envs", POST, fmt.Sprintf(`[%s]`, string(d)))
}
}