mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 07:08:02 +00:00
feat(backend): improve pickup code generation with retry logic for Redis storage
This commit is contained in:
@@ -78,8 +78,17 @@ func CreateShareInfo(c echo.Context) error {
|
||||
})
|
||||
var pickupCode string
|
||||
if r.Config.HasPickupCode {
|
||||
pickupCode = utils.GeneratePickupCode()
|
||||
models.SetRedisPickupData(pickupCode, id)
|
||||
for {
|
||||
pickupCode = utils.GeneratePickupCode()
|
||||
ok, err := models.SetRedisPickupData(pickupCode, id)
|
||||
if err != nil {
|
||||
return utils.HTTPErrorHandler(c, err)
|
||||
}
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if r.Type == models.ShareTypeFile {
|
||||
|
||||
Reference in New Issue
Block a user