optimize
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user