|
@@ -28,7 +28,7 @@ var (
|
|
|
firstLoad, firstLoad1 = true, true
|
|
|
mUser = make(map[string]*Called) // 用户
|
|
|
userPhone = make(map[string]string) // 手机号-用户uid
|
|
|
- userPhoneMx sync.Mutex
|
|
|
+ userPhoneMx sync.RWMutex
|
|
|
callPhone []string // 所有被叫手机号
|
|
|
missedPhone = make(map[string]*Voiced) // 所有被叫未接通手机号
|
|
|
)
|
|
@@ -51,7 +51,9 @@ func CountCalled() {
|
|
|
log.Println("CountCalled 通话记录加载结束...")
|
|
|
|
|
|
for _, s := range callPhone {
|
|
|
+ userPhoneMx.RLock()
|
|
|
uid := userPhone[s]
|
|
|
+ userPhoneMx.RUnlock()
|
|
|
if uid != "" {
|
|
|
mUser[uid].frequency += 1
|
|
|
}
|
|
@@ -247,7 +249,9 @@ func getMissedCalls() {
|
|
|
phone := common.ObjToString(ret["CalledNo"])
|
|
|
vdate := strings.Split(common.ObjToString(ret["createTime"]), " ")[0]
|
|
|
ctype := common.ObjToString(ret["State"])
|
|
|
+ userPhoneMx.RLock()
|
|
|
uid := userPhone[phone]
|
|
|
+ userPhoneMx.RUnlock()
|
|
|
if uid != "" {
|
|
|
if ctype != "dealing" {
|
|
|
if missedPhone[uid] != nil {
|