...
 
Commits (68)
...@@ -3,7 +3,7 @@ package country_e ...@@ -3,7 +3,7 @@ package country_e
import "git.hilo.cn/hilo-common/resource/mysql" import "git.hilo.cn/hilo-common/resource/mysql"
// 国家角色 // 国家角色
type CountryMgrRole mysql.Type type CountryMgrRole uint8
const ( const (
// 国家管理员 // 国家管理员
......
package groupPower_e
import "git.hilo.cn/hilo-common/resource/mysql"
type GroupPowerGrade int
const (
GroupPowerGrade0 GroupPowerGrade = 0 // 青铜
GroupPowerGrade1 GroupPowerGrade = 1 // 白银
GroupPowerGrade2 GroupPowerGrade = 2 // 黄金
GroupPowerGrade3 GroupPowerGrade = 3 // 黑金
GroupPowerGradeMax = GroupPowerGrade3
)
var (
GroupPowerGradeExp = map[GroupPowerGrade]mysql.Num{
GroupPowerGrade0: 0,
GroupPowerGrade1: 2500000,
GroupPowerGrade2: 15000000,
GroupPowerGrade3: 60000000,
}
)
type GroupPowerPrivilege int
const (
GroupPowerPrivilegeMemberNum GroupPowerPrivilege = 1 // 成员数
GroupPowerPrivilegeMgrNum GroupPowerPrivilege = 2 // 管理员数
GroupPowerPrivilegeNameplate GroupPowerPrivilege = 3 // 家族铭牌
GroupPowerPrivilegeMedal GroupPowerPrivilege = 4 // 家族徽章装饰
GroupPowerPrivilegeNameplateEdit GroupPowerPrivilege = 5 // 编辑铭牌
GroupPowerPrivilegeNameplateHeadwear GroupPowerPrivilege = 6 // 家族头饰
)
package groupPower_e
type GroupPowerStarType int
const (
GroupPowerStarTypeFamous GroupPowerStarType = 1 // 送礼
GroupPowerStarTypeActive GroupPowerStarType = 2 // 活跃
GroupPowerStarTypeCharm GroupPowerStarType = 3 // 收礼
)
func IsGroupPowerStarType(t GroupPowerStarType) bool {
if t != GroupPowerStarTypeFamous && t != GroupPowerStarTypeActive && t != GroupPowerStarTypeCharm {
return false
}
return true
}
...@@ -131,6 +131,8 @@ const ( ...@@ -131,6 +131,8 @@ const (
NewUserRegisterPush2 = 45 // 邀请朋友来Hilo,最高获得100,000钻石奖励! NewUserRegisterPush2 = 45 // 邀请朋友来Hilo,最高获得100,000钻石奖励!
NewUserRegisterPush3 = 46 // 举办首个活动,领取10,000钻石和35%奖杯奖励! NewUserRegisterPush3 = 46 // 举办首个活动,领取10,000钻石和35%奖杯奖励!
ActFruitPutRankAward = 47 // 水果机投入排行榜提醒领奖 ActFruitPutRankAward = 47 // 水果机投入排行榜提醒领奖
GroupPowerUpgrade = 48 // 家族升级
GroupPowerExpireNotice = 49 // 家族等级即将过期(每月20日)
) )
type MsgSysUserType = mysql.Type type MsgSysUserType = mysql.Type
......
...@@ -3,12 +3,16 @@ package cron ...@@ -3,12 +3,16 @@ package cron
import ( import (
"git.hilo.cn/hilo-common/resource/config" "git.hilo.cn/hilo-common/resource/config"
"hilo-group/cron/gift_cron" "hilo-group/cron/gift_cron"
"hilo-group/cron/group_cron"
"hilo-group/cron/mic_cron"
) )
func Init() { func Init() {
if !config.IsMaster() { if !config.IsMaster() {
return return
} }
gift_cron.SendGiftEventInit() // 礼物消息 gift_cron.SendGiftEventInit() // 礼物消息
gift_cron.GiftRemark() // 礼物消息补偿 gift_cron.GiftRemark() // 礼物消息补偿
mic_cron.OnMicCheck() // 检查上麦
group_cron.GroupPowerExpClear() // 清理家族经验/等级
} }
package group_cron
import (
"git.hilo.cn/hilo-common/domain"
"github.com/robfig/cron"
"hilo-group/domain/event/group_power_ev"
"hilo-group/domain/model/groupPower_m"
)
// 清理家族经验和等级
func GroupPowerExpClear() {
c := cron.New()
// 每月1号0:00经验值清零
spec := "0 0 0 1 * ?"
_ = c.AddFunc(spec, func() {
var model = domain.CreateModelNil()
if err := groupPower_m.ClearGroupPowerExp(model); err != nil {
model.Log.Errorf("ClearGroupPowerExp fail:%v", err)
}
})
// 每分钟清理过期家族等级
spec = "0 * * * * ?"
_ = c.AddFunc(spec, func() {
var model = domain.CreateModelNil()
if err := groupPower_m.ClearGroupPowerGrade(model); err != nil {
model.Log.Errorf("ClearGroupPowerGrade fail:%v", err)
}
})
// 每月20号发家族即将过期通知
spec = "0 0 0 20 * ?"
_ = c.AddFunc(spec, func() {
var model = domain.CreateModelNil()
_ = group_power_ev.PublishGroupPowerExpireNotice(model, &group_power_ev.GroupPowerExpireNoticeEvent{})
})
c.Start()
}
package mic_cron
import (
"git.hilo.cn/hilo-common/domain"
"github.com/robfig/cron"
"hilo-group/domain/event/mic_ev"
"hilo-group/domain/model/group_m"
)
func OnMicCheck() {
c := cron.New()
//一分钟执行一次
spec := "0 */1 * * * ?"
_ = c.AddFunc(spec, func() {
//获取麦上的所有人
var model = domain.CreateModelNil()
groupIds, err := group_m.GetMicHasInGroups()
if err != nil {
model.Log.Errorf("cron micIn GetMicHasInGroups err:%v", err)
return
}
for _, groupId := range groupIds {
//遍历每个麦位
for i := 1; i <= 30; i++ {
micUser, err := group_m.GetMicUser(model, groupId, i)
if err != nil {
model.Log.Errorf("cron micIn group_m.GetMicUser err:%v", err)
}
if micUser != nil {
if err := mic_ev.PublishOnMicEvent(model, &mic_ev.OnMicEvent{
GroupUuid: micUser.GroupUuid,
I: micUser.I,
ExternalId: micUser.ExternalId,
UserId: micUser.UserId,
Forbid: micUser.Forbid,
Timestamp: micUser.Timestamp,
}); err != nil {
model.Log.Errorf("PublishOnMicEvent fail:%v", err)
}
}
}
}
})
c.Start()
}
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/utils" "git.hilo.cn/hilo-common/utils"
"hilo-group/_const/enum/game_e" "hilo-group/_const/enum/game_e"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/_const/enum/group_e" "hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/online_e" "hilo-group/_const/enum/online_e"
"hilo-group/cv/billboard_cv" "hilo-group/cv/billboard_cv"
...@@ -60,14 +61,23 @@ type MemberListInfo struct { ...@@ -60,14 +61,23 @@ type MemberListInfo struct {
// AppMemberDefinedData": [ // 群成员自定义字段 【暂时不用】 // AppMemberDefinedData": [ // 群成员自定义字段 【暂时不用】
} }
type GroupPower struct {
Id uint64 `json:"id"` // 群主所在的势力ID
Name string `json:"name"` // 群主所在的势力的名称
Nameplate string `json:"nameplate"` // 势力铭牌
Grade groupPower_e.GroupPowerGrade `json:"grade"` // 等级
}
type GroupInfo struct { type GroupInfo struct {
GroupBasicInfo GroupBasicInfo
// hilo业务 // hilo业务
EntryLevel uint32 `json:"entryLevel"` // obsolete EntryLevel uint32 `json:"entryLevel"` // obsolete
HasOnMic bool `json:"hasOnMic"` // 房间麦上是否有人 HasOnMic bool `json:"hasOnMic"` // 房间麦上是否有人
GroupPowerId uint64 `json:"groupPowerId"` // 群主所在的势力ID GroupPowerId uint64 `json:"groupPowerId"` // 群主所在的势力ID
GroupPowerName string `json:"groupPowerName"` // 群主所在的势力的名称 GroupPowerName string `json:"groupPowerName"` // 群主所在的势力的名称
GroupPowerNameplate string `json:"groupPowerNameplate"` // 势力铭牌
GroupPower GroupPower `json:"groupPower"` // 势力信息
// "AppDefinedData": 群组维度的自定义字段 【暂时不用】 // "AppDefinedData": 群组维度的自定义字段 【暂时不用】
MemberList []MemberListInfo MemberList []MemberListInfo
...@@ -312,7 +322,7 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [ ...@@ -312,7 +322,7 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
for _, i := range groupIds { for _, i := range groupIds {
owners = append(owners, groupInfo[i].Owner) owners = append(owners, groupInfo[i].Owner)
} }
powerIds, powerNames, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
} }
...@@ -388,9 +398,16 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [ ...@@ -388,9 +398,16 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
MicNumType: int(g.MicNumType), MicNumType: int(g.MicNumType),
GroupMedals: medals, GroupMedals: medals,
}, },
HasOnMic: len(micUsers) > 0, HasOnMic: len(micUsers) > 0,
GroupPowerId: powerIds[g.Owner], GroupPowerId: powerIds[g.Owner],
GroupPowerName: powerNames[g.Owner], GroupPowerName: powerNames[g.Owner],
GroupPowerNameplate: powerNameplates[g.Owner],
GroupPower: GroupPower{
Id: powerIds[g.Owner],
Name: powerNames[g.Owner],
Nameplate: powerNameplates[g.Owner],
Grade: powerGrades[g.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[i]), RoomUserCount: uint(roomCount[i]),
......
...@@ -232,28 +232,37 @@ func GetCvGroupPowerUsers(groupPowerId uint64) ([]mysql.ID, error) { ...@@ -232,28 +232,37 @@ func GetCvGroupPowerUsers(groupPowerId uint64) ([]mysql.ID, error) {
return usreIds, nil return usreIds, nil
} }
func BatchGetGroupPower(db *gorm.DB, userIds []uint64) (map[uint64]uint64, map[uint64]string, error) { // return userId->powerId userId->powerName userId->powerNameplate
func BatchGetGroupPower(db *gorm.DB, userIds []uint64) (map[uint64]uint64, map[uint64]string, map[uint64]string, map[uint64]groupPower_e.GroupPowerGrade, error) {
if len(userIds) <= 0 { if len(userIds) <= 0 {
return nil, nil, nil return nil, nil, nil, nil, nil
} }
groupPowers, err := groupPower_m.GetGroupPowerMap(db, userIds) groupPowers, err := groupPower_m.GetGroupPowerMap(db, userIds)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, nil, nil, err
} }
gpIds := make([]uint64, 0) gpIds := make([]uint64, 0)
for _, i := range groupPowers { for _, i := range groupPowers {
gpIds = append(gpIds, i) gpIds = append(gpIds, i)
} }
powerNames, err := groupPower_m.GetGroupPowerNames(db, gpIds) powerNames, powerNameplates, err := groupPower_m.GetGroupPowerNames(db, gpIds)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, nil, nil, err
}
groupPowerGrade, err := groupPower_m.MGetGroupPowerGrade(domain.CreateModelNil(), gpIds)
if err != nil {
return nil, nil, nil, nil, err
} }
groupPowerNames := make(map[mysql.ID]string, 0) groupPowerNames := make(map[mysql.ID]string, 0)
groupPowerNameplates := make(map[mysql.ID]string, 0)
groupPowerGrades := make(map[mysql.ID]groupPower_e.GroupPowerGrade, 0)
for i, g := range groupPowers { for i, g := range groupPowers {
groupPowerNames[i] = powerNames[g] groupPowerNames[i] = powerNames[g]
groupPowerNameplates[i] = powerNameplates[g]
groupPowerGrades[i] = groupPowerGrade[g].Grade
} }
return groupPowers, groupPowerNames, nil return groupPowers, groupPowerNames, groupPowerNameplates, groupPowerGrades, nil
} }
//获取国家势力的所有用户数量 //获取国家势力的所有用户数量
......
package group_power_cv
import (
"hilo-group/_const/enum/groupPower_e"
"hilo-group/cv/user_cv"
)
// 家族信息
type CvGroupPowerInfo struct {
CvGroupPowerBase `json:",inline"`
CvGroupPowerMember `json:",inline"`
CvGroupPowerGrade `json:",inline"`
}
// 家族基本信息
type CvGroupPowerBase struct {
Id uint64 `json:"id"` // 家族id
Icon string `json:"icon"` // 家族图片
Name string `json:"name"` // 家族名
Nameplate string `json:"nameplate"` // 铭牌
}
// 家族成员
type CvGroupPowerMember struct {
MemberNum uint32 `json:"memberNum"` // 当前成员数
MemberMax uint32 `json:"memberMax"` // 成员上限
}
// 家族等级
type CvGroupPowerGrade struct {
Grade groupPower_e.GroupPowerGrade `json:"grade"` // 等级 0:青铜 1:白银 2:黄金 3:黑金
Exp uint32 `json:"exp"` // 经验值
NextExp uint32 `json:"nextExp,omitempty"` // 下个等级所需经验值
ExpireAt string `json:"expireAt,omitempty"` // 有效期
}
// 家族榜单
type CvGroupPowerRank struct {
MyGroupPower *CvGroupPowerRankData `json:"myGroupPower,omitempty"` // 我的家族排名
Items []CvGroupPowerRankData `json:"items"` // 列表
}
type CvGroupPowerRankData struct {
CvGroupPowerBase `json:",inline"`
CvGroupPowerGrade `json:",inline"`
Rank int `json:"rank"` // 排名
}
// 家族之星
type CvGroupPowerStarData struct {
User user_cv.CvUserTiny `json:"user"`
Score uint32 `json:"score"` // 对应分值
}
// 资源等级
type CvResGrade struct {
Grade groupPower_e.GroupPowerGrade `json:"grade"` // 等级
Icon string `json:"icon"` // 等级icon
BigIcon string `json:"bigIcon"` // 等级大图标
}
// 特权信息
type CvPrivilege struct {
Type groupPower_e.GroupPowerPrivilege `json:"type"` // 特权id 1:成员数 2:管理员数 3:家族铭牌 4:家族徽章装饰 5:编辑铭牌 6:家族头饰
Num int `json:"num"` // 数目
}
// 家族等级页
type CvGroupPowerGradeDetail struct {
GroupPowerBase CvGroupPowerBase `json:"groupPowerBase"` // 家族基本信息
GroupPowerGrade CvGroupPowerGrade `json:"groupPowerGrade"` // 家族等级信息
ResGradeList []CvResGrade `json:"resGradeList"` // 资源等级列表,青铜、白银、黄金、黑金
PrivilegeList []CvPrivilege `json:"privilegeList"` // 等级特权
IsMember bool `json:"isMember"` // 是否家族成员
}
var CvResGradeList = []CvResGrade{
{groupPower_e.GroupPowerGrade0, "青铜icon", "青铜bigIcon"}, // todo
{groupPower_e.GroupPowerGrade1, "白银icon", "白银bigIcon"}, // todo
{groupPower_e.GroupPowerGrade2, "黄金icon", "黄金bigIcon"}, // todo
{groupPower_e.GroupPowerGrade3, "黑金icon", "黑金bigIcon"}, // todo
}
var GroupPowerGradePrivilegeNum = map[groupPower_e.GroupPowerGrade][]CvPrivilege{
groupPower_e.GroupPowerGrade0: {
{groupPower_e.GroupPowerPrivilegeMemberNum, 300},
{groupPower_e.GroupPowerPrivilegeMgrNum, 10},
{groupPower_e.GroupPowerPrivilegeNameplate, 1},
{groupPower_e.GroupPowerPrivilegeMedal, 1},
},
groupPower_e.GroupPowerGrade1: {
{groupPower_e.GroupPowerPrivilegeMemberNum, 500},
{groupPower_e.GroupPowerPrivilegeMgrNum, 15},
{groupPower_e.GroupPowerPrivilegeNameplate, 1},
{groupPower_e.GroupPowerPrivilegeMedal, 1},
{groupPower_e.GroupPowerPrivilegeNameplateEdit, 1},
},
groupPower_e.GroupPowerGrade2: {
{groupPower_e.GroupPowerPrivilegeMemberNum, 800},
{groupPower_e.GroupPowerPrivilegeMgrNum, 20},
{groupPower_e.GroupPowerPrivilegeNameplate, 1},
{groupPower_e.GroupPowerPrivilegeMedal, 1},
{groupPower_e.GroupPowerPrivilegeNameplateEdit, 1},
{groupPower_e.GroupPowerPrivilegeNameplateHeadwear, 1},
},
groupPower_e.GroupPowerGrade3: {
{groupPower_e.GroupPowerPrivilegeMemberNum, 1200},
{groupPower_e.GroupPowerPrivilegeMgrNum, 25},
{groupPower_e.GroupPowerPrivilegeNameplate, 1},
{groupPower_e.GroupPowerPrivilegeMedal, 1},
{groupPower_e.GroupPowerPrivilegeNameplateEdit, 1},
{groupPower_e.GroupPowerPrivilegeNameplateHeadwear, 1},
},
}
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"git.hilo.cn/hilo-common/rpc" "git.hilo.cn/hilo-common/rpc"
. "git.hilo.cn/hilo-common/utils" . "git.hilo.cn/hilo-common/utils"
"gorm.io/gorm" "gorm.io/gorm"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/_const/enum/group_e" "hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/user_e" "hilo-group/_const/enum/user_e"
"hilo-group/cv/country_cv" "hilo-group/cv/country_cv"
...@@ -61,12 +62,20 @@ type CvUserDetail struct { ...@@ -61,12 +62,20 @@ type CvUserDetail struct {
CurrentRoom string `json:"currentRoom"` // 当前用户所在房间(产品叫“群组”) CurrentRoom string `json:"currentRoom"` // 当前用户所在房间(产品叫“群组”)
MyGroupPower uint64 `json:"myGroupPower"` // 当前用户所在势力 MyGroupPower uint64 `json:"myGroupPower"` // 当前用户所在势力
MyGroupPowerName string `json:"myGroupPowerName"` // 当前用户所在势力绑定群组的名称 MyGroupPowerName string `json:"myGroupPowerName"` // 当前用户所在势力绑定群组的名称
GroupPower GroupPower `json:"groupPower"` // 当前用户势力信息
GroupId string `json:"groupId"` // 当前用户拥有的群组id(产品叫“群组”),如果没有则为空,拥有多个,返回第一个 GroupId string `json:"groupId"` // 当前用户拥有的群组id(产品叫“群组”),如果没有则为空,拥有多个,返回第一个
PhoneInfo *user_m.UserPhoneInfo `json:"phoneInfo"` // 用户绑定的手机信息 PhoneInfo *user_m.UserPhoneInfo `json:"phoneInfo"` // 用户绑定的手机信息
ThirdList []int8 `json:"thirdList"` // 用户绑定的第三方平台列表;类型 1:phone, 2:google, 3:facebook 4:apple 5:wechat" Enums(1,2,3,4,5) ThirdList []int8 `json:"thirdList"` // 用户绑定的第三方平台列表;类型 1:phone, 2:google, 3:facebook 4:apple 5:wechat" Enums(1,2,3,4,5)
CountryManager *country_cv.CVCountryManager `json:"countryManager,omitempty"` // 国家管理员 CountryManager *country_cv.CVCountryManager `json:"countryManager,omitempty"` // 国家管理员
} }
type GroupPower struct {
Id uint64 `json:"id"` // 群主所在的势力ID
Name string `json:"name"` // 群主所在的势力的名称
Nameplate string `json:"nameplate"` // 势力铭牌
Grade groupPower_e.GroupPowerGrade `json:"grade"` // 等级
}
type CvUserTiny struct { type CvUserTiny struct {
Id uint64 `json:"id,omitempty"` Id uint64 `json:"id,omitempty"`
ExternalId string `json:"externalId"` ExternalId string `json:"externalId"`
...@@ -290,6 +299,7 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID ...@@ -290,6 +299,7 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
} }
model.Log.Infof("getUserDetails: %+v", rooms) model.Log.Infof("getUserDetails: %+v", rooms)
// userId->groupPowerId
groupPowers, err := groupPower_m.GetGroupPowerMap(mysql.Db, userIds) groupPowers, err := groupPower_m.GetGroupPowerMap(mysql.Db, userIds)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -299,13 +309,25 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID ...@@ -299,13 +309,25 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
for _, i := range groupPowers { for _, i := range groupPowers {
gpIds = append(gpIds, i) gpIds = append(gpIds, i)
} }
powerNames, err := groupPower_m.GetGroupPowerNames(mysql.Db, gpIds) powerNames, _, err := groupPower_m.GetGroupPowerNames(mysql.Db, gpIds)
if err != nil {
return nil, err
}
groupPowerInfoMap, err := groupPower_m.MGetGroupPowerInfoMap(model, gpIds)
if err != nil {
return nil, err
}
groupPowerGradeMap, err := groupPower_m.MGetGroupPowerGrade(model, gpIds)
if err != nil { if err != nil {
return nil, err return nil, err
} }
groupPowerNames := make(map[mysql.ID]string, 0) groupPowerNames := make(map[mysql.ID]string, 0)
for i, g := range groupPowers { groupPowerInfos := make(map[mysql.ID]groupPower_m.GroupPowerInfo)
groupPowerNames[i] = powerNames[g] groupPowerGrades := make(map[mysql.ID]groupPower_m.GroupPowerGrade)
for uid, gid := range groupPowers {
groupPowerNames[uid] = powerNames[gid]
groupPowerInfos[uid] = groupPowerInfoMap[gid]
groupPowerGrades[uid] = groupPowerGradeMap[gid]
} }
up := user_m.UserProperty{} up := user_m.UserProperty{}
...@@ -350,7 +372,7 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID ...@@ -350,7 +372,7 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
cvUserDetail, err := userToDetail(users[i], myUserId, userTradeUnion, likeMap, likeMeMap, rels, cvUserDetail, err := userToDetail(users[i], myUserId, userTradeUnion, likeMap, likeMeMap, rels,
vips[users[i].ID] != nil, vips[users[i].ID], svips[users[i].ID], headwear, ride, vips[users[i].ID] != nil, vips[users[i].ID], svips[users[i].ID], headwear, ride,
wealthGradeMap, charmGradeMap, activeGradeMap, medals, medalInfo, rooms, groupPowers, groupPowerNames, nobles, superManagerMap) wealthGradeMap, charmGradeMap, activeGradeMap, medals, medalInfo, rooms, groupPowers, groupPowerNames, groupPowerInfos, groupPowerGrades, nobles, superManagerMap)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -370,7 +392,7 @@ func userToDetail(user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.U ...@@ -370,7 +392,7 @@ func userToDetail(user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.U
likeMeMap map[mysql.ID]bool, hvMap map[mysql.ID]Relation, isVip bool, vipExpireTime *int64, svip rpc.CvSvip, headwear *headwear_cv.CvHeadwear, ride property_cv.CvProperty, likeMeMap map[mysql.ID]bool, hvMap map[mysql.ID]Relation, isVip bool, vipExpireTime *int64, svip rpc.CvSvip, headwear *headwear_cv.CvHeadwear, ride property_cv.CvProperty,
wealthGradeMap map[mysql.ID]uint32, charmGradeMap map[mysql.ID]uint32, actityGradeMap map[mysql.ID]uint32, wealthGradeMap map[mysql.ID]uint32, charmGradeMap map[mysql.ID]uint32, actityGradeMap map[mysql.ID]uint32,
medals map[uint64][]uint32, medalInfo map[uint64][]medal_cv.CvMedal, rooms map[mysql.ID]string, medals map[uint64][]uint32, medalInfo map[uint64][]medal_cv.CvMedal, rooms map[mysql.ID]string,
powers map[mysql.ID]uint64, powerNames map[mysql.ID]string, nobles map[mysql.ID]noble_m.UserNoble, superManagerMap map[uint64]bool) (*CvUserDetail, error) { powers map[mysql.ID]uint64, powerNames map[mysql.ID]string, groupPowerInfos map[mysql.ID]groupPower_m.GroupPowerInfo, powerGrades map[mysql.ID]groupPower_m.GroupPowerGrade, nobles map[mysql.ID]noble_m.UserNoble, superManagerMap map[uint64]bool) (*CvUserDetail, error) {
cvUserDetail := &CvUserDetail{ cvUserDetail := &CvUserDetail{
CvUserBase: CvUserBase{ CvUserBase: CvUserBase{
Id: &user.ID, Id: &user.ID,
...@@ -510,6 +532,12 @@ func userToDetail(user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.U ...@@ -510,6 +532,12 @@ func userToDetail(user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.U
cvUserDetail.CurrentRoom = rooms[user.ID] cvUserDetail.CurrentRoom = rooms[user.ID]
cvUserDetail.MyGroupPower = powers[user.ID] cvUserDetail.MyGroupPower = powers[user.ID]
cvUserDetail.MyGroupPowerName = powerNames[user.ID] cvUserDetail.MyGroupPowerName = powerNames[user.ID]
cvUserDetail.GroupPower = GroupPower{
Id: groupPowerInfos[user.ID].ID,
Name: groupPowerInfos[user.ID].Name,
Nameplate: groupPowerInfos[user.ID].Nameplate,
Grade: powerGrades[user.ID].Grade,
}
if n, ok := nobles[user.ID]; ok && n.Level > 0 { if n, ok := nobles[user.ID]; ok && n.Level > 0 {
cvUserDetail.Noble = noble_cv.CvNoble{ cvUserDetail.Noble = noble_cv.CvNoble{
Level: n.Level, Level: n.Level,
...@@ -670,6 +698,8 @@ func GetUserDetail(model *domain.Model, userId mysql.ID, myUserId mysql.ID) (*Cv ...@@ -670,6 +698,8 @@ func GetUserDetail(model *domain.Model, userId mysql.ID, myUserId mysql.ID) (*Cv
} }
powers := map[mysql.ID]uint64{userId: groupPowerId} powers := map[mysql.ID]uint64{userId: groupPowerId}
powerNames := map[mysql.ID]string{userId: groupPowerName} powerNames := map[mysql.ID]string{userId: groupPowerName}
groupPowerInfos, err := groupPower_m.MGetGroupPowerInfoMap(model, []mysql.ID{groupPowerId})
groupPowerGrades, err := groupPower_m.MGetGroupPowerGrade(model, []mysql.ID{groupPowerId})
up := user_m.UserProperty{} up := user_m.UserProperty{}
rides, err := up.BatchGet(mysql.Db, []uint64{userId}) rides, err := up.BatchGet(mysql.Db, []uint64{userId})
...@@ -759,14 +789,14 @@ func GetUserDetail(model *domain.Model, userId mysql.ID, myUserId mysql.ID) (*Cv ...@@ -759,14 +789,14 @@ func GetUserDetail(model *domain.Model, userId mysql.ID, myUserId mysql.ID) (*Cv
return userToDetailOne(model, &user, myUserId, userTradeUnion, likeN > 0, likeMe > 0, return userToDetailOne(model, &user, myUserId, userTradeUnion, likeN > 0, likeMe > 0,
rel, isVip, expireTime, svip, headwear, ride, wealthUserScore.Grade, charmUserScore.Grade, rel, isVip, expireTime, svip, headwear, ride, wealthUserScore.Grade, charmUserScore.Grade,
activityUserScore.Grade, medals[userId], medalInfo[userId], rooms[userId], powers[userId], powerNames[userId], activityUserScore.Grade, medals[userId], medalInfo[userId], rooms[userId], powers[userId], powerNames[userId], groupPowerInfos[groupPowerId].Nameplate, groupPowerGrades[groupPowerId],
noble, superManagerMap[userId], myGroups, phoneInfo, thirdList, cvCountryManager) noble, superManagerMap[userId], myGroups, phoneInfo, thirdList, cvCountryManager)
} }
// 单用户版,简化参数 // 单用户版,简化参数
func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.UserTradeUnion, isLike bool, likeMe bool, hvMap map[mysql.ID]Relation, func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.UserTradeUnion, isLike bool, likeMe bool, hvMap map[mysql.ID]Relation,
isVip bool, vipExpireTime *int64, svip rpc.CvSvip, headwear *headwear_cv.CvHeadwear, ride property_cv.CvProperty, wealthGrade uint32, charmGrade uint32, activityGrade uint32, isVip bool, vipExpireTime *int64, svip rpc.CvSvip, headwear *headwear_cv.CvHeadwear, ride property_cv.CvProperty, wealthGrade uint32, charmGrade uint32, activityGrade uint32,
medals []uint32, medalInfo []medal_cv.CvMedal, room string, power uint64, powerName string, noble *noble_m.UserNoble, isOfficialStaff bool, medals []uint32, medalInfo []medal_cv.CvMedal, room string, power uint64, powerName string, powerNameplate string, grade groupPower_m.GroupPowerGrade, noble *noble_m.UserNoble, isOfficialStaff bool,
myGroups []group_m.GroupInfo, phoneInfo *user_m.UserPhoneInfo, thirdList []int8, countryManager *country_cv.CVCountryManager) (*CvUserDetail, error) { myGroups []group_m.GroupInfo, phoneInfo *user_m.UserPhoneInfo, thirdList []int8, countryManager *country_cv.CVCountryManager) (*CvUserDetail, error) {
room, err := group_m.ToTxGroupId(model, room) room, err := group_m.ToTxGroupId(model, room)
...@@ -806,9 +836,15 @@ func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID, ...@@ -806,9 +836,15 @@ func userToDetailOne(model *domain.Model, user *user_m.User, myUserId mysql.ID,
CurrentRoom: room, CurrentRoom: room,
MyGroupPower: power, MyGroupPower: power,
MyGroupPowerName: powerName, MyGroupPowerName: powerName,
PhoneInfo: phoneInfo, GroupPower: GroupPower{
ThirdList: thirdList, Id: power,
CountryManager: countryManager, Name: powerName,
Nameplate: powerNameplate,
Grade: grade.Grade,
},
PhoneInfo: phoneInfo,
ThirdList: thirdList,
CountryManager: countryManager,
} }
if noble != nil { if noble != nil {
cvUserDetail.Noble = noble_cv.CvNoble{ cvUserDetail.Noble = noble_cv.CvNoble{
......
package group_power_ev
import (
"git.hilo.cn/hilo-common/domain"
)
//注册监听
var groupPowerExpireNoticeListen = new(domain.EventBase)
type GroupPowerExpireNoticeEvent struct {
}
//添加领域事件,在每个领域模型中init中添加,因为这是静态业务,非动态的。
func AddGroupPowerExpireNoticeSync(callback func(model *domain.Model, event interface{}) error) {
domain.AddEventSync(groupPowerExpireNoticeListen, callback)
}
//加入到异步操作中
func AddGroupPowerExpireNoticeAsync(callback func(model *domain.Model, event interface{}) error) {
domain.AddEventAsync(groupPowerExpireNoticeListen, callback)
}
//领域事件发布
func PublishGroupPowerExpireNotice(model *domain.Model, event interface{}) error {
return domain.PublishEvent(groupPowerExpireNoticeListen, model, event)
}
package group_power_ev
import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
)
//注册监听
var groupPowerUpgradeListen = new(domain.EventBase)
type GroupPowerUpgradeEvent struct {
GroupPowerId mysql.ID
}
//添加领域事件,在每个领域模型中init中添加,因为这是静态业务,非动态的。
func AddGroupPowerUpgradeSync(callback func(model *domain.Model, event interface{}) error) {
domain.AddEventSync(groupPowerUpgradeListen, callback)
}
//加入到异步操作中
func AddGroupPowerUpgradeAsync(callback func(model *domain.Model, event interface{}) error) {
domain.AddEventAsync(groupPowerUpgradeListen, callback)
}
//领域事件发布
func PublishGroupPowerUpgrade(model *domain.Model, event interface{}) error {
return domain.PublishEvent(groupPowerUpgradeListen, model, event)
}
package mic_ev
import (
"git.hilo.cn/hilo-common/domain"
)
var onMicListen = new(domain.EventBase)
// 在麦上事件
type OnMicEvent struct {
GroupUuid string // 群组uuid
I int // 麦位
ExternalId string // 麦中的人
UserId uint64 // 麦中的人
Forbid bool // 静音 true:静音,false:没有静音
Timestamp int64 // 上麦的的时间戳
}
func AddOnMicEventSync(callback func(model *domain.Model, event interface{}) error) {
domain.AddEventSync(onMicListen, callback)
}
func AddOnMicEventAsync(callback func(model *domain.Model, event interface{}) error) {
domain.AddEventAsync(onMicListen, callback)
}
func PublishOnMicEvent(model *domain.Model, event interface{}) error {
return domain.PublishEvent(onMicListen, model, event)
}
...@@ -348,47 +348,28 @@ func GetGroupPowerMap(db *gorm.DB, userIds []mysql.ID) (map[mysql.ID]uint64, err ...@@ -348,47 +348,28 @@ func GetGroupPowerMap(db *gorm.DB, userIds []mysql.ID) (map[mysql.ID]uint64, err
return result, nil return result, nil
} }
func GetGroupPowerNames(db *gorm.DB, ids []mysql.ID) (map[mysql.ID]string, error) { // return
func GetGroupPowerNames(db *gorm.DB, ids []mysql.ID) (map[mysql.ID]string, map[mysql.ID]string, error) {
type record struct { type record struct {
Id mysql.ID Id mysql.ID
Name string Name string
Nameplate string
} }
rows := make([]record, 0) rows := make([]record, 0)
result := make(map[mysql.ID]string, 0)
result2 := make(map[mysql.ID]string, 0)
if len(ids) > 0 { if len(ids) > 0 {
if err := db.Model(&GroupPower{}).Select("p.id, i.name"). if err := db.Model(&GroupPower{}).Select("p.id, i.name,p.nameplate").
Joins("AS p INNER JOIN group_info AS i ON p.group_uid = i.im_group_id"). Joins("AS p INNER JOIN group_info AS i ON p.group_uid = i.im_group_id").
Where("p.id IN ?", ids).Find(&rows).Error; err != nil { Where("p.id IN ?", ids).Find(&rows).Error; err != nil {
return nil, err return result, result2, err
} }
} }
result := make(map[mysql.ID]string, 0)
for _, i := range rows { for _, i := range rows {
result[i.Id] = i.Name result[i.Id] = i.Name
result2[i.Id] = i.Nameplate
} }
return result, nil return result, result2, nil
}
type GroupPowerInfo struct {
PowerId mysql.ID
Owner mysql.ID
Name string
}
func BatchGetGroupPower(db *gorm.DB, ids []mysql.ID) (map[mysql.ID]GroupPowerInfo, error) {
rows := make([]GroupPowerInfo, 0)
if len(ids) > 0 {
if err := db.Model(&GroupPower{}).Select("p.id AS power_id, u.user_id AS owner, p.name").
Joins("AS p INNER JOIN group_power_user AS u ON p.id = u.group_power_id").
Where("p.id IN ? AND p.status = ? AND role = ?", ids, groupPower_e.GroupPowerUserHas, groupPower_e.GroupPowerUserRoleMgr).
Find(&rows).Error; err != nil {
return nil, err
}
}
result := make(map[mysql.ID]GroupPowerInfo, 0)
for _, i := range rows {
result[i.PowerId] = i
}
return result, nil
} }
func GetGroupPower(model *domain.Model, id mysql.ID) (*GroupPower, error) { func GetGroupPower(model *domain.Model, id mysql.ID) (*GroupPower, error) {
...@@ -648,3 +629,36 @@ func GetUserGroupPower(model *domain.Model, userId uint64) (uint64, string, erro ...@@ -648,3 +629,36 @@ func GetUserGroupPower(model *domain.Model, userId uint64) (uint64, string, erro
} }
return gpu.GroupPowerId, powerName, nil return gpu.GroupPowerId, powerName, nil
} }
// 获取势力下的所有群组
func GetGroupPowerGroups(model *domain.Model, groupPowerId mysql.ID) ([]*group_m.GroupInfo, error) {
var res []*group_m.GroupInfo
var ownerIds []mysql.ID
if err := model.DB().Model(GroupPowerUser{}).Select("user_id").Where("group_power_id = ?", groupPowerId).Scan(&ownerIds).Error; err != nil {
model.Log.Errorf("GetGroupPowerGroups fail:%v", err)
return nil, err
}
if len(ownerIds) <= 0 {
return res, nil
}
if err := model.DB().Model(group_m.GroupInfo{}).Where("owner in ?", ownerIds).Find(&res).Error; err != nil {
model.Log.Errorf("GetGroupPowerGroups fail:%v", err)
return nil, err
}
return res, nil
}
// 批量获取势力用户
// return userId->GroupPowerUser
func BatchGetGroupPowerUser(model *domain.Model, userIds []mysql.ID) (map[mysql.ID]GroupPowerUser, error) {
var rows []GroupPowerUser
res := make(map[mysql.ID]GroupPowerUser)
if err := model.Db.Model(GroupPowerUser{}).Where("user_id in ?", userIds).Find(&rows).Error; err != nil {
model.Log.Errorf("BatchGetGroupPowerUser fail:%v", err)
return res, err
}
for i, v := range rows {
res[v.UserId] = rows[i]
}
return res, nil
}
This diff is collapsed.
package groupPower_m
import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
"hilo-group/_const/enum/groupPower_e"
)
type GroupPowerInfo struct {
mysql.Entity
GroupUid string
Name string
Nameplate string
Declaration string
Icon string
Status int
}
func (GroupPowerInfo) TableName() string {
return "group_power"
}
// 批量获取家族信息
func MGetGroupPowerInfoMap(model *domain.Model, groupPowerIds []mysql.ID) (map[mysql.ID]GroupPowerInfo, error) {
var rows []GroupPowerInfo
res := make(map[mysql.ID]GroupPowerInfo)
if err := model.DB().Model(GroupPowerInfo{}).Where("id in ?", groupPowerIds).Find(&rows).Error; err != nil {
model.Log.Errorf("MGetGroupPowerInfo fail:%v", err)
return res, err
}
for i, v := range rows {
res[v.ID] = rows[i]
}
return res, nil
}
// 批量获取家族成员
func MGetGroupPowerUsers(model *domain.Model, groupPowerIds []mysql.ID) (map[mysql.ID][]*GroupPowerUser, error) {
var users []*GroupPowerUser
res := make(map[mysql.ID][]*GroupPowerUser)
if err := model.DB().Model(GroupPowerUser{}).Where("group_power_id in ?", groupPowerIds).Find(&users).Error; err != nil {
model.Log.Errorf("MGetGroupPowerUsers fail:%v", err)
return res, err
}
for i, v := range users {
res[v.GroupPowerId] = append(res[v.GroupPowerId], users[i])
}
return res, nil
}
// 获取家族成员
func GetGroupPowerUser(model *domain.Model, groupPowerId mysql.ID) ([]*GroupPowerUser, error) {
m, err := MGetGroupPowerUsers(model, []mysql.ID{groupPowerId})
if err != nil {
return nil, err
}
return m[groupPowerId], nil
}
// 获取所有家族的主
func GetAllGroupPowerOwners(model *domain.Model) ([]mysql.ID, error) {
var userIds []mysql.ID
if err := model.DB().Model(GroupPowerUser{}).Select("user_id").
Where("role = ?", groupPower_e.GroupPowerUserRoleMgr).Find(&userIds).Error; err != nil {
model.Log.Errorf("GetAllGroupPowerOwners fail:%v", err)
return userIds, err
}
return userIds, nil
}
package groupPower_m
import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
)
type GroupPowerExpRank struct {
GroupPowerId mysql.ID
Exp mysql.Num
Rank int
}
// 获取家族经验排行榜
// param limit: 排行榜人数
func GetGroupPowerExpRank(model *domain.Model, beginDate, endDate string, limit int) ([]GroupPowerExpRank, error) {
var res []GroupPowerExpRank
if err := model.DB().Table("group_power_day_exp").Select("group_power_id,SUM(exp) as exp").
Where("date BETWEEN ? AND ?", beginDate, endDate).Group("group_power_id").Order("exp DESC").Limit(limit).Find(&res).Error; err != nil {
model.Log.Errorf("GetGroupPowerExpRank fail:%v", err)
return res, err
}
for i := range res {
res[i].Rank = i + 1
}
return res, nil
}
package groupPower_m
import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"hilo-group/_const/enum/groupPower_e"
"time"
)
// 家族之星
type GroupPowerMonthStar struct {
Month string
GroupPowerId mysql.ID
UserId mysql.ID
Type groupPower_e.GroupPowerStarType
Score mysql.Num
LastCalTs int64
CreatedTime time.Time `gorm:"->"`
UpdatedTime time.Time `gorm:"->"`
}
// 增加家族之星分数
func IncrGroupPowerMonthStarScore(model *domain.Model, groupPowerId, userId mysql.ID, _type groupPower_e.GroupPowerStarType, score mysql.Num, lastCalTs int64) error {
month := time.Now().Format("200601")
star := &GroupPowerMonthStar{
Month: month,
GroupPowerId: groupPowerId,
UserId: userId,
Type: _type,
Score: score,
LastCalTs: lastCalTs,
}
if err := model.DB().Model(GroupPowerMonthStar{}).Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "month"}, {Name: "group_power_id"}, {Name: "user_id"}, {Name: "type"}},
DoUpdates: clause.Assignments(map[string]interface{}{
"score": gorm.Expr("score + ?", star.Score),
"last_cal_ts": lastCalTs,
}),
}).Create(star).Error; err != nil {
model.Log.Errorf("IncrGroupPowerMonthStarScore fail:%v", err)
return err
}
return nil
}
// 获取家族之星分数
// 允许返回gorm.ErrRecordNotFound
func GetGroupPowerMonthStar(model *domain.Model, groupPowerId, userId mysql.ID, _type groupPower_e.GroupPowerStarType) (*GroupPowerMonthStar, error) {
res := new(GroupPowerMonthStar)
month := time.Now().Format("200601")
if err := model.DB().Where("month = ? AND group_power_id = ? AND user_id = ? AND `type` = ?", month, groupPowerId, userId, _type).First(res).Error; err != nil {
return nil, err
}
return res, nil
}
// 获取家族之星排行
func GetGroupPowerMonthStarRank(model *domain.Model, groupPowerId mysql.ID, _type groupPower_e.GroupPowerStarType, offset, limit int) ([]*GroupPowerMonthStar, error) {
var res []*GroupPowerMonthStar
month := time.Now().Format("200601")
if err := model.DB().Model(GroupPowerMonthStar{}).Where("month = ? AND group_power_id = ? AND `type` = ?", month, groupPowerId, _type).
Order("score desc").Offset(offset).Limit(limit).Find(&res).Error; err != nil {
model.Log.Errorf("GetGroupPowerMonthStarRank fail:%v", err)
return res, err
}
return res, nil
}
package mic_m
import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
"git.hilo.cn/hilo-common/utils"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"time"
)
// 用户上麦
type UserOnMic struct {
Date string
UserId mysql.ID
Seconds mysql.Num
LastCalTs int64
CreatedTime time.Time `gorm:"->"`
UpdatedTime time.Time `gorm:"->"`
}
// 获取用户当日上麦
// 允许返回gorm.ErrRecordNotFound
func GetUserOnMic(model *domain.Model, userId mysql.ID) (*UserOnMic, error) {
res := new(UserOnMic)
day := time.Now().Format("2006-01-02")
if err := model.DB().Where("date = ? AND user_id = ?", day, userId).First(res).Error; err != nil {
return nil, err
}
return res, nil
}
// 增加用户上麦时长
// 事务操作
func IncrUserOnMic(model *domain.Model, userId mysql.ID, joinMicTimestamp int64) error {
return model.Transaction(func(model *domain.Model) error {
omMic, err := GetUserOnMic(model, userId)
if err != nil && err != gorm.ErrRecordNotFound {
return err
}
curTs := joinMicTimestamp
nowTs := time.Now().Unix()
day0Ts := utils.GetZeroTime(time.Now()).Unix()
if omMic != nil && joinMicTimestamp < omMic.LastCalTs { // 加入的时间比上次计算时间小
curTs = omMic.LastCalTs
}
// 跨天
if curTs < day0Ts {
curTs = day0Ts
}
score := nowTs - curTs
day := time.Now().Format("2006-01-02")
onMicNew := &UserOnMic{
Date: day,
UserId: userId,
Seconds: mysql.Num(score),
LastCalTs: nowTs,
}
if err := model.DB().Model(UserOnMic{}).Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "date"}, {Name: "user_id"}},
DoUpdates: clause.Assignments(map[string]interface{}{
"seconds": gorm.Expr("seconds + ?", onMicNew.Seconds),
"last_cal_ts": nowTs,
}),
}).Create(onMicNew).Error; err != nil {
model.Log.Errorf("IncrUserOnMic fail:%v", err)
return err
}
return nil
})
}
// 批量获取用户上麦时长
// @return userId->seconds
func MGetUserOnMicSeconds(model *domain.Model, day string, userIds []uint64) (map[mysql.ID]mysql.Num, error) {
var rows []UserOnMic
res := make(map[mysql.ID]mysql.Num)
if err := model.DB().Model(UserOnMic{}).Where("`date`= ? AND user_id in ?", day, userIds).Find(&rows).Error; err != nil {
model.Log.Errorf("MGetUserOnMic fail:%v", err)
return res, err
}
for _, r := range rows {
res[r.UserId] = r.Seconds
}
return res, nil
}
...@@ -3,20 +3,25 @@ package event_s ...@@ -3,20 +3,25 @@ package event_s
import ( import (
"encoding/json" "encoding/json"
"git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
"git.hilo.cn/hilo-common/rpc" "git.hilo.cn/hilo-common/rpc"
"git.hilo.cn/hilo-common/sdk/tencentyun" "git.hilo.cn/hilo-common/sdk/tencentyun"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/_const/enum/group_e" "hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/msg_e" "hilo-group/_const/enum/msg_e"
"hilo-group/_const/enum/task_e" "hilo-group/_const/enum/task_e"
"hilo-group/domain/event/gift_ev" "hilo-group/domain/event/gift_ev"
"hilo-group/domain/event/group_ev" "hilo-group/domain/event/group_ev"
"hilo-group/domain/event/group_power_ev" "hilo-group/domain/event/group_power_ev"
"hilo-group/domain/event/mic_ev"
"hilo-group/domain/model/diamond_m" "hilo-group/domain/model/diamond_m"
"hilo-group/domain/model/groupPower_m" "hilo-group/domain/model/groupPower_m"
"hilo-group/domain/model/group_m" "hilo-group/domain/model/group_m"
"hilo-group/domain/model/mic_m"
"hilo-group/domain/model/msg_m" "hilo-group/domain/model/msg_m"
"hilo-group/domain/model/task_m" "hilo-group/domain/model/task_m"
"hilo-group/domain/model/user_m" "hilo-group/domain/model/user_m"
"hilo-group/domain/service/group_mic_s"
"hilo-group/myerr" "hilo-group/myerr"
"strconv" "strconv"
"time" "time"
...@@ -28,7 +33,8 @@ func EventInit() { ...@@ -28,7 +33,8 @@ func EventInit() {
GroupEvents() GroupEvents()
GroupImMass() GroupImMass()
GroupTheme() GroupTheme()
SendGift() SendGift() // 送礼事件
OnMic() // 在麦上事件
} }
func GroupSupportEvents() { func GroupSupportEvents() {
...@@ -101,7 +107,7 @@ func GroupSupportEvents() { ...@@ -101,7 +107,7 @@ func GroupSupportEvents() {
} }
func GroupPowerEvents() { func GroupPowerEvents() {
//加入势力 // 加入势力
group_power_ev.AddGroupPowerJoinAsync(func(model *domain.Model, e interface{}) error { group_power_ev.AddGroupPowerJoinAsync(func(model *domain.Model, e interface{}) error {
event, ok := e.(*group_power_ev.GroupPowerJoinEvent) event, ok := e.(*group_power_ev.GroupPowerJoinEvent)
if !ok { if !ok {
...@@ -129,7 +135,7 @@ func GroupPowerEvents() { ...@@ -129,7 +135,7 @@ func GroupPowerEvents() {
msg_m.SendEmasMsgAssistant(model, mgrUser.ExternalId, mgrUser.DeviceType) msg_m.SendEmasMsgAssistant(model, mgrUser.ExternalId, mgrUser.DeviceType)
return nil return nil
}) })
//离开势力 // 离开势力
group_power_ev.AddGroupPowerLeaveAsync(func(model *domain.Model, e interface{}) error { group_power_ev.AddGroupPowerLeaveAsync(func(model *domain.Model, e interface{}) error {
event, ok := e.(*group_power_ev.GroupPowerLeaveEvent) event, ok := e.(*group_power_ev.GroupPowerLeaveEvent)
if !ok { if !ok {
...@@ -157,6 +163,57 @@ func GroupPowerEvents() { ...@@ -157,6 +163,57 @@ func GroupPowerEvents() {
msg_m.SendEmasMsgAssistant(model, mgrUser.ExternalId, mgrUser.DeviceType) msg_m.SendEmasMsgAssistant(model, mgrUser.ExternalId, mgrUser.DeviceType)
return nil return nil
}) })
// 势力升级
group_power_ev.AddGroupPowerUpgradeAsync(func(model *domain.Model, e interface{}) error {
event, ok := e.(*group_power_ev.GroupPowerUpgradeEvent)
if !ok {
model.Log.Errorf("AddGroupPowerUpgradeAsync event type err")
return nil
}
model.Log.Infof("msg AddGroupPowerUpgradeAsync GroupPowerId:%v", event.GroupPowerId)
users, err := groupPower_m.GetGroupPowerUser(model, event.GroupPowerId)
if err != nil {
return err
}
var userIds []mysql.ID
for _, u := range users {
userIds = append(userIds, u.UserId)
}
userMaps, err := user_m.GetUserMapByIds(model, userIds)
if err != nil {
return err
}
for uid, u := range userMaps {
if err := msg_m.NewUserRecord(model, uid, msg_e.GroupPowerUpgrade, "", 0, "", "", "", "", "").Persistent(); err != nil {
model.Log.Errorf("msg AddGroupPowerLeaveAsync NewUserRecord err:%v", err)
return nil
}
msg_m.SendEmasMsgAssistant(model, u.ExternalId, u.DeviceType)
}
return nil
})
// 势力等级即将过期
group_power_ev.AddGroupPowerExpireNoticeAsync(func(model *domain.Model, e interface{}) error {
model.Log.Infof("msg AddGroupPowerExpireNoticeAsync")
powerOwners, err := groupPower_m.GetAllGroupPowerOwners(model)
if err != nil {
model.Log.Errorf("AddGroupPowerExpireNoticeAsync fail:%v", err)
return err
}
userMaps, err := user_m.GetUserMapByIds(model, powerOwners)
if err != nil {
return err
}
for uid, u := range userMaps {
if err := msg_m.NewUserRecord(model, uid, msg_e.GroupPowerExpireNotice, "", 0, "", "", "", "", "").Persistent(); err != nil {
model.Log.Errorf("msg AddGroupPowerExpireNoticeAsync NewUserRecord err:%v", err)
return nil
}
msg_m.SendEmasMsgAssistant(model, u.ExternalId, u.DeviceType)
}
return nil
})
} }
func GroupEvents() { func GroupEvents() {
...@@ -397,14 +454,86 @@ func FlushHiloInfo(extId string, isVip bool, isPrettyCode bool, medals []uint32, ...@@ -397,14 +454,86 @@ func FlushHiloInfo(extId string, isVip bool, isPrettyCode bool, medals []uint32,
} }
func SendGift() { func SendGift() {
// 送礼事件-火箭 // 送礼事件-势力经验
gift_ev.AddSendGiftEventAsync(func(model *domain.Model, event interface{}) error { gift_ev.AddSendGiftEventSync(func(model *domain.Model, event interface{}) error {
sendGiftEvent, ok := event.(*gift_ev.SendGiftEvent) sendGiftEvent, ok := event.(*gift_ev.SendGiftEvent)
if !ok { if !ok {
model.Log.Errorf("AddSendGiftEventAsync event type err") model.Log.Errorf("AddSendGiftEventAsync event type err")
return nil return nil
} }
model.Log.Infof("AddSendGiftEventAsync %+v", sendGiftEvent) model.Log.Infof("AddSendGiftEventAsync %+v", sendGiftEvent)
exist, groupPowerId, err := groupPower_m.CheckGroupPowerUser(model, sendGiftEvent.SendUserId)
if err != nil {
model.Log.Infof("CheckGroupPowerUser fail %+v", err)
return err
}
if exist {
exp := sendGiftEvent.GiftN * mysql.Num(len(sendGiftEvent.ReceiveUserIds)) * sendGiftEvent.ResGift.DiamondNum
return groupPower_m.IncrGroupPowerExp(model, groupPowerId, exp, sendGiftEvent.SendUserId, "送礼")
}
return nil
})
// 家族之星-送礼/收礼
gift_ev.AddSendGiftEventAsync(func(model *domain.Model, event interface{}) error {
sendGiftEvent, ok := event.(*gift_ev.SendGiftEvent)
if !ok {
model.Log.Errorf("AddSendGiftEventAsync event type err")
return nil
}
var userIds = []mysql.ID{sendGiftEvent.SendUserId}
userIds = append(userIds, sendGiftEvent.ReceiveUserIds...)
groupPowers, err := groupPower_m.BatchGetGroupPowerUser(model, userIds)
if err != nil {
model.Log.Errorf("AddSendGiftEventAsync fail:%v", err)
return err
}
// 送礼加分
if data, ok := groupPowers[sendGiftEvent.SendUserId]; ok {
diamonds := sendGiftEvent.GiftN * sendGiftEvent.ResGift.DiamondNum * mysql.Num(len(sendGiftEvent.ReceiveUserIds))
if err := groupPower_m.IncrGroupPowerMonthStarScore(model, data.GroupPowerId, data.UserId, groupPower_e.GroupPowerStarTypeFamous, diamonds, 0); err != nil {
model.Log.Errorf("IncrGroupPowerMonthStarScore famous fail:%v", err)
}
}
// 收礼加分
for _, userId := range sendGiftEvent.ReceiveUserIds {
if data, ok := groupPowers[userId]; ok {
diamonds := sendGiftEvent.GiftN * sendGiftEvent.ResGift.DiamondNum
if err := groupPower_m.IncrGroupPowerMonthStarScore(model, data.GroupPowerId, data.UserId, groupPower_e.GroupPowerStarTypeCharm, diamonds, 0); err != nil {
model.Log.Errorf("IncrGroupPowerMonthStarScore charm fail:%v", err)
}
}
}
return nil
})
}
func OnMic() {
// 上麦经验/上麦时长
mic_ev.AddOnMicEventAsync(func(model *domain.Model, e interface{}) error {
event, ok := e.(*mic_ev.OnMicEvent)
if !ok {
model.Log.Errorf("AddOnMicEventSync event type err")
return nil
}
if err := group_mic_s.NewGroupPowerService(model.MyContext).IncrGroupPowerOnMicExpAndTime(event.GroupUuid, event.UserId, event.Timestamp); err != nil {
model.Log.Errorf("cron micIn GroupPowerOnMicExp err:%v", err)
} else {
model.Log.Infof("cron micIn GroupPowerOnMicExp success, groupId:%v, userId:%v", event.GroupUuid, event.UserId)
}
return nil
})
// 用户上麦时长
mic_ev.AddOnMicEventAsync(func(model *domain.Model, e interface{}) error {
event, ok := e.(*mic_ev.OnMicEvent)
if !ok {
model.Log.Errorf("AddOnMicEventSync event type err")
return nil
}
if err := mic_m.IncrUserOnMic(model, event.UserId, event.Timestamp); err != nil {
model.Log.Errorf("cron micIn IncrUserOnMic err:%v", err)
} else {
model.Log.Infof("cron micIn IncrUserOnMic success,userId:%v", event.UserId)
}
return nil return nil
}) })
} }
...@@ -57,7 +57,7 @@ func (s *GiftSendEventService) Consume() error { ...@@ -57,7 +57,7 @@ func (s *GiftSendEventService) Consume() error {
return nil return nil
} }
if err := gift_ev.PublishSendGiftEvent(model, sendGiftEvent); err != nil { if err := gift_ev.PublishSendGiftEvent(model, sendGiftEvent); err != nil {
model.Log.Errorf("PublishSendGiftEvent fail,event:%v,err:%v", cpEvent, err) model.Log.Errorf("PublishSendGiftEvent fail,event:%v,err:%v", string(cpEvent.Payload), err)
return err return err
} }
// 标记已经处理 // 标记已经处理
......
...@@ -10,6 +10,7 @@ import ( ...@@ -10,6 +10,7 @@ import (
"hilo-group/_const/enum/group_e" "hilo-group/_const/enum/group_e"
"hilo-group/_const/redis_key" "hilo-group/_const/redis_key"
"hilo-group/domain/event/group_ev" "hilo-group/domain/event/group_ev"
"hilo-group/domain/model/groupPower_m"
"hilo-group/domain/model/group_m" "hilo-group/domain/model/group_m"
"hilo-group/domain/service/signal_s" "hilo-group/domain/service/signal_s"
"hilo-group/myerr" "hilo-group/myerr"
...@@ -287,3 +288,39 @@ func (s *GroupMicService) GroupIMMassByMgr(groupId string, userId uint64, extern ...@@ -287,3 +288,39 @@ func (s *GroupMicService) GroupIMMassByMgr(groupId string, userId uint64, extern
}) })
}) })
} }
// 增加势力上麦经验/时长
func (s *GroupMicService) IncrGroupPowerOnMicExpAndTime(groupId string, userId uint64, joinMicTimestamp int64) error {
var model = domain.CreateModelContext(s.svc.MyContext)
exists, groupPowerId, err := groupPower_m.CheckGroupPowerUser(model, userId)
if err != nil {
return err
}
if !exists {
return nil
}
// 获取势力下所有群组
groups, err := groupPower_m.GetGroupPowerGroups(model, groupPowerId)
if err != nil {
return err
}
inGroup := false
for _, group := range groups {
if group.ImGroupId == groupId {
inGroup = true
break
}
}
if !inGroup {
return nil
}
// 增加势力上麦经验
if err := groupPower_m.IncrGroupPowerExpOnMic(model, groupPowerId, userId, joinMicTimestamp); err != nil {
model.Log.Errorf("IncrGroupPowerExpOnMic fail:%v", err)
}
// 增加势力上麦时长
if err := groupPower_m.IncrGroupPowerStarOnMic(model, groupPowerId, userId, joinMicTimestamp); err != nil {
model.Log.Errorf("IncrGroupPowerOnMicTime fail:%v", err)
}
return nil
}
...@@ -59,12 +59,12 @@ TX_OVERSEA_APP_ID=40000066 ...@@ -59,12 +59,12 @@ TX_OVERSEA_APP_ID=40000066
TX_OVERSEA_KEY=3ab68ea5bddc8774d90b8c764ae71188914bd5fd06f30b28790c51e44ca7885c TX_OVERSEA_KEY=3ab68ea5bddc8774d90b8c764ae71188914bd5fd06f30b28790c51e44ca7885c
[EMAS] [EMAS]
REGION_ID=cn-hangzhou REGION_ID=cn-hangzhou
ACCESS_KEY_ID=LTAI4FhNPzxdzD4w6bHirL9Z ACCESS_KEY_ID=LTAIdQZv5H1kNZp5
ACCESS_KEY_SECRET=OQvUJpXDrjGi3g1F2aHiAIFWIvLdbP ACCESS_KEY_SECRET=UnwY0ClDkqBMLwPx3OJJiLYyk9xYLO
ANDROID_APP_KEY=30250713 ANDROID_APP_KEY=30250713
ANDROID_APP_SECRET=cae7b9a9d3e54577d2c3b60bf6d23047 ANDROID_APP_SECRET=cae7b9a9d3e54577d2c3b60bf6d23047
IOS_APP_KEY=30240346 IOS_APP_KEY=30790728
IOS_APP_SECRET=57f33ab9ca6a957a8c659f2b0b6d1205 IOS_APP_SECRET=4fd69ca084c67d4b5a8d15452f0af26a
APNS=DEV APNS=DEV
[AGORA] [AGORA]
APP_ID=fc3e087f701b4f788099e1924c3cc7b0 APP_ID=fc3e087f701b4f788099e1924c3cc7b0
......
...@@ -375,7 +375,7 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -375,7 +375,7 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) {
groupIds = append(groupIds, i.ImGroupId) groupIds = append(groupIds, i.ImGroupId)
owners = append(owners, i.Owner) owners = append(owners, i.Owner)
} }
powerIds, powerNames, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -487,9 +487,16 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -487,9 +487,16 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) {
MicNumType: int(i.MicNumType), MicNumType: int(i.MicNumType),
GroupMedals: medals, GroupMedals: medals,
}, },
HasOnMic: len(roomMicUserMap[i.ImGroupId]) > 0, HasOnMic: len(roomMicUserMap[i.ImGroupId]) > 0,
GroupPowerId: powerIds[i.Owner], GroupPowerId: powerIds[i.Owner],
GroupPowerName: powerNames[i.Owner], GroupPowerName: powerNames[i.Owner],
GroupPowerNameplate: powerNameplates[i.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[i.Owner],
Name: powerNames[i.Owner],
Nameplate: powerNameplates[i.Owner],
Grade: powerGrades[i.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[i.ImGroupId]), RoomUserCount: uint(roomCount[i.ImGroupId]),
......
package group_power_r
import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/resource/mysql"
"git.hilo.cn/hilo-common/utils"
"github.com/gin-gonic/gin"
"github.com/jinzhu/now"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/cv/group_power_cv"
"hilo-group/cv/user_cv"
"hilo-group/domain/model/groupPower_m"
"hilo-group/domain/model/user_m"
"hilo-group/myerr/bizerr"
"hilo-group/req"
"hilo-group/resp"
"strconv"
"time"
)
// @Tags 国家势力
// @Summary 家族榜单
// @Param token header string true "token"
// @Param nonce header string true "随机数字"
// @Param period path string true "榜单周期 day:日 week:周 month:月"
// @Success 200 {object} group_power_cv.CvGroupPowerRank
// @Router /v1/groupPower/rank/{period} [get]
func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys)
userId, err := req.GetUserId(c)
if err != nil {
return myContext, err
}
period := c.Param("period")
if period != "day" && period != "week" && period != "month" {
return myContext, bizerr.InvalidParameter
}
var beginDate, endDate string
switch period {
case "day":
beginDate, endDate = time.Now().Format("2006-01-02"), time.Now().Format("2006-01-02")
case "week":
beginDate, endDate = utils.GetMonday(time.Now()).Format("2006-01-02"), utils.GetMonday(time.Now()).AddDate(0, 0, 6).Format("2006-01-02")
case "month":
beginDate, endDate = now.BeginningOfMonth().Format("2006-01-02"), now.EndOfMonth().Format("2006-01-02")
}
var model = domain.CreateModelContext(myContext)
rank, err := groupPower_m.GetGroupPowerExpRank(model, beginDate, endDate, 30)
if err != nil {
return myContext, err
}
var ids []mysql.ID
for _, g := range rank {
ids = append(ids, g.GroupPowerId)
}
response := group_power_cv.CvGroupPowerRank{}
myGroupPower, err := groupPower_m.GetGroupPowerUserOrNil(model, userId)
if err != nil {
return myContext, err
}
if myGroupPower != nil {
ids = append(ids, myGroupPower.GroupPowerId)
}
grades, err := groupPower_m.MGetGroupPowerGrade(model, ids)
if err != nil {
return myContext, err
}
groupPowers, err := groupPower_m.MGetGroupPowerInfoMap(model, ids)
if err != nil {
return myContext, err
}
for _, v := range rank {
if myGroupPower != nil && v.GroupPowerId == myGroupPower.GroupPowerId && myGroupPower.Role == groupPower_e.GroupPowerUserRoleMgr {
response.MyGroupPower = &group_power_cv.CvGroupPowerRankData{
CvGroupPowerBase: group_power_cv.CvGroupPowerBase{
Id: myGroupPower.GroupPowerId,
Icon: groupPowers[myGroupPower.GroupPowerId].Icon,
Name: groupPowers[myGroupPower.GroupPowerId].Name,
Nameplate: groupPowers[myGroupPower.GroupPowerId].Nameplate,
},
CvGroupPowerGrade: group_power_cv.CvGroupPowerGrade{
Grade: grades[myGroupPower.GroupPowerId].Grade,
Exp: v.Exp,
},
Rank: v.Rank,
}
}
response.Items = append(response.Items, group_power_cv.CvGroupPowerRankData{
CvGroupPowerBase: group_power_cv.CvGroupPowerBase{
Id: v.GroupPowerId,
Icon: groupPowers[v.GroupPowerId].Icon,
Name: groupPowers[v.GroupPowerId].Name,
Nameplate: groupPowers[v.GroupPowerId].Nameplate,
},
CvGroupPowerGrade: group_power_cv.CvGroupPowerGrade{
Grade: grades[v.GroupPowerId].Grade,
Exp: v.Exp,
},
Rank: v.Rank,
})
}
if response.MyGroupPower != nil && response.MyGroupPower.Rank == 0 {
response.MyGroupPower.Rank = 31 // 客户端统一显示30+
}
resp.ResponseOk(c, response)
return myContext, nil
}
type GroupPowerStarReq struct {
GroupPowerId mysql.ID `form:"groupPowerId" binding:"required"`
Type groupPower_e.GroupPowerStarType `form:"type" binding:"required"`
PageSize int `form:"pageSize"`
PageIndex int `form:"pageIndex"`
}
// @Tags 国家势力
// @Summary 家族之星
// @Param token header string true "token"
// @Param nonce header string true "随机数字"
// @Param groupPowerId query int true "家族id"
// @Param type query integer true "类型 1:送礼 2:活跃 3:收礼物"
// @Param pageSize query int false "分页大小 默认:30" default(30)
// @Param pageIndex query int false "第几个分页,从1开始 默认:1" default(1)
// @Success 200 {object} []group_power_cv.CvGroupPowerStarData
// @Router /v1/groupPower/star [get]
func GroupPowerStar(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys)
param := new(GroupPowerStarReq)
if err := c.ShouldBindQuery(param); err != nil {
return myContext, err
}
if param.PageIndex <= 0 {
param.PageIndex = 1
}
if param.PageSize <= 0 {
param.PageSize = 30
}
var model = domain.CreateModelContext(myContext)
offset, limit := (param.PageIndex-1)*param.PageSize, param.PageSize
rank, err := groupPower_m.GetGroupPowerMonthStarRank(model, param.GroupPowerId, param.Type, offset, limit)
if err != nil {
return myContext, err
}
var response []group_power_cv.CvGroupPowerStarData
var userIds []mysql.ID
for _, row := range rank {
userIds = append(userIds, row.UserId)
}
users, err := user_m.GetUserMapByIds(model, userIds)
for _, row := range rank {
user := users[row.UserId]
response = append(response, group_power_cv.CvGroupPowerStarData{
User: user_cv.CvUserTiny{
Id: user.ID,
ExternalId: user.ExternalId,
Code: user.Code,
Nick: user.Nick,
Avatar: user.Avatar,
},
Score: row.Score,
})
}
resp.ResponsePageBaseOk(c, response, 0, false)
return myContext, nil
}
// @Tags 国家势力
// @Summary 家族等级页
// @Param token header string true "token"
// @Param nonce header string true "随机数字"
// @Param groupPowerId query int true "家族id"
// @Success 200 {object} group_power_cv.CvGroupPowerGradeDetail
// @Router /v1/h5/groupPower/grade/detail [get]
func GroupPowerGradeDetail(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys)
userId, err := req.GetUserId(c)
if err != nil {
return myContext, err
}
groupPowerId, err := strconv.ParseUint(c.Query("groupPowerId"), 10, 16)
if err != nil || groupPowerId <= 0 {
return myContext, bizerr.InvalidParameter
}
var model = domain.CreateModelContext(myContext)
groupPowerInfo, err := groupPower_m.MGetGroupPowerInfoMap(model, []mysql.ID{groupPowerId})
if err != nil {
return myContext, err
}
gradeM, err := groupPower_m.MGetGroupPowerGrade(model, []mysql.ID{groupPowerId})
if err != nil {
return myContext, err
}
groupPower, ok := groupPowerInfo[groupPowerId]
if !ok {
return myContext, bizerr.GroupNotFound
}
grade := gradeM[groupPowerId]
nextExp := mysql.Num(0)
if grade.Grade != groupPower_e.GroupPowerGradeMax {
nextExp = groupPower_e.GroupPowerGradeExp[grade.Grade+1]
}
expireAt := ""
if grade.ExpireAt.After(time.Now()) {
expireAt = grade.ExpireAt.Format("2006-01-02")
}
isMember := false
if exits, _, err := groupPower_m.CheckGroupPowerUser(model, userId); err != nil {
return myContext, err
} else if exits {
isMember = true
}
response := group_power_cv.CvGroupPowerGradeDetail{
GroupPowerBase: group_power_cv.CvGroupPowerBase{
Id: groupPower.ID,
Icon: groupPower.Icon,
Name: groupPower.Name,
Nameplate: groupPower.Nameplate,
},
GroupPowerGrade: group_power_cv.CvGroupPowerGrade{
Grade: grade.Grade,
Exp: grade.Exp,
NextExp: nextExp,
ExpireAt: expireAt,
},
ResGradeList: group_power_cv.CvResGradeList,
PrivilegeList: group_power_cv.GroupPowerGradePrivilegeNum[grade.Grade],
IsMember: isMember,
}
resp.ResponseOk(c, response)
return myContext, nil
}
package group_power_r
import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/resource/mysql"
"github.com/gin-gonic/gin"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/_const/enum/msg_e"
"hilo-group/cv/group_power_cv"
"hilo-group/domain/model/groupPower_m"
"hilo-group/domain/model/msg_m"
"hilo-group/domain/model/user_m"
"hilo-group/resp"
)
type MGetGroupPowerReq struct {
Ids []mysql.ID `form:"ids" binding:"required"`
}
// @Tags 国家势力-内部
// @Summary 批量获取国家势力信息
// @Param ids query string true "用户id,如:ids=1&ids=2&ids=3"
// @Success 200 {object} map[mysql.ID]group_power_cv.CvGroupPowerInfo
// @Router /inner/groupPower/infos [get]
func MGetGroupPowers(c *gin.Context) (*mycontext.MyContext, error) {
myCtx := mycontext.CreateMyContext(c.Keys)
var model = domain.CreateModelContext(myCtx)
var req MGetGroupPowerReq
if err := c.ShouldBindQuery(&req); err != nil {
return myCtx, err
}
groupPowers, err := groupPower_m.MGetGroupPowerInfoMap(model, req.Ids)
if err != nil {
return myCtx, err
}
groupPowerUsers, err := groupPower_m.MGetGroupPowerUsers(model, req.Ids)
if err != nil {
return myCtx, err
}
groupPowerGrade, err := groupPower_m.MGetGroupPowerGrade(model, req.Ids)
if err != nil {
return myCtx, err
}
response := make(map[mysql.ID]group_power_cv.CvGroupPowerInfo)
for groupPowerId, info := range groupPowers {
// 成员上限
var memberMax mysql.Num
grade := groupPowerGrade[groupPowerId].Grade
if grade >= groupPower_e.GroupPowerGrade0 && grade <= groupPower_e.GroupPowerGradeMax {
memberMax = mysql.Num(group_power_cv.GroupPowerGradePrivilegeNum[groupPowerGrade[groupPowerId].Grade][0].Num)
}
memberNum := mysql.Num(len(groupPowerUsers[groupPowerId]))
if memberNum > memberMax {
memberMax = memberNum
}
response[groupPowerId] = group_power_cv.CvGroupPowerInfo{
CvGroupPowerBase: group_power_cv.CvGroupPowerBase{
Id: groupPowerId,
Icon: info.Icon,
Name: info.Name,
Nameplate: info.Nameplate,
},
CvGroupPowerMember: group_power_cv.CvGroupPowerMember{
MemberNum: memberNum,
MemberMax: memberMax,
},
CvGroupPowerGrade: group_power_cv.CvGroupPowerGrade{
Grade: grade,
Exp: groupPowerGrade[groupPowerId].Exp,
},
}
}
resp.ResponseOk(c, response)
return myCtx, nil
}
func Test(c *gin.Context) (*mycontext.MyContext, error) {
var model = domain.CreateModelNil()
if err := msg_m.NewUserRecord(model, 4522, msg_e.GroupPowerUserJoin, "frozen", 4522, "", "", "", "", "").Persistent(); err != nil {
return nil, err
}
mgrUser, _ := user_m.GetUser(model, 4522)
err := msg_m.SendEmasMsgAssistant(model, mgrUser.ExternalId, mgrUser.DeviceType)
if err != nil {
return nil, err
}
//err := emas.SendIosMsgAll("全部消息测试")
//if err != nil {
// return nil, err
//}
return nil, nil
}
...@@ -133,7 +133,7 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -133,7 +133,7 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
} }
model.Log.Info("GetTheirGroups: theirRoles - ", theirRoles) model.Log.Info("GetTheirGroups: theirRoles - ", theirRoles)
powerIds, powerNames, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -273,8 +273,15 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -273,8 +273,15 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupMedals: medals, GroupMedals: medals,
}, },
//HasOnMic: onMicScore[i.GroupId] != 0, //HasOnMic: onMicScore[i.GroupId] != 0,
GroupPowerId: powerIds[gi.Owner], GroupPowerId: powerIds[gi.Owner],
GroupPowerName: powerNames[gi.Owner], GroupPowerName: powerNames[gi.Owner],
GroupPowerNameplate: powerNameplates[gi.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[gi.Owner],
Name: powerNames[gi.Owner],
Nameplate: powerNameplates[gi.Owner],
Grade: powerGrades[gi.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[i.GroupId]), RoomUserCount: uint(roomCount[i.GroupId]),
...@@ -362,7 +369,7 @@ func PluginReady(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -362,7 +369,7 @@ func PluginReady(c *gin.Context) (*mycontext.MyContext, error) {
// @Param token header string true "token" // @Param token header string true "token"
// @Param nonce header string true "随机数字" // @Param nonce header string true "随机数字"
// @Param groupId path string true "群ID" // @Param groupId path string true "群ID"
// @Success 200 {object} cv.RoomInfo // @Success 200 {object} group_cv.RoomInfo
// @Router /v1/imGroup/roomInfo/{groupId} [get] // @Router /v1/imGroup/roomInfo/{groupId} [get]
func GetRoomInfo(c *gin.Context) (*mycontext.MyContext, error) { func GetRoomInfo(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
...@@ -1195,7 +1202,7 @@ func GroupMedalAll(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -1195,7 +1202,7 @@ func GroupMedalAll(c *gin.Context) (*mycontext.MyContext, error) {
// @Param token header string true "token" // @Param token header string true "token"
// @Param nonce header string true "随机数字" // @Param nonce header string true "随机数字"
// @Param groupId query string false "群ID" // @Param groupId query string false "群ID"
// @Success 200 {object} cv.RoomMedalInfo // @Success 200 {object} group_cv.RoomMedalInfo
// @Router /v1/imGroup/medal/room [get] // @Router /v1/imGroup/medal/room [get]
func GetRoomMedal(c *gin.Context) (*mycontext.MyContext, error) { func GetRoomMedal(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
......
...@@ -246,7 +246,7 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -246,7 +246,7 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
groupIds = append(groupIds, i.ImGroupId) groupIds = append(groupIds, i.ImGroupId)
owners = append(owners, i.Owner) owners = append(owners, i.Owner)
} }
powerIds, powerNames, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -338,9 +338,16 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -338,9 +338,16 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
MicNumType: int(i.MicNumType), MicNumType: int(i.MicNumType),
GroupMedals: medals, GroupMedals: medals,
}, },
HasOnMic: true, HasOnMic: true,
GroupPowerId: powerIds[i.Owner], GroupPowerId: powerIds[i.Owner],
GroupPowerName: powerNames[i.Owner], GroupPowerName: powerNames[i.Owner],
GroupPowerNameplate: powerNameplates[i.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[i.Owner],
Name: powerNames[i.Owner],
Nameplate: powerNameplates[i.Owner],
Grade: powerGrades[i.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[i.ImGroupId]), RoomUserCount: uint(roomCount[i.ImGroupId]),
...@@ -468,7 +475,7 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -468,7 +475,7 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
for _, group := range groupInfos { for _, group := range groupInfos {
owners = append(owners, group.Owner) owners = append(owners, group.Owner)
} }
powerIds, powerNames, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -555,9 +562,16 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -555,9 +562,16 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
MicNumType: int(group.MicNumType), MicNumType: int(group.MicNumType),
GroupMedals: medals, GroupMedals: medals,
}, },
HasOnMic: true, HasOnMic: true,
GroupPowerId: powerIds[group.Owner], GroupPowerId: powerIds[group.Owner],
GroupPowerName: powerNames[group.Owner], GroupPowerName: powerNames[group.Owner],
GroupPowerNameplate: powerNameplates[group.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[group.Owner],
Name: powerNames[group.Owner],
Nameplate: powerNameplates[group.Owner],
Grade: powerGrades[group.Owner],
},
}, },
MicUsers: micUsers, MicUsers: micUsers,
RoomUserCount: uint(roomCount[group.ImGroupId]), RoomUserCount: uint(roomCount[group.ImGroupId]),
...@@ -1150,7 +1164,7 @@ func buildRoleMembers(model *domain.Model, groupId string, userId uint64) ([]gro ...@@ -1150,7 +1164,7 @@ func buildRoleMembers(model *domain.Model, groupId string, userId uint64) ([]gro
// @Param countryShortName query string true "国家缩写" // @Param countryShortName query string true "国家缩写"
// @Param pageSize query int true "分页大小 默认:10" default(10) // @Param pageSize query int true "分页大小 默认:10" default(10)
// @Param pageIndex query int true "第几个分页,从1开始 默认:1" default(1) // @Param pageIndex query int true "第几个分页,从1开始 默认:1" default(1)
// @Success 200 {object} cv.PopularGroupInfo // @Success 200 {object} group_cv.PopularGroupInfo
// @Router /v1/imGroup/country [get] // @Router /v1/imGroup/country [get]
func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) { func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
...@@ -1289,7 +1303,7 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -1289,7 +1303,7 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
groupIds = append(groupIds, i.ImGroupId) groupIds = append(groupIds, i.ImGroupId)
owners = append(owners, i.Owner) owners = append(owners, i.Owner)
} }
powerIds, powerNames, err := group_power_cv.BatchGetGroupPower(model.Db, owners) powerIds, powerNames, powerNameplates, powerGrades, err := group_power_cv.BatchGetGroupPower(model.Db, owners)
if err != nil { if err != nil {
return myContext, err return myContext, err
} }
...@@ -1369,9 +1383,16 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -1369,9 +1383,16 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
MicNumType: int(i.MicNumType), MicNumType: int(i.MicNumType),
GroupMedals: medals, GroupMedals: medals,
}, },
HasOnMic: micGroupNum[i.ImGroupId] > 0, HasOnMic: micGroupNum[i.ImGroupId] > 0,
GroupPowerId: powerIds[i.Owner], GroupPowerId: powerIds[i.Owner],
GroupPowerName: powerNames[i.Owner], GroupPowerName: powerNames[i.Owner],
GroupPowerNameplate: powerNameplates[i.Owner],
GroupPower: group_cv.GroupPower{
Id: powerIds[i.Owner],
Name: powerNames[i.Owner],
Nameplate: powerNameplates[i.Owner],
Grade: powerGrades[i.Owner],
},
}, },
MicUsers: []user_cv.CvUserTiny{}, MicUsers: []user_cv.CvUserTiny{},
RoomUserCount: uint(roomCount[i.ImGroupId]), RoomUserCount: uint(roomCount[i.ImGroupId]),
...@@ -1436,7 +1457,7 @@ func getCandidatesByCountry(model *domain.Model, bannedGroups map[string]uint64, ...@@ -1436,7 +1457,7 @@ func getCandidatesByCountry(model *domain.Model, bannedGroups map[string]uint64,
// @Param signature header string true "sha1加密结果" // @Param signature header string true "sha1加密结果"
// @Param deviceType header string true "系统类型 ios android" // @Param deviceType header string true "系统类型 ios android"
// @Param deviceVersion header string true "系统版本" // @Param deviceVersion header string true "系统版本"
// @Success 200 {object} cv.CvCountry // @Success 200 {object} group_cv.CvCountry
// @Router /v1/imGroup/country/prior [get] // @Router /v1/imGroup/country/prior [get]
func GroupountryPrior(c *gin.Context) (*mycontext.MyContext, error) { func GroupountryPrior(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
......
...@@ -921,7 +921,7 @@ func GroupMicMute(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -921,7 +921,7 @@ func GroupMicMute(c *gin.Context) (*mycontext.MyContext, error) {
// @Param nonce header string true "随机数字" // @Param nonce header string true "随机数字"
// @Param groupId formData string true "群ID" // @Param groupId formData string true "群ID"
// @Param content formData string true "内容" // @Param content formData string true "内容"
// @Success 200 {object} cv.CvDiamond // @Success 200 {object} diamond_cv.CvDiamond
// @Router /v1/imGroup/mic/mass [post] // @Router /v1/imGroup/mic/mass [post]
func GroupMicMass(c *gin.Context) (*mycontext.MyContext, error) { func GroupMicMass(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
...@@ -960,7 +960,7 @@ func GroupMicMass(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -960,7 +960,7 @@ func GroupMicMass(c *gin.Context) (*mycontext.MyContext, error) {
// @Param nonce header string true "随机数字" // @Param nonce header string true "随机数字"
// @Param groupId formData string true "群ID" // @Param groupId formData string true "群ID"
// @Param content formData string true "内容" // @Param content formData string true "内容"
// @Success 200 {object} cv.CvDiamond // @Success 200 {object} diamond_cv.CvDiamond
// @Router /v1/imGroup/mgr/mass [post] // @Router /v1/imGroup/mgr/mass [post]
func GroupMgrMass(c *gin.Context) (*mycontext.MyContext, error) { func GroupMgrMass(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
......
...@@ -67,7 +67,7 @@ func GetSupportPage(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -67,7 +67,7 @@ func GetSupportPage(c *gin.Context) (*mycontext.MyContext, error) {
// @Param token header string true "token" // @Param token header string true "token"
// @Param nonce header string true "随机数字" // @Param nonce header string true "随机数字"
// @Param groupId query string false "群ID" // @Param groupId query string false "群ID"
// @Success 200 {object} cv.SupportPageDetail // @Success 200 {object} group_cv.SupportPageDetail
// @Router /v1/imGroup/support/detail [get] // @Router /v1/imGroup/support/detail [get]
func GetSupportDetail(c *gin.Context) (*mycontext.MyContext, error) { func GetSupportDetail(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
...@@ -256,7 +256,7 @@ func TryAddSupporter(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -256,7 +256,7 @@ func TryAddSupporter(c *gin.Context) (*mycontext.MyContext, error) {
// @Param nonce header string true "随机数字" // @Param nonce header string true "随机数字"
// @Param groupId path string true "群ID" // @Param groupId path string true "群ID"
// @Param supporters formData string false "群支持者的externalId,用逗号分隔" // @Param supporters formData string false "群支持者的externalId,用逗号分隔"
// @Success 200 {object} cv.AwardResult // @Success 200 {object} group_cv.AwardResult
// @Router /v1/imGroup/support/award/{groupId} [post] // @Router /v1/imGroup/support/award/{groupId} [post]
func TakeSupportAward(c *gin.Context) (*mycontext.MyContext, error) { func TakeSupportAward(c *gin.Context) (*mycontext.MyContext, error) {
myContext := mycontext.CreateMyContext(c.Keys) myContext := mycontext.CreateMyContext(c.Keys)
......
package mic_r
import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/resource/mysql"
"github.com/gin-gonic/gin"
"hilo-group/domain/model/mic_m"
"hilo-group/resp"
)
type MGetUserOnMicSecondsReq struct {
Day string `form:"day" binding:"required"`
Ids []mysql.ID `form:"ids" binding:"required"`
}
// @Tags 麦位-内部
// @Summary 批量获取用户天上麦时长
// @Param day query string true "天 格式2006-001-02"
// @Param ids query string true "用户id,如:ids=1&ids=2&ids=3"
// @Success 200 {object} map[uint64]uint32
// @Router /inner/mic/onMicSeconds [get]
func MGetUserOnMicSeconds(c *gin.Context) (*mycontext.MyContext, error) {
myCtx := mycontext.CreateMyContext(c.Keys)
var model = domain.CreateModelContext(myCtx)
var req MGetUserOnMicSecondsReq
if err := c.ShouldBindQuery(&req); err != nil {
return myCtx, err
}
onMic, err := mic_m.MGetUserOnMicSeconds(model, req.Day, req.Ids)
if err != nil {
return myCtx, err
}
response := onMic
resp.ResponseOk(c, response)
return myCtx, nil
}
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
"hilo-group/domain/model/mgr_m" "hilo-group/domain/model/mgr_m"
"hilo-group/route/group_power_r" "hilo-group/route/group_power_r"
"hilo-group/route/group_r" "hilo-group/route/group_r"
"hilo-group/route/mic_r"
) )
func InitRouter() *gin.Engine { func InitRouter() *gin.Engine {
...@@ -125,7 +126,25 @@ func InitRouter() *gin.Engine { ...@@ -125,7 +126,25 @@ func InitRouter() *gin.Engine {
groupPower.GET("/team", wrapper(group_power_r.GroupPowerTeam)) groupPower.GET("/team", wrapper(group_power_r.GroupPowerTeam))
groupPower.GET("/billboard/week", wrapper(group_power_r.GroupPowerBillboardWeek)) groupPower.GET("/billboard/week", wrapper(group_power_r.GroupPowerBillboardWeek))
groupPower.GET("/billboard/owner/week", wrapper(group_power_r.GroupPowerBillboardOwnerWeek)) groupPower.GET("/billboard/owner/week", wrapper(group_power_r.GroupPowerBillboardOwnerWeek))
groupPower.GET("/rank/:period", wrapper(group_power_r.GroupPowerRank))
groupPower.GET("/star", wrapper(group_power_r.GroupPowerStar))
} }
h5GroupPower := v1.Group("/h5/groupPower")
{
h5GroupPower.GET("/grade/detail", wrapper(group_power_r.GroupPowerGradeDetail))
}
// 内部接口
inner := r.Group("/inner")
innerGroupPower := inner.Group("/groupPower")
{
innerGroupPower.GET("/infos", wrapper(group_power_r.MGetGroupPowers))
}
innerMic := inner.Group("/mic")
{
innerMic.GET("/onMicSeconds", wrapper(mic_r.MGetUserOnMicSeconds))
}
r.GET("/test", wrapper(group_power_r.Test))
return r return r
} }
......
MODE=local
package test
import (
"git.hilo.cn/hilo-common/domain"
"hilo-group/domain/model/groupPower_m"
"testing"
)
func TestGetAllGroupPowerOwner(t *testing.T) {
owners, err := groupPower_m.GetAllGroupPowerOwners(domain.CreateModelNil())
println(owners, err)
}
[DATABASE]
MYSQL_HOST=47.244.34.27:3306
MYSQL_USERNAME=root
MYSQL_PASSWORD=yX0jPAhO0I4s2zlA
MYSQL_DB=hilo
[DATABASECODE]
MYSQL_HOST=47.244.34.27:3306
MYSQL_USERNAME=root
MYSQL_PASSWORD=yX0jPAhO0I4s2zlA
MYSQL_DB=hilo_code
[REDIS]
REDIS_HOST=47.244.34.27:6379
REDIS_PASSWORD=8QZ9JD1zLvPR3yHf
[JWT]
SECRET=hilo1632
ISSUER_API=hiloApi
ISSUER_Mgr=hiloMgr
EXPIRE=240h
[GAMEJWT]
SECRET=hilo1632
ISSUER_CLIENT=hiloClient
ISSUER_SERVER=hiloServer
EXPIRE=240h
[APP]
MASTER=false
BIZ_SECRET=biz
WEB_SECRET=webHilo1258
OPERATION_SECRET=operation1258236
SUPERUSER=2701,2831
OFFICIAL_STAFF=2701,2831
OFFICIAL_GROUP=@TGS#3NC2ATRHS,@TGS#33W3KNLHK
MINIMAL_VERSION_ANDROID=212
MINIMAL_VERSION_IOS=100
MODERATE=AWS
[OSS]
OSS_ACCESS_KEY_ID=LTAIxdazV2pCuV3T
OSS_ACCESS_KEY_SECRET=zuAnreAXQ6vlAKnvvmolFLfb1N5w5S
OSS_ROLE_ARN=acs:ram::1509841556585969:role/aliyunosstokengeneratorrole
OSS_END_POINT=http://oss-accelerate.aliyuncs.com
OSS_BUCKET=starvoice
OSS_CDN=https://oss.chathot.me/
OSS_EXPIRED_TIME=3600
OSS_STS_POINT=me-east-1
OSS_STS=sts-faceline-demo
OSS_STS_AES=484194d4d0f968a7
[AWS]
AWS_BUCKET=starchat
AWS_CDN=https://image.whoisamy.shop/
AWS_DIR=hilo/
CONFIDENCE=80
[RONGYUN]
RONG_CLOUD_APP_KEY=pvxdm17jpe9tr
RONG_CLOUD_APP_SECRET=rI4giiKWaBS4
RONG_CLOUD_URL=https://api-sg01.ronghub.com
[TENCENTYUN]
TENCENTYUN_APP_ID=1400548270
TENCENTYUN_KEY=321bd60f73096b059c7350f1cd97d51028850b34fa58c5c0d26bb4a19e783de8
TX_OVERSEA_APP_ID=40000066
TX_OVERSEA_KEY=3ab68ea5bddc8774d90b8c764ae71188914bd5fd06f30b28790c51e44ca7885c
[EMAS]
REGION_ID=cn-hangzhou
ACCESS_KEY_ID=LTAI4FhNPzxdzD4w6bHirL9Z
ACCESS_KEY_SECRET=OQvUJpXDrjGi3g1F2aHiAIFWIvLdbP
ANDROID_APP_KEY=30250713
ANDROID_APP_SECRET=cae7b9a9d3e54577d2c3b60bf6d23047
IOS_APP_KEY=30240346
IOS_APP_SECRET=57f33ab9ca6a957a8c659f2b0b6d1205
APNS=DEV
[AGORA]
APP_ID=fc3e087f701b4f788099e1924c3cc7b0
APP_CERTIFICATE=ff29c100a613433db82324e8411eabc8
CUSTOMER_KEY=6b132c0ff7164560a2bc53fda06ea85a
CUSTOMER_SECRET=eedad2cd16d24834990d5450ace9f1ce
CALLBACK_SECRET=n_ZizS_N8
[CHECKOUT]
AUTHORIZATION=sk_test_9b5e771c-5a3f-4a8d-a4da-31b19bd43d83
URL=https://api.sandbox.checkout.com/hosted-payments
H5=http://test.chathot.me/action/hiloHtml/22_05_30_recharge/topup.html
HILO_SECRET_KEY=sk_test_dfbaa3b6-135d-4376-9996-2089b7d8a086
[MATCH]
MATCH_FREE_TIME=60
MATCH_FREE_TIME_VIP=300
MATCH_ADD_TIME_FREE=90
MATCH_AGORA_TIME=30
MATCH_CYCLE=8
MATCH_USER_EXPIRES=480
MATCH_SUCCESS_WAIT_DURATION=10
MATCH_SUCCESS_SINGLE_WAIT_TIME_IN_SEC=12
MATCH_SUCCESS_DUAL_WAIT_TIME_IN_SEC=15
[ONLINE]
ONLINE_CYCLE=600
ONLINE_USER_EXPIRES=259200
[VIDEO]
VIDEO_DAILY_FREE_NUM=20
VIDEO_FREE_TIME=60
VIDEO_FREE_TIME_VIP=300
VIDEO_ADD_TIME_FREE=60
VIDEO_AGORA_TIME=30
VIDEO_MINUTE_NORMAL=1000
VIDEO_MINUTE_UNION=2000
[SESSION]
SESSION_DAILY_FREE_NUM=50
[BEAN]
DIAMOND_BEAN_RATE=90
[H5]
USER_LEVEL=http://test.chathot.me/action/activityhtml/hiloUserLevel/index.html
GROUP_SUPPORT=http://test.chathot.me/action/activityhtml/21_12_06/page.html
LUCKY_WHEEL=https://h5.whoisamy.shop/action/activityhtml/21_12_30/page.html
NOBLE_BUY_IOS=https://h5.whoisamy.shop/action/hiloHtml/lxt_h5/page.html
[GROUPIM]
MSG_SORT_EXPIRE=43200
MSG_SORT_SNAP=300
[GRADE]
CHARM_SPEED_VIP=15
ACTITY_SPEED_VIP=15
WEALTH_SPEED_VIP=15
[LIKE]
I_LIKE_NUM=30
I_LIKE_NUM_VIP=100
I_LIKE_NUM_NOBLE=1000
[APPLEPAY]
PASSWORD=38702750a05c4cb09c9d6ca646835634
[REGISTER]
IMEI_TOTAL=3
IMEI_OAUTH=2
ACCOUNT_IP=100
ACCOUNT_IP_DURATION=21600
[BANNER]
GIFT_BANNER_LEVEL1=100
GIFT_BANNER_LEVEL2=2000
GIFT_BANNER_LEVEL3=5000
[DIAMOND]
DAILY_LOGIN_IMEI_LIMIT=200
DAILY_LOGIN_IP_LIMIT=5
PRIVATE_GIFT_RETURN=1440
NEW_USER_INVITE_AWARD=5000
[LUCKY_WHEEL]
MINIMAL_PARTICIPANT=2
WAIT_TIMELONG=10
WINNER_DIAMOND_BANNER=100
[GROUP_CUSTOM_THEME]
PIC_LIMIT=5
DAY=10
[GIFT]
WALL_DIAMOND=10
[DAILY]
LOGIN_COMMON=5
LOGIN_VIP=300
[DAILY]
LOGIN_COMMON=5
LOGIN_VIP=300
[FRUIT_TYCOON]
POOL_RATIO=20
WATERMELON_RATIO=70
[ACTIVITY]
COUNTRY_STAR_POOL_RATIO=20
COUNTRY_STAR_ORDINARY_RATIO=20
[PAYER_MAX]
URL=https://pay-gate-uat.payermax.com/aggregate-pay-gate/api/gateway
KEY=d50d149a883b8bb6
MERCHANT_ID=SP11018326
BIZ_TYPE=CUSTOMIZE
VERSION=2.3
FRONT_CALLBACK_URL=https://www.hiloconn.com
SHOW_RESULT=1
EXPIRE_TIME=1800
LANGUAGE=en
[SUD]
API_LIST=https://sim-asc.sudden.ltd
[URL]
BIZ_HTTP=https://test.apiv1.faceline.live
\ No newline at end of file