ci: fix bug in WeChat payment provider

This commit is contained in:
UsherFall
2023-05-26 21:26:41 +08:00
parent 80e6e7f0a7
commit 7fc697b711
11 changed files with 126 additions and 68 deletions

View File

@ -23,3 +23,15 @@ func getPriceString(price float64) string {
priceString := strings.TrimRight(strings.TrimRight(fmt.Sprintf("%.2f", price), "0"), ".")
return priceString
}
func joinAttachString(tokens []string) string {
return strings.Join(tokens, "|")
}
func parseAttachString(s string) (string, string, string, error) {
tokens := strings.Split(s, "|")
if len(tokens) != 3 {
return "", "", "", fmt.Errorf("parseAttachString() error: len(tokens) expected 3, got: %d", len(tokens))
}
return tokens[0], tokens[1], tokens[2], nil
}