feat: 实现应用管理功能并重构API结构
- 新增应用管理页面,支持创建、查看、搜索和删除应用 - 重构API结构,将auth和app相关接口分离到独立模块 - 实现应用列表过滤和短ID生成功能 - 优化路由守卫和全局消息提示 - 更新登录页面样式和表单验证逻辑
This commit is contained in:
21
pkg/util/identity.go
Normal file
21
pkg/util/identity.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
const (
|
||||
// 短ID字符集(纯数字)
|
||||
shortIDChars = "0123456789"
|
||||
// 短ID长度
|
||||
shortIDLength = 6
|
||||
)
|
||||
|
||||
// GenerateShortID 生成短ID
|
||||
func GenerateShortID() string {
|
||||
b := make([]byte, shortIDLength)
|
||||
for i := range b {
|
||||
b[i] = shortIDChars[rand.Intn(len(shortIDChars))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
Reference in New Issue
Block a user