cache

This commit is contained in:
微凉
2021-10-27 18:59:03 +08:00
parent fb7e67724d
commit 9644cc98c3
13 changed files with 743 additions and 29 deletions

View File

@ -23,10 +23,18 @@ func SaveAccount(ctx *fiber.Ctx) error {
if !ok {
return ErrorResp(ctx, fmt.Errorf("no [%s] driver", req.Type), 400)
}
old, ok := model.GetAccount(req.Name)
if err := model.SaveAccount(req); err != nil {
return ErrorResp(ctx, err, 500)
} else {
driver.Save(req)
if ok {
err = driver.Save(&req, &old)
}else {
err = driver.Save(&req, nil)
}
if err != nil {
return ErrorResp(ctx,err,500)
}
return SuccessResp(ctx)
}
}