|
@@ -11,6 +11,7 @@ import (
|
|
|
credit "qfw/util/credit"
|
|
|
"qfw/util/elastic"
|
|
|
. "qfw/util/mongodb"
|
|
|
+ "qfw/util/redis"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -213,3 +214,30 @@ func SaveTopEmployeeBind(openid, name string) bool {
|
|
|
Update("top_employee", `{"s_name": "`+name+`"}`, `{"$set":{"s_openid":`+openid+`}}`, false, false)
|
|
|
return true
|
|
|
}
|
|
|
+
|
|
|
+//查询我的邀请人数,仅拓普员工自查,排除内部员工微信
|
|
|
+func GetMyInvitePersons(openid string) (total int) {
|
|
|
+ var tpems map[string]interface{}
|
|
|
+ //取拓普员工列表
|
|
|
+ if ems := redis.Get("other", "tp_employees"); ems != nil {
|
|
|
+ tpems, _ = ems.(map[string]interface{})
|
|
|
+ } else {
|
|
|
+ //取拓普员工列表,写入库
|
|
|
+ tpems = make(map[string]interface{})
|
|
|
+ ret := Find("top_employee", nil, nil, `{"s_openid":1}`, false, -1, -1)
|
|
|
+ for _, v := range *ret {
|
|
|
+ tmp := v["s_openid"].(string)
|
|
|
+ tpems[tmp] = 1
|
|
|
+ }
|
|
|
+ redis.Put("other", "tp_employees", tpems, 60*10) //缓存10分钟
|
|
|
+ }
|
|
|
+ //查我的邀请成功记录
|
|
|
+ ret := Find("person_invitelink", `{"s_source_openid":"`+openid+`"}`, nil, `{"s_target_openid":1}`, false, -1, -1)
|
|
|
+ for _, v := range *ret {
|
|
|
+ tmp := v["s_target_openid"].(string)
|
|
|
+ if _, ok := tpems[tmp]; !ok {
|
|
|
+ total++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|