Improve fastAutoSignin()

This commit is contained in:
Yang Luo 2023-10-31 16:54:30 +08:00
parent ade9de8256
commit 2398e69012
2 changed files with 6 additions and 2 deletions

View File

@ -54,7 +54,7 @@ type Payment struct {
// Order Info // Order Info
OutOrderId string `xorm:"varchar(100)" json:"outOrderId"` OutOrderId string `xorm:"varchar(100)" json:"outOrderId"`
PayUrl string `xorm:"varchar(2000)" json:"payUrl"` PayUrl string `xorm:"varchar(2000)" json:"payUrl"`
SuccessUrl string `xorm:"varchar(2000)" json:"successUrl""` // `successUrl` is redirected from `payUrl` after pay success SuccessUrl string `xorm:"varchar(2000)" json:"successUrl"` // `successUrl` is redirected from `payUrl` after pay success
State pp.PaymentState `xorm:"varchar(100)" json:"state"` State pp.PaymentState `xorm:"varchar(100)" json:"state"`
Message string `xorm:"varchar(2000)" json:"message"` Message string `xorm:"varchar(2000)" json:"message"`
} }

View File

@ -83,7 +83,11 @@ func fastAutoSignin(ctx *context.Context) (string, error) {
return "", fmt.Errorf(code.Message) return "", fmt.Errorf(code.Message)
} }
res := fmt.Sprintf("%s?code=%s&state=%s", redirectUri, code.Code, state) sep := "?"
if strings.Contains(redirectUri, "?") {
sep = "&"
}
res := fmt.Sprintf("%s%scode=%s&state=%s", redirectUri, sep, code.Code, state)
return res, nil return res, nil
} }