Skip to content

Commit

Permalink
阿米娅皮肤重复修复
Browse files Browse the repository at this point in the history
  • Loading branch information
IJNKAWAKAZE committed Dec 30, 2024
1 parent 0f8d65a commit f85125d
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/plugins/datasource/update_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,25 @@ func UpdateDataSourceRunner() {
var birthdayMap = make(map[string][]utils.Operator)
for i, operator := range operators {
name := operator.Name
// 新增干员
if _, has := oldOperators[name]; !has && config.IgnoreBirthday[name] == "" {
response, _ := http.Get(api + name)
doc, _ := goquery.NewDocumentFromReader(response.Body)
doc.Find(".poem").Each(func(j int, selection *goquery.Selection) {
text := selection.Text()
if strings.Contains(text, "【生日】") {
t := strings.Split(text, "\n")
birthday := t[5][strings.Index(t[5], "】")+3:]
reg := regexp.MustCompile("[0-9]+")
if reg.MatchString(birthday) {
birthdayMap[birthday] = append(birthdayMap[birthday], operators[i])
} else {
birthdayMap["未知"] = append(birthdayMap["未知"], operators[i])
}
return
}
})
}
if name == "阿米娅" {
// 立绘
for e := 0; e < 2; e++ {
Expand Down Expand Up @@ -139,6 +158,7 @@ func UpdateDataSourceRunner() {
skin.Url = painting
operators[i].Skins = append(operators[i].Skins, skin)
}
continue
} else if name == "阿米娅(近卫)" || name == "阿米娅(医疗)" {
// 立绘
paintingName := fmt.Sprintf("立绘_%s_2.png", name)
Expand All @@ -159,6 +179,7 @@ func UpdateDataSourceRunner() {
skin.Url = painting
operators[i].Skins = append(operators[i].Skins, skin)
}
continue
}
if operator.Rarity < 3 {
// 立绘
Expand Down Expand Up @@ -203,25 +224,6 @@ func UpdateDataSourceRunner() {
operators[i].Skins = append(operators[i].Skins, skin)
}
}
// 新增干员
if _, has := oldOperators[name]; !has && config.IgnoreBirthday[name] == "" {
response, _ := http.Get(api + name)
doc, _ := goquery.NewDocumentFromReader(response.Body)
doc.Find(".poem").Each(func(j int, selection *goquery.Selection) {
text := selection.Text()
if strings.Contains(text, "【生日】") {
t := strings.Split(text, "\n")
birthday := t[5][strings.Index(t[5], "】")+3:]
reg := regexp.MustCompile("[0-9]+")
if reg.MatchString(birthday) {
birthdayMap[birthday] = append(birthdayMap[birthday], operators[i])
} else {
birthdayMap["未知"] = append(birthdayMap["未知"], operators[i])
}
return
}
})
}
}

for k, v := range birthdayMap {
Expand Down

0 comments on commit f85125d

Please sign in to comment.