...
 
Commits (13)
...@@ -17,6 +17,10 @@ func AppIsRelease() bool { ...@@ -17,6 +17,10 @@ func AppIsRelease() bool {
return GetMode() == RELEASE return GetMode() == RELEASE
} }
func AppIsLocal() bool {
return GetMode() == LOCAL
}
//数据库的配置 //数据库的配置
type MysqlConfig struct { type MysqlConfig struct {
MYSQL_HOST string MYSQL_HOST string
......
...@@ -24,7 +24,7 @@ func init() { ...@@ -24,7 +24,7 @@ func init() {
filenamePrefix = logDir + filepath.Base(os.Args[0]) + "." filenamePrefix = logDir + filepath.Base(os.Args[0]) + "."
// stderr日志重定向 // stderr日志重定向
MyLog.SetOutput(os.Stdout) MyLog.SetOutput(os.Stdout)
RewriteStderrFile() //RewriteStderrFile()
if config.AppIsRelease() { if config.AppIsRelease() {
MyLog.SetFormatter(&logrus.JSONFormatter{ MyLog.SetFormatter(&logrus.JSONFormatter{
......
[DATABASE] [DATABASE]
MYSQL_HOST=47.244.34.27:3306 MYSQL_HOST=hk-cynosdbmysql-grp-a3wqck8p.sql.tencentcdb.com:22303
MYSQL_USERNAME=root MYSQL_USERNAME=hilo_test
MYSQL_PASSWORD=yX0jPAhO0I4s2zlA MYSQL_PASSWORD=cPsTMSA9szQ6B9Y2zFXSvpDdduB8kZxC
MYSQL_DB=hilo MYSQL_DB=hilo
[DATABASECODE] [DATABASECODE]
MYSQL_HOST=47.244.34.27:3306 MYSQL_HOST=hk-cynosdbmysql-grp-a3wqck8p.sql.tencentcdb.com:22303
MYSQL_USERNAME=root MYSQL_USERNAME=hilo_test
MYSQL_PASSWORD=yX0jPAhO0I4s2zlA MYSQL_PASSWORD=cPsTMSA9szQ6B9Y2zFXSvpDdduB8kZxC
MYSQL_DB=hilo_code MYSQL_DB=hilo_code
[REDIS] [REDIS]
REDIS_HOST=47.244.34.27:6379 REDIS_HOST=172.19.0.2:6379
REDIS_PASSWORD=8QZ9JD1zLvPR3yHf REDIS_PASSWORD=yPyZH1DYMJhrVQgr
REDIS_CLUSTER_HOST=47.244.34.27:6379 REDIS_CLUSTER_HOST=172.19.0.2:6379
REDIS_CLUSTER_PASSWORD=8QZ9JD1zLvPR3yHf REDIS_CLUSTER_PASSWORD=yPyZH1DYMJhrVQgr
[JWT] [JWT]
SECRET=hilo1632 SECRET=hilo1632
ISSUER_API=hiloApi ISSUER_API=hiloApi
......
[DATABASE] [DATABASE]
MYSQL_HOST=47.244.34.27:3306 MYSQL_HOST=hk-cynosdbmysql-grp-a3wqck8p.sql.tencentcdb.com:22303
MYSQL_USERNAME=root MYSQL_USERNAME=hilo_test
MYSQL_PASSWORD=yX0jPAhO0I4s2zlA MYSQL_PASSWORD=cPsTMSA9szQ6B9Y2zFXSvpDdduB8kZxC
MYSQL_DB=hilo MYSQL_DB=hilo
[DATABASECODE] [DATABASECODE]
MYSQL_HOST=47.244.34.27:3306 MYSQL_HOST=hk-cynosdbmysql-grp-a3wqck8p.sql.tencentcdb.com:22303
MYSQL_USERNAME=root MYSQL_USERNAME=hilo_test
MYSQL_PASSWORD=yX0jPAhO0I4s2zlA MYSQL_PASSWORD=cPsTMSA9szQ6B9Y2zFXSvpDdduB8kZxC
MYSQL_DB=hilo_code MYSQL_DB=hilo_code
[REDIS] [REDIS]
REDIS_HOST=47.244.34.27:6379 REDIS_HOST=43.135.4.137:6379
REDIS_PASSWORD=8QZ9JD1zLvPR3yHf REDIS_PASSWORD=yPyZH1DYMJhrVQgr
REDIS_CLUSTER_HOST=47.244.34.27:6379 REDIS_CLUSTER_HOST=43.135.4.137:6379
REDIS_CLUSTER_PASSWORD=8QZ9JD1zLvPR3yHf REDIS_CLUSTER_PASSWORD=yPyZH1DYMJhrVQgr
[JWT] [JWT]
SECRET=hilo1632 SECRET=hilo1632
ISSUER_API=hiloApi ISSUER_API=hiloApi
......
This diff is collapsed.
...@@ -138,8 +138,9 @@ func (m *UserManager) GetAreaUsers(userIds []uint64, area int8) map[uint64]UserT ...@@ -138,8 +138,9 @@ func (m *UserManager) GetAreaUsers(userIds []uint64, area int8) map[uint64]UserT
// 获取财富等级大于某等级的用户 // 获取财富等级大于某等级的用户
// 开区间 // 开区间
func (m *UserManager) GetLevelUsers(userIds []uint64, wealthLevel int32) map[uint64]UserTinyArea { func (m *UserManager) GetLevelUsers(userIds []uint64, wealthLevel int32) (map[uint64]UserTinyArea, []uint64) {
res := make(map[uint64]UserTinyArea) res := make(map[uint64]UserTinyArea)
var resIds []uint64
// 从db中读,暂时不缓存(几千个) // 从db中读,暂时不缓存(几千个)
var users []UserTinyArea var users []UserTinyArea
if err := m.MysqlDB.Table("user").Joins("JOIN match_wealth_user_score ON match_wealth_user_score.user_id = user.id"). if err := m.MysqlDB.Table("user").Joins("JOIN match_wealth_user_score ON match_wealth_user_score.user_id = user.id").
...@@ -148,7 +149,7 @@ func (m *UserManager) GetLevelUsers(userIds []uint64, wealthLevel int32) map[uin ...@@ -148,7 +149,7 @@ func (m *UserManager) GetLevelUsers(userIds []uint64, wealthLevel int32) map[uin
Where("match_wealth_user_score.grade > ?", wealthLevel). Where("match_wealth_user_score.grade > ?", wealthLevel).
Find(&users).Error; err != nil { Find(&users).Error; err != nil {
mylogrus.MyLog.Errorf("GetLevelUsers fail:%v", err) mylogrus.MyLog.Errorf("GetLevelUsers fail:%v", err)
return res return res, resIds
} }
for _, u := range users { for _, u := range users {
a := m.GetArea(u.Country) a := m.GetArea(u.Country)
...@@ -161,6 +162,7 @@ func (m *UserManager) GetLevelUsers(userIds []uint64, wealthLevel int32) map[uin ...@@ -161,6 +162,7 @@ func (m *UserManager) GetLevelUsers(userIds []uint64, wealthLevel int32) map[uin
Area: a, Area: a,
Avatar: u.Avatar, Avatar: u.Avatar,
} }
resIds = append(resIds, u.ID)
} }
return res return res, resIds
} }
...@@ -136,6 +136,7 @@ message LevelMessage { ...@@ -136,6 +136,7 @@ message LevelMessage {
int32 level = 1; int32 level = 1;
uint32 msgType = 2; uint32 msgType = 2;
bytes payLoad = 3; bytes payLoad = 3;
int32 area = 4;
} }
message LevelMessageRsp { message LevelMessageRsp {
......
[DATABASE] [DATABASE]
MYSQL_HOST=ua4papc3hmgqf351pbej-rw4rm.rwlb.dubai.rds.aliyuncs.com MYSQL_HOST=172.28.16.44
MYSQL_USERNAME=nextvideo MYSQL_USERNAME=hilo_master
MYSQL_PASSWORD=ihlUwI4nhi9W88MI MYSQL_PASSWORD=o8NNd8F7e6On2RqIgOhsy1PsiSxROT3n
MYSQL_DB=hilo MYSQL_DB=hilo
[DATABASECODE] [DATABASECODE]
MYSQL_HOST=ua4papc3hmgqf351pbej-rw4rm.rwlb.dubai.rds.aliyuncs.com MYSQL_HOST=172.28.16.44
MYSQL_USERNAME=nextvideo MYSQL_USERNAME=hilo_master
MYSQL_PASSWORD=ihlUwI4nhi9W88MI MYSQL_PASSWORD=o8NNd8F7e6On2RqIgOhsy1PsiSxROT3n
MYSQL_DB=hilo_code MYSQL_DB=hilo_code
[REDIS] [REDIS]
REDIS_HOST=r-eb3btxn8vfdsuwdbuf.redis.dubai.rds.aliyuncs.com:6379 REDIS_HOST=172.28.16.31:6379
REDIS_PASSWORD= REDIS_PASSWORD=
REDIS_CLUSTER_HOST=r-eb3yt6k8zgxs62kjjs.redis.dubai.rds.aliyuncs.com:6379 REDIS_CLUSTER_HOST=172.28.16.47:6379
REDIS_CLUSTER_PASSWORD= REDIS_CLUSTER_PASSWORD=
[JWT] [JWT]
SECRET=hilo1504 SECRET=hilo1504
......