活动模块,计划任务模块 加入第三方

This commit is contained in:
ayflying
2025-02-28 12:12:03 +08:00
parent 6d2b68a202
commit e9540d0971
103 changed files with 4258 additions and 74 deletions

View File

@@ -1,6 +1,7 @@
package utility
import (
"github.com/ayflying/utility_go/tools"
"math/rand"
"time"
)
@@ -22,7 +23,7 @@ var Rand = rands{
// 权重是数组中相应元素的值。该函数通过计算累积和来确定选择的索引。
// 参数 v 是一个泛型参数,限制为实现了 Number 接口的类型。
// 返回值是一个整数,表示在数组中的索引。
func RandByArrInt[v Number](s []v) int {
func RandByArrInt[v tools.Number](s []v) int {
sv := 0
for i := range s {
sv += int(s[i])