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

@@ -39,6 +39,25 @@ func (u *User) OpenID() string {
return u.attr.GetAttrID().(string)
}
func (u *User) Stop() {
u.mx.Lock()
u.attr.SetBool("stop", true)
u.mx.Unlock()
}
func (u *User) Start() {
u.mx.Lock()
u.attr.SetBool("stop", false)
u.mx.Unlock()
}
func (u *User) IsStop() bool {
u.mx.RLock()
stop := u.attr.GetBool("stop")
u.mx.RUnlock()
return stop
}
func (u *User) Codes(isFund bool) []string {
u.mx.RLock()
defer u.mx.RUnlock()
@@ -52,7 +71,10 @@ func (u *User) Codes(isFund bool) []string {
}
var codes []string
attr.ForEachKey(func(key string) bool {
codes = append(codes, key)
sAttr := attr.GetMapAttr(key)
if sAttr.GetBool("notify") {
codes = append(codes, key)
}
return true
})
return codes