Modify: clean modals

This commit is contained in:
HFO4
2020-03-11 15:22:21 +08:00
parent 4d70f9fa3e
commit 4ba24e0cf1
30 changed files with 22 additions and 598 deletions

View File

@@ -2,7 +2,6 @@ package hashid
import (
"errors"
"github.com/HFO4/cloudreve/bootstrap/constant"
"github.com/HFO4/cloudreve/pkg/conf"
)
import "github.com/speps/go-hashids"
@@ -62,7 +61,7 @@ func HashID(id uint, t int) string {
// DecodeHashID 计算HashID对应的数据库ID
func DecodeHashID(id string, t int) (uint, error) {
v, _ := HashDecode(id)
if len(v) != 2 || v[1] != constant.HashIDTable[t] {
if len(v) != 2 || v[1] != t {
return 0, ErrTypeNotMatch
}
return uint(v[0]), nil

View File

@@ -1,7 +1,6 @@
package hashid
import (
"github.com/HFO4/cloudreve/bootstrap/constant"
"github.com/stretchr/testify/assert"
"testing"
)
@@ -53,7 +52,6 @@ func TestHashDecode(t *testing.T) {
func TestDecodeHashID(t *testing.T) {
asserts := assert.New(t)
constant.HashIDTable = []int{0, 1, 2, 3, 4, 5}
// 成功
{