Skip to content

Commit

Permalink
ALPHABET
Browse files Browse the repository at this point in the history
  • Loading branch information
icowan committed Mar 28, 2020
1 parent 60651e5 commit 1c21346
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ func (s *service) Get(ctx context.Context, code string) (redirect *Redirect, err
func (s *service) Post(ctx context.Context, domain string) (redirect *Redirect, err error) {
now := time.Now()
now = now.In(time.Local)
code, _ := shortid.MustNew(0, s.alphabet, 1).Generate()
var code string
if s.alphabet != "" {
code, _ = shortid.MustNew(0, s.alphabet, 1).Generate()
} else {
code = shortid.MustGenerate()
}
// todo 考虑如何处理垃圾数据的问题 得复的url 不同的code

if s.maxLen > 0 {
Expand Down

0 comments on commit 1c21346

Please sign in to comment.