fix: load balance

This commit is contained in:
Xhofe
2022-03-31 21:52:19 +08:00
parent ced61da33a
commit b52e1e8be3
4 changed files with 33 additions and 15 deletions

View File

@ -33,7 +33,12 @@ func ParsePath(rawPath string) (*model.Account, string, base.Driver, error) {
if !ok {
return nil, "", nil, fmt.Errorf("no [%s] driver", account.Type)
}
return &account, strings.TrimPrefix(rawPath, utils.ParsePath(account.Name)), driver, nil
name := utils.ParsePath(account.Name)
bIndex := strings.LastIndex(name, ".balance")
if bIndex != -1 {
name = name[:bIndex]
}
return &account, strings.TrimPrefix(rawPath, name), driver, nil
}
func ErrorResp(c *gin.Context, err error, code int) {