This commit is contained in:
2021-12-22 19:09:04 +08:00
parent 0ac81a4405
commit 4e0cb3c02c
9 changed files with 126 additions and 72 deletions

View File

@@ -15,7 +15,6 @@ package user
import (
"github.com/jageros/hawox/attribute"
"github.com/jageros/hawox/logx"
"stock/module"
"sync"
)
@@ -66,7 +65,7 @@ func GetUser(openId string) (*User, error) {
return us, nil
}
func ForEachUser(f func(u module.IUser) bool) {
func ForEachUser(f func(u *User) bool) {
mx.Lock()
defer mx.Unlock()
for _, u := range users {
@@ -78,7 +77,10 @@ func ForEachUser(f func(u module.IUser) bool) {
func Codes(isFund bool) []string {
var codes = map[string]struct{}{}
ForEachUser(func(u module.IUser) bool {
ForEachUser(func(u *User) bool {
if u.IsStop() {
return true
}
cds := u.Codes(isFund)
for _, cd := range cds {
if _, ok := codes[cd]; ok {