This commit is contained in:
cdle
2021-10-09 18:26:10 +08:00
parent 095162d90c
commit c701f1ddd4
4 changed files with 17 additions and 12 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"github.com/beego/beego/v2/adapter/httplib"
)
var Pushs = map[string]func(int, string){}
var GroupPushs = map[string]func(int, int, string){}
var Pushs = map[string]func(interface{}, string){}
var GroupPushs = map[string]func(interface{}, interface{}, string){}
func Push(class string, uid int, content string) {
if push, ok := Pushs[class]; ok {
+7 -2
View File
@@ -116,11 +116,16 @@ func (bucket Bucket) Foreach(f func(k, v []byte) error) {
})
}
var Int = func(s string) int {
i, _ := strconv.Atoi(s)
var Int = func(s interface{}) int {
i, _ := strconv.Atoi(fmt.Sprint(s))
return i
}
var Int64 = func(s interface{}) int64 {
i, _ := strconv.Atoi(fmt.Sprint(s))
return int64(i)
}
func (bucket Bucket) Create(i interface{}) error {
s := reflect.ValueOf(i).Elem()
id := s.FieldByName("ID")