init: 第一次提交

- 以实现登录获取个人信息和课程
- 实现了获取视频记录
- 实现了学习接口
This commit is contained in:
2026-03-25 22:39:44 +08:00
commit 858c29a799
19 changed files with 1541 additions and 0 deletions

22
pkg/common/rand.go Normal file
View File

@@ -0,0 +1,22 @@
package common
import (
"math/rand"
"time"
)
// Rand 生成指定长度的随机字符串,字符集为 [0-9a-zA-Z]
func Rand(length int) string {
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
seededRand := rand.New(rand.NewSource(time.Now().UnixNano()))
b := make([]byte, length)
for i := range b {
b[i] = charset[seededRand.Intn(len(charset))]
}
return string(b)
}
func RandFloat64() float64 {
return rand.Float64()
}