|
|
@@ -73,13 +73,12 @@ func handleUserVisitIpAddress(msg []byte) error { |
|
|
|
cacheKeyForUrl := fmt.Sprintf(md.ZhiOsMasterIdForUrlHashMapCacheKey) |
|
|
|
get, _ := cache.HGetString(cacheKeyForUrl, msgStruct.Url) |
|
|
|
if get == "" { |
|
|
|
var domainType string |
|
|
|
if msgStruct.Pvd == "app" || msgStruct.Pvd == "applet" { |
|
|
|
domainType = "api" |
|
|
|
} else { |
|
|
|
domainType = "wap" |
|
|
|
} |
|
|
|
msgStruct.MasterId = GetWebSiteDomainMasterId(domainType, msgStruct.Url) |
|
|
|
msgStruct.MasterId = GetWebSiteDomainMasterId(msgStruct.Url) |
|
|
|
utils.FilePutContents("GetWebSiteDomainMasterId", utils.SerializeStr(msgStruct)) |
|
|
|
cache.HSet(cacheKeyForUrl, msgStruct.Url, msgStruct.MasterId) |
|
|
|
cache.Expire(cacheKeyForUrl, md.ZhiOsUserVisitIpAddressHashMapCacheTime) |
|
|
|
} else { |
|
|
|
msgStruct.MasterId = get |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -147,9 +146,9 @@ func getIpAddress(Db *xorm.Engine, message md.ZhiOsUserVisitIpAddressMessage) (c |
|
|
|
} |
|
|
|
|
|
|
|
// 获取指定类型的域名对应的masterId:admin、wap、api |
|
|
|
func GetWebSiteDomainMasterId(domainType string, host string) string { |
|
|
|
func GetWebSiteDomainMasterId(host string) string { |
|
|
|
obj := new(model.UserAppDomain) |
|
|
|
has, err := db.Db.Where("domain=? and type=?", host, domainType).Get(obj) |
|
|
|
has, err := db.Db.Where("domain=?", host).Get(obj) |
|
|
|
if err != nil || !has { |
|
|
|
return "" |
|
|
|
} |
|
|
|