feat: 修复排行榜,添加新的排行榜

main
NorthLan 3 years ago
parent c341b8a09d
commit 66ee7ea63a

@ -11,9 +11,17 @@ var _ RankPvpModel = (*customRankPvpModel)(nil)
const (
RankTypeDamage = iota + 1
RankTypeDeDamage
RankTypeGeneral
RankTypeDeGeneral
RankTypeKillUnit
RankTypeDeKillUnit
RankTypeKillPlayer
RankTypeDeKillPlayer
RankTypeWin
RankTypeLost
RankTypeFirstBlood
RankTypeDeFirstBlood
)
const MaxRankN = 50
@ -56,9 +64,8 @@ func (m *customRankPvpModel) RankListByType(ctx context.Context, rankType, topN
err := db.Model(&RankPvpWithPlatformUser{}).
Select(fmt.Sprintf("%s.*, UP.platform, UP.p_uname, UP.p_avatar", m.table)).
Joins(fmt.Sprintf("LEFT JOIN user_platform UP ON UP.user_id = %s.user_id", m.table)).
Where("rank_type = ?", rankType).
Where(fmt.Sprintf("%s.user_id > 0 AND rank_type = ?", m.table), rankType).
Limit(int(limit)).
Order("score desc"). // score 排名
Find(&result).Error
switch err {
case nil:

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
)
@ -13,10 +12,18 @@ var _ StatisticsPvpModel = (*customStatisticsPvpModel)(nil)
type ScoreType string
const (
ScoreTypeDamage ScoreType = "damage"
ScoreTypeGeneral = "general_count"
ScoreTypeKillUnit = "kill_unit_count"
ScoreTypeKillPlayer = "kill_player_count"
ScoreTypeDamage ScoreType = "damage"
ScoreTypeDeDamage = "de_damage"
ScoreTypeGeneral = "general_count"
ScoreTypeDeGeneral = "de_general_count"
ScoreTypeKillUnit = "kill_unit_count"
ScoreTypeDeKillUnit = "de_kill_unit_count"
ScoreTypeKillPlayer = "kill_player_count"
ScoreTypeDeKillPlayer = "de_kill_player_count"
ScoreTypeWin = "win_count"
ScoreTypeLost = "lost_count"
ScoreTypeFirstBlood = "first_blood_count"
ScoreTypeDeFirstBlood = "de_first_blood_count"
)
type (
@ -24,11 +31,14 @@ type (
// and implement the added methods in customStatisticsPvpModel.
StatisticsPvpModel interface {
statisticsPvpModel
Exists(ctx context.Context, userId int64) (bool, error)
UpdateRecord(ctx context.Context, userId int64, props *UpdateRecordProps) error
RecordPvp(ctx context.Context, winUids, lostUids []int64) error
// Transaction 开启事务,传入方法即可
Transaction(ctx context.Context, tx *gorm.DB, fn func(tx *gorm.DB) error) error
// InsertTx 插入事务
InsertTx(ctx context.Context, tx *gorm.DB, data *StatisticsPvp) error
// UpdateRecord 更新记录
UpdateRecord(ctx context.Context, tx *gorm.DB, userId int64, props *UpdateRecordProps) error
// FindGreaterByScore 找到比给定分数大的用户id以及具体分数
FindGreaterByScore(ctx context.Context, score int64, scoreType ScoreType) ([]UserAndScore, error)
FindGreaterByScore(ctx context.Context, score int64, scoreType ScoreType, limit int) ([]UserAndScore, error)
}
UserAndScore struct {
@ -37,16 +47,18 @@ type (
}
UpdateRecordProps struct {
KillUnit bool // 是否击杀单位
DeKillUnit bool // 是否单位被击杀
KillPlayer bool // 是否击杀玩家
DeKillPlayer bool // 是否玩家被击杀
General bool // 是否拿到名将
DeGeneral bool // 是否名将罗马
FirstBlood bool // 是否拿到一血
DeFirstBlood bool // 是否被拿一血
Damage *int64 // 伤害
DeDamage *int64 // 被伤害
Damage *int64 // 伤害
DeDamage *int64 // 被伤害
KillUnitCount *int64 // 击杀单位数量
DeKillUnitCount *int64 // 被击杀单位被击杀
Win bool // 是否获胜
Lost bool // 是否战败
KillPlayer bool // 是否击杀玩家
DeKillPlayer bool // 是否玩家被击杀
General bool // 是否拿到名将
DeGeneral bool // 是否名将罗马
FirstBlood bool // 是否拿到一血
DeFirstBlood bool // 是否被拿一血
}
customStatisticsPvpModel struct {
@ -61,22 +73,21 @@ func NewStatisticsPvpModel(conn *gorm.DB) StatisticsPvpModel {
}
}
func (m *customStatisticsPvpModel) Exists(ctx context.Context, userId int64) (bool, error) {
var count int64
err := m.conn.WithContext(ctx).Model(&StatisticsPvp{}).Where("user_id = ?", userId).Count(&count).Error
switch err {
case nil:
return count > 0, nil
case gormc.ErrNotFound:
return false, ErrNotFound
default:
return false, err
}
func (m *customStatisticsPvpModel) InsertTx(ctx context.Context, tx *gorm.DB, data *StatisticsPvp) error {
return withTx(ctx, m.conn, tx).Create(data).Error
}
func (m *customStatisticsPvpModel) UpdateRecord(ctx context.Context, userId int64, props *UpdateRecordProps) error {
func (m *customStatisticsPvpModel) Transaction(ctx context.Context, tx *gorm.DB, fn func(tx *gorm.DB) error) error {
return withTx(ctx, m.conn, tx).Transaction(func(tx *gorm.DB) error {
return fn(tx)
})
}
func (m *customStatisticsPvpModel) UpdateRecord(ctx context.Context, tx *gorm.DB, userId int64, props *UpdateRecordProps) error {
// 条件构建
db := m.conn.WithContext(ctx).Model(&StatisticsPvp{}).Where("user_id = ?", userId)
db := withTx(ctx, m.conn, tx)
db = db.Model(&StatisticsPvp{}).Where("user_id = ?", userId)
data := make(map[string]interface{})
if props.Damage != nil {
data["damage"] = gorm.Expr("damage + ?", *props.Damage)
@ -84,11 +95,17 @@ func (m *customStatisticsPvpModel) UpdateRecord(ctx context.Context, userId int6
if props.DeDamage != nil {
data["de_damage"] = gorm.Expr("de_damage + ?", *props.DeDamage)
}
if props.KillUnit {
data["kill_unit_count"] = gorm.Expr("kill_unit_count + 1")
if props.KillUnitCount != nil {
data["kill_unit_count"] = gorm.Expr("kill_unit_count + ?", *props.KillUnitCount)
}
if props.DeKillUnitCount != nil {
data["de_kill_unit_count"] = gorm.Expr("de_kill_unit_count + ?", *props.DeKillUnitCount)
}
if props.DeKillUnit {
data["de_kill_unit_count"] = gorm.Expr("de_kill_unit_count + 1")
if props.Win {
data["win_count"] = gorm.Expr("win_count + 1")
}
if props.Lost {
data["lost_count"] = gorm.Expr("lost_count + 1")
}
if props.KillPlayer {
data["kill_player_count"] = gorm.Expr("kill_player_count + 1")
@ -108,32 +125,26 @@ func (m *customStatisticsPvpModel) UpdateRecord(ctx context.Context, userId int6
if props.DeFirstBlood {
data["de_first_blood_count"] = gorm.Expr("de_first_blood_count + 1")
}
return db.Updates(data).Error
}
func (m *customStatisticsPvpModel) RecordPvp(ctx context.Context, winUids, lostUids []int64) error {
return m.conn.Transaction(func(tx *gorm.DB) error {
err := tx.WithContext(ctx).Model(&StatisticsPvp{}).
Where("user_id in (?)", winUids).
Update("win_count", gorm.Expr("win_count + 1")).
Error
if err != nil {
logx.Error("更新PvP胜场失败 %+v", err)
}
err = tx.WithContext(ctx).Model(&StatisticsPvp{}).
Where("user_id in (?)", lostUids).
Update("lost_count", gorm.Expr("lost_count + 1")).
Error
if err != nil {
logx.Error("更新PvP败失败 %+v", err)
}
return err
})
result := db.Updates(data)
if result.Error != nil {
return result.Error
}
if result.RowsAffected == 0 {
return ErrRowsAffectedZero
}
return nil
}
func (m *customStatisticsPvpModel) FindGreaterByScore(ctx context.Context, score int64, scoreType ScoreType) ([]UserAndScore, error) {
func (m *customStatisticsPvpModel) FindGreaterByScore(ctx context.Context, score int64, scoreType ScoreType, limit int) ([]UserAndScore, error) {
db := m.conn.WithContext(ctx)
if limit > MaxRankN {
limit = MaxRankN
}
if limit <= 0 {
limit = MaxRankN
}
whereSql := fmt.Sprintf("%s.%s >= %d", m.table, scoreType, score)
// 0 不入榜
if score == 0 {
@ -142,8 +153,9 @@ func (m *customStatisticsPvpModel) FindGreaterByScore(ctx context.Context, score
var result []UserAndScore
err := db.Table(m.table).
Select(fmt.Sprintf("%s.user_id, %s.%s AS score", m.table, m.table, scoreType)).
Where(whereSql).
Limit(MaxRankN).Find(&result).Error
Where(fmt.Sprintf("%s AND user_id > 0", whereSql)).
Order("score desc").
Limit(limit).Find(&result).Error
switch err {
case nil:
return result, nil

@ -1,6 +1,8 @@
package model
import (
"context"
"git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc"
"gorm.io/gorm"
)
@ -11,6 +13,9 @@ type (
// and implement the added methods in customUserModel.
UserModel interface {
userModel
// InsertTx 插入事务
InsertTx(ctx context.Context, tx *gorm.DB, data *User) error
FindOneTx(ctx context.Context, tx *gorm.DB, id int64) (*User, error)
}
customUserModel struct {
@ -24,3 +29,21 @@ func NewUserModel(conn *gorm.DB) UserModel {
defaultUserModel: newUserModel(conn),
}
}
func (m *customUserModel) InsertTx(ctx context.Context, tx *gorm.DB, data *User) error {
return withTx(ctx, m.conn, tx).Create(data).Error
}
func (m *customUserModel) FindOneTx(ctx context.Context, tx *gorm.DB, id int64) (*User, error) {
db := withTx(ctx, m.conn, tx)
var resp User
err := db.Model(&User{}).Where("`id` = ?", id).Take(&resp).Error
switch err {
case nil:
return &resp, nil
case gormc.ErrNotFound:
return nil, ErrNotFound
default:
return nil, err
}
}

@ -14,8 +14,12 @@ type (
// and implement the added methods in customUserPlatformModel.
UserPlatformModel interface {
userPlatformModel
// Transaction 开启事务,传入方法即可
Transaction(ctx context.Context, tx *gorm.DB, fn func(tx *gorm.DB) error) error
// InsertTx 事务插入
InsertTx(ctx context.Context, tx *gorm.DB, data *UserPlatform) error
// FindOneByPlatformAndPUid 查询平台用户
FindOneByPlatformAndPUid(ctx context.Context, platform, pUid string) (*UserPlatform, error)
FindOneByPlatformAndPUid(ctx context.Context, tx *gorm.DB, platform, pUid string) (*UserPlatform, error)
// FindEmptyList 查询从未更新过平台信息的用户
FindEmptyList(ctx context.Context, num int64) ([]UserPlatform, error)
// FindUpdatableList 查询过期需要更新信息的用户
@ -35,6 +39,10 @@ type (
}
)
func (m *customUserPlatformModel) InsertTx(ctx context.Context, tx *gorm.DB, data *UserPlatform) error {
return withTx(ctx, m.conn, tx).Create(data).Error
}
// NewUserPlatformModel returns a model for the database table.
func NewUserPlatformModel(conn *gorm.DB) UserPlatformModel {
return &customUserPlatformModel{
@ -42,9 +50,17 @@ func NewUserPlatformModel(conn *gorm.DB) UserPlatformModel {
}
}
func (m *customUserPlatformModel) FindOneByPlatformAndPUid(ctx context.Context, platform, pUid string) (*UserPlatform, error) {
func (m *customUserPlatformModel) Transaction(ctx context.Context, tx *gorm.DB, fn func(tx *gorm.DB) error) error {
return withTx(ctx, m.conn, tx).Transaction(func(tx *gorm.DB) error {
return fn(tx)
})
}
func (m *customUserPlatformModel) FindOneByPlatformAndPUid(ctx context.Context, tx *gorm.DB, platform, pUid string) (*UserPlatform, error) {
db := withTx(ctx, m.conn, tx)
var resp UserPlatform
err := m.conn.WithContext(ctx).Model(&UserPlatform{}).Where("`platform` = ? AND `p_uid` = ?", platform, pUid).Take(&resp).Error
err := db.Model(&UserPlatform{}).Where("`platform` = ? AND `p_uid` = ?", platform, pUid).Take(&resp).Error
switch err {
case nil:
return &resp, nil

@ -0,0 +1,14 @@
package model
import (
"context"
"gorm.io/gorm"
)
func withTx(ctx context.Context, conn, tx *gorm.DB) *gorm.DB {
if tx != nil {
return tx
} else {
return conn.WithContext(ctx)
}
}

@ -1,5 +1,9 @@
package model
import "gorm.io/gorm"
import (
"errors"
"gorm.io/gorm"
)
var ErrNotFound = gorm.ErrRecordNotFound
var ErrRowsAffectedZero = errors.New("RowsAffected zero")

@ -4,12 +4,16 @@ Etcd:
Hosts:
- 127.0.0.1:2379
Key: usercenter.rpc.dev
Timeout: 5000 # default is 2000
NonBlock: true
DB:
#DataSource: root:root@tcp(192.168.1.100:3306)/dmgame?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true
DataSource: root:root@tcp(127.0.0.1:3306)/dmgame?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true
User:
UserRetriever:
Enabled: false
UpdateDuration: 720 # 720 hours = 30 Day = 1 Month
Rank:
Enabled: true
Log:
Mode: console
KeepDays: 7

@ -4,12 +4,16 @@ Etcd:
Hosts:
- 127.0.0.1:2379
Key: usercenter.rpc
Timeout: 5000 # default is 2000
NonBlock: true
DB:
#DataSource: root:root@tcp(192.168.1.100:3306)/dmgame?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true
DataSource: root:root@tcp(127.0.0.1:3306)/dmgame?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true
User:
UserRetriever:
Enabled: true
UpdateDuration: 720 # 720 hours = 30 Day = 1 Month
Rank:
Enabled: true
Log:
Mode: file
KeepDays: 7

@ -22,8 +22,13 @@ type (
DataSource string
}
User struct {
UserRetriever struct {
Enabled bool // 是否开启
UpdateDuration int64 // 用户信息更新最短间隔 单位 h
}
Rank struct {
Enabled bool // 是否开启
}
}
)

@ -72,7 +72,7 @@ func (r *UserRetriever) Scheduler() {
r.retrieveList(list)
// 优先加载空信息用户
if len(list) <= 0 {
if list, err = r.svcCtx.UserPlatformModel.FindUpdatableList(r.ctx, r.svcCtx.Config.User.UpdateDuration, 5); err != nil {
if list, err = r.svcCtx.UserPlatformModel.FindUpdatableList(r.ctx, r.svcCtx.Config.UserRetriever.UpdateDuration, 5); err != nil {
return
}
r.retrieveList(list)

@ -26,10 +26,18 @@ type (
svcCtx *svc.ServiceContext
// 实时排行榜(定期读取,半实时)
damageRank *zset.ZSetInt
generalRank *zset.ZSetInt
killUnitRank *zset.ZSetInt
killPlayerRank *zset.ZSetInt
damageRank *zset.ZSetInt
deDamageRank *zset.ZSetInt
generalRank *zset.ZSetInt
deGeneralRank *zset.ZSetInt
killUnitRank *zset.ZSetInt
deKillUnitRank *zset.ZSetInt
killPlayerRank *zset.ZSetInt
deKillPlayerRank *zset.ZSetInt
winRank *zset.ZSetInt
lostRank *zset.ZSetInt
firstBloodRank *zset.ZSetInt
deFirstBloodRank *zset.ZSetInt
// 用户数据表内存缓存
userCache *lru.Cache
@ -42,13 +50,21 @@ func InitRankJob(svcCtx *svc.ServiceContext) {
}
uc, _ := lru.New(4*model.MaxRankN + 1000)
Service = &Job{
ctx: context.Background(),
svcCtx: svcCtx,
damageRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
generalRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
killUnitRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
killPlayerRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
userCache: uc,
ctx: context.Background(),
svcCtx: svcCtx,
damageRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
deDamageRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
generalRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
deGeneralRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
killUnitRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
deKillUnitRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
killPlayerRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
deKillPlayerRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
winRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
lostRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
firstBloodRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
deFirstBloodRank: zset.NewZSetInt(lessFunc, model.MaxRankN),
userCache: uc,
}
Service.initJob()
}
@ -65,22 +81,82 @@ func (j *Job) initJob() {
j.initByType(model.RankTypeKillPlayer)
// job read and update
c1 := cron.New()
_, _ = c1.AddFunc("@every 1s", func() {
go j.readAndUpdate(model.RankTypeDamage)
go j.readAndUpdate(model.RankTypeGeneral)
go j.readAndUpdate(model.RankTypeKillUnit)
go j.readAndUpdate(model.RankTypeKillPlayer)
})
c2 := cron.New()
_, _ = c2.AddFunc("@every 10min", func() {
go j.persistence(model.RankTypeDamage)
go j.persistence(model.RankTypeGeneral)
go j.persistence(model.RankTypeKillUnit)
go j.persistence(model.RankTypeKillPlayer)
})
c1.Start()
c2.Start()
c := cron.New()
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeDamage)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeDeDamage)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeGeneral)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeDeGeneral)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeKillUnit)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeDeKillUnit)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeKillPlayer)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeDeKillPlayer)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeWin)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeLost)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeFirstBlood)
})
_, _ = c.AddFunc("@every 10s", func() {
j.readAndUpdate(model.RankTypeDeFirstBlood)
})
// persistence
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeDamage)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeDeDamage)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeGeneral)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeDeGeneral)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeKillUnit)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeDeKillUnit)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeKillPlayer)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeDeKillPlayer)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeWin)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeLost)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeFirstBlood)
})
_, _ = c.AddFunc("@every 10m", func() {
j.persistence(model.RankTypeDeFirstBlood)
})
c.Start()
}
func (j *Job) RangeRankByType(rankType, topN int32) *pb.RankPvpResp {
@ -171,9 +247,15 @@ func (j *Job) readAndUpdate(rankType int32) {
last := rank[len(rank)-1]
score = last[1]
}
// 若榜内数量不够,则直接取 max - current 数量的人 score排序一下
limit := model.MaxRankN
if len(rank) < model.MaxRankN {
limit = model.MaxRankN - len(rank)
score = 0
}
// 末位 score
byScore, err := j.svcCtx.StatisticsPvpModel.FindGreaterByScore(j.ctx, score, scoreType)
byScore, err := j.svcCtx.StatisticsPvpModel.FindGreaterByScore(j.ctx, score, scoreType, limit)
if err != nil {
return
}
@ -229,15 +311,39 @@ func (j *Job) getRankInstanceAndScoreType(rankType int32) (*zset.ZSetInt, model.
case model.RankTypeDamage:
rankZSet = j.damageRank
scoreType = model.ScoreTypeDamage
case model.RankTypeDeDamage:
rankZSet = j.deDamageRank
scoreType = model.ScoreTypeDeDamage
case model.RankTypeGeneral:
rankZSet = j.generalRank
scoreType = model.ScoreTypeGeneral
case model.RankTypeDeGeneral:
rankZSet = j.deGeneralRank
scoreType = model.ScoreTypeDeGeneral
case model.RankTypeKillUnit:
rankZSet = j.killUnitRank
scoreType = model.ScoreTypeKillUnit
case model.RankTypeDeKillUnit:
rankZSet = j.deKillUnitRank
scoreType = model.ScoreTypeDeKillUnit
case model.RankTypeKillPlayer:
rankZSet = j.killPlayerRank
scoreType = model.ScoreTypeKillPlayer
case model.RankTypeDeKillPlayer:
rankZSet = j.deKillPlayerRank
scoreType = model.ScoreTypeDeKillPlayer
case model.RankTypeWin:
rankZSet = j.winRank
scoreType = model.ScoreTypeWin
case model.RankTypeLost:
rankZSet = j.lostRank
scoreType = model.ScoreTypeLost
case model.RankTypeFirstBlood:
rankZSet = j.firstBloodRank
scoreType = model.ScoreTypeFirstBlood
case model.RankTypeDeFirstBlood:
rankZSet = j.deFirstBloodRank
scoreType = model.ScoreTypeDeFirstBlood
}
if rankZSet == nil {
return nil, scoreType, errors.Errorf("没有此类型 [%d] 的排行榜", rankType)

@ -4,6 +4,7 @@ import (
"context"
"git.noahlan.cn/northlan/ntools-go/uuid"
"github.com/pkg/errors"
"gorm.io/gorm"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
@ -28,44 +29,44 @@ func NewRetrievePlatformUserLogic(ctx context.Context, svcCtx *svc.ServiceContex
// RetrievePlatformUser 查询或创建用户(此时不查询平台用户信息)
func (l *RetrievePlatformUserLogic) RetrievePlatformUser(in *pb.PlatformUserReq) (*pb.PlatformUserResp, error) {
var err error
dbPlatformUser, err := l.svcCtx.UserPlatformModel.FindOneByPlatformAndPUid(l.ctx, in.Platform, in.PUid)
if err != nil {
if !errors.Is(err, model.ErrNotFound) {
return nil, err // sql错误
var username string
var dbPlatformUser *model.UserPlatform
err := l.svcCtx.UserPlatformModel.Transaction(l.ctx, nil, func(tx *gorm.DB) error {
var err error
if dbPlatformUser, err = l.svcCtx.UserPlatformModel.FindOneByPlatformAndPUid(l.ctx, tx, in.Platform, in.PUid); err != nil {
if !errors.Is(err, model.ErrNotFound) {
return err
}
}
}
if dbPlatformUser != nil {
var username string
if one, err := l.svcCtx.UserModel.FindOne(l.ctx, dbPlatformUser.UserId); err != nil {
username = one.Username
if dbPlatformUser != nil {
if one, err := l.svcCtx.UserModel.FindOneTx(l.ctx, tx, dbPlatformUser.UserId); err != nil {
username = one.Username
}
return nil
}
return &pb.PlatformUserResp{
User: l.buildPBUser(username, dbPlatformUser),
}, nil
}
// create
dbUser := &model.User{
Id: uuid.NextId(),
Username: "",
}
if err = l.svcCtx.UserModel.Insert(l.ctx, dbUser); err != nil {
return nil, errors.Wrap(err, "插入用户数据失败")
}
dbPlatformUser = &model.UserPlatform{
Id: uuid.NextId(),
UserId: dbUser.Id,
Platform: in.Platform,
PUid: in.PUid,
PInfo: "{}",
}
if err = l.svcCtx.UserPlatformModel.Insert(l.ctx, dbPlatformUser); err != nil {
return nil, errors.Wrap(err, "插入平台用户数据失败")
// insert
newId := uuid.NextId()
if err := l.svcCtx.UserModel.InsertTx(l.ctx, tx, &model.User{Id: newId}); err != nil {
return errors.Wrap(err, "插入用户数据失败")
}
dbPlatformUser = &model.UserPlatform{
Id: uuid.NextId(),
UserId: newId,
Platform: in.Platform,
PUid: in.PUid,
PInfo: "{}",
}
if err := l.svcCtx.UserPlatformModel.InsertTx(l.ctx, tx, dbPlatformUser); err != nil {
return errors.Wrap(err, "插入平台用户数据失败")
}
return nil
})
if err != nil {
return nil, errors.Wrapf(err, "查询或创建用户-事务执行失败, err:%+v", err)
}
return &pb.PlatformUserResp{
User: l.buildPBUser(dbUser.Username, dbPlatformUser),
User: l.buildPBUser(username, dbPlatformUser),
}, nil
}

@ -1,66 +0,0 @@
package statistics
import (
"context"
"github.com/pkg/errors"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type StatPvpDamageLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewStatPvpDamageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatPvpDamageLogic {
return &StatPvpDamageLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// statistics
func (l *StatPvpDamageLogic) StatPvpDamage(in *pb.StatPvPDamageReq) (*pb.Empty, error) {
damage64 := int64(in.Damage)
exists, _ := l.svcCtx.StatisticsPvpModel.Exists(l.ctx, in.Uid)
if !exists {
dbModel := &model.StatisticsPvp{
UserId: in.Uid,
Damage: damage64,
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, dbModel); err != nil {
return nil, errors.Wrapf(err, ErrInsertErr, err)
}
return &pb.Empty{}, nil
}
// 原始记录存在,直接更新,提高效率
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, in.Uid, &model.UpdateRecordProps{Damage: &damage64}); err != nil {
return nil, errors.Wrapf(err, ErrUpdateErr, err)
}
// 承伤
if in.TargetUid != nil {
tUid := *in.TargetUid
exists, _ = l.svcCtx.StatisticsPvpModel.Exists(l.ctx, tUid)
if !exists {
dbModel := &model.StatisticsPvp{
UserId: tUid,
DeDamage: int64(in.Damage),
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, dbModel); err != nil {
return nil, errors.Wrapf(err, ErrInsertErr, err)
}
return &pb.Empty{}, nil
}
// 原始记录存在,直接更新,提高效率
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tUid, &model.UpdateRecordProps{DeDamage: &damage64}); err != nil {
return nil, errors.Wrapf(err, ErrUpdateErr, err)
}
}
return &pb.Empty{}, nil
}

@ -3,6 +3,7 @@ package statistics
import (
"context"
"github.com/pkg/errors"
"gorm.io/gorm"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
@ -30,33 +31,42 @@ const (
)
func (l *StatPvpFirstBloodLogic) StatPvpFirstBlood(in *pb.StatPvPFirstBloodReq) (*pb.Empty, error) {
exists, _ := l.svcCtx.StatisticsPvpModel.Exists(l.ctx, in.Uid)
if !exists {
dbModel := &model.StatisticsPvp{
UserId: in.Uid,
}
// 虚拟UID
if in.Uid <= 0 {
return &pb.Empty{}, nil
}
err := l.svcCtx.StatisticsPvpModel.Transaction(l.ctx, nil, func(tx *gorm.DB) error {
// 直接更新,提高效率
props := model.UpdateRecordProps{}
if in.Type == TypeFirstBlood {
dbModel.FirstBloodCount = 1
props.FirstBlood = true
} else if in.Type == TypeDeFirstBlood {
dbModel.DeFirstBloodCount = 1
props.DeFirstBlood = true
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, dbModel); err != nil {
return nil, errors.Wrapf(err, ErrInsertErr, err)
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.Uid,
&props); err != nil {
if errors.Is(err, model.ErrRowsAffectedZero) {
// insert
dbModel := model.StatisticsPvp{
UserId: in.Uid,
}
if in.Type == TypeFirstBlood {
dbModel.FirstBloodCount = 1
} else if in.Type == TypeDeFirstBlood {
dbModel.DeFirstBloodCount = 1
}
if err = l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, &dbModel); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}
} else {
return errors.Wrapf(err, ErrUpdateErr, err)
}
}
return &pb.Empty{}, nil
}
// 原始记录存在,直接更新,提高效率
props := &model.UpdateRecordProps{}
if in.Type == TypeFirstBlood {
props.FirstBlood = true
} else if in.Type == TypeDeFirstBlood {
props.DeFirstBlood = true
} else {
l.Logger.Error("是否拿到一血 Type 有问题不是1或2?")
return &pb.Empty{}, nil
}
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, in.Uid, props); err != nil {
return nil, errors.Wrapf(err, ErrUpdateErr, err)
return nil
})
if err != nil {
return nil, errors.Wrapf(err, "一血报送-事务执行失败, err:%+v", err)
}
return &pb.Empty{}, nil
}

@ -3,6 +3,7 @@ package statistics
import (
"context"
"github.com/pkg/errors"
"gorm.io/gorm"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/svc"
@ -26,44 +27,58 @@ func NewStatPvpKillLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatP
}
func (l *StatPvpKillLogic) StatPvpKill(in *pb.StatPvPKillReq) (*pb.Empty, error) {
exists, _ := l.svcCtx.StatisticsPvpModel.Exists(l.ctx, in.Uid)
if !exists {
dbModel := &model.StatisticsPvp{
UserId: in.Uid,
KillPlayerCount: 1,
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, dbModel); err != nil {
return nil, errors.Wrapf(err, ErrInsertErr, err)
}
// 虚拟UID
if in.Uid <= 0 {
return &pb.Empty{}, nil
}
props := model.UpdateRecordProps{}
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, in.Uid, &props); err != nil {
return nil, errors.Wrapf(err, ErrUpdateErr, err)
}
// 被杀
exists, _ = l.svcCtx.StatisticsPvpModel.Exists(l.ctx, in.TargetUid)
if !exists {
dbModel := &model.StatisticsPvp{
UserId: in.TargetUid,
DeKillUnitCount: 1,
err := l.svcCtx.StatisticsPvpModel.Transaction(l.ctx, nil, func(tx *gorm.DB) error {
// 击杀
props := model.UpdateRecordProps{
KillPlayer: true,
}
if in.IsGeneral {
dbModel.DeGeneralCount = 1
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.Uid, &props); err != nil {
if errors.Is(err, model.ErrRowsAffectedZero) {
dbModel := &model.StatisticsPvp{
UserId: in.Uid,
KillPlayerCount: 1,
}
if err := l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, dbModel); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}
} else {
return errors.Wrapf(err, ErrUpdateErr, err)
}
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, dbModel); err != nil {
return nil, errors.Wrapf(err, ErrInsertErr, err)
// 被杀 + 落马否
// 虚拟UID
if in.TargetUid <= 0 {
return nil
}
return &pb.Empty{}, nil
}
props = model.UpdateRecordProps{
DeKillPlayer: true,
}
if in.IsGeneral {
props.DeGeneral = true
}
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, in.TargetUid, &props); err != nil {
return nil, errors.Wrapf(err, ErrUpdateErr, err)
props = model.UpdateRecordProps{
DeKillPlayer: true,
DeGeneral: in.IsGeneral,
}
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.TargetUid, &props); err != nil {
if errors.Is(err, model.ErrRowsAffectedZero) {
dbModel := &model.StatisticsPvp{
UserId: in.TargetUid,
DeKillUnitCount: 1,
}
if in.IsGeneral {
dbModel.DeGeneralCount = 1
}
if err := l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, dbModel); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}
} else {
return errors.Wrapf(err, ErrUpdateErr, err)
}
}
return nil
})
if err != nil {
return nil, errors.Wrapf(err, "击杀玩家-事务执行失败, err:%+v", err)
}
return &pb.Empty{}, nil
}

@ -1,65 +0,0 @@
package statistics
import (
"context"
"github.com/pkg/errors"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type StatPvpKillUnitLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewStatPvpKillUnitLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatPvpKillUnitLogic {
return &StatPvpKillUnitLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *StatPvpKillUnitLogic) StatPvpKillUnit(in *pb.StatPvPKillUnitReq) (*pb.Empty, error) {
exists, _ := l.svcCtx.StatisticsPvpModel.Exists(l.ctx, in.Uid)
if !exists {
dbModel := &model.StatisticsPvp{
UserId: in.Uid,
KillUnitCount: 1,
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, dbModel); err != nil {
return nil, errors.Wrapf(err, ErrInsertErr, err)
}
return &pb.Empty{}, nil
}
// 原始记录存在,直接更新,提高效率
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, in.Uid, &model.UpdateRecordProps{KillUnit: true}); err != nil {
return nil, errors.Wrapf(err, ErrUpdateErr, err)
}
// 被击杀
if in.TargetUid != nil {
tUid := *in.TargetUid
exists, _ = l.svcCtx.StatisticsPvpModel.Exists(l.ctx, tUid)
if !exists {
dbModel := &model.StatisticsPvp{
UserId: tUid,
DeKillUnitCount: 1,
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, dbModel); err != nil {
return nil, errors.Wrapf(err, ErrInsertErr, err)
}
return &pb.Empty{}, nil
}
// 原始记录存在,直接更新,提高效率
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tUid, &model.UpdateRecordProps{DeKillUnit: true}); err != nil {
return nil, errors.Wrapf(err, ErrUpdateErr, err)
}
}
return &pb.Empty{}, nil
}

@ -3,12 +3,11 @@ package statistics
import (
"context"
"github.com/pkg/errors"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
"live-service/app/user_center/model"
"live-service/app/user_center/rpc/internal/svc"
"live-service/app/user_center/rpc/pb"
"github.com/zeromicro/go-zero/core/logx"
)
type StatPvpReportLogic struct {
@ -26,25 +25,81 @@ func NewStatPvpReportLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sta
}
func (l *StatPvpReportLogic) StatPvpReport(in *pb.StatPvPReportReq) (*pb.Empty, error) {
// 名将
exists, _ := l.svcCtx.StatisticsPvpModel.Exists(l.ctx, in.GeneralUid)
if !exists {
dbModel := &model.StatisticsPvp{
UserId: in.GeneralUid,
GeneralCount: 1,
}
if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, dbModel); err != nil {
return nil, errors.Wrapf(err, ErrInsertErr, err)
}
// 虚拟UID
if in.GeneralUid <= 0 {
return &pb.Empty{}, nil
}
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, in.GeneralUid, &model.UpdateRecordProps{General: true}); err != nil {
return nil, errors.Wrapf(err, ErrUpdateErr, err)
}
// 获胜记录
// 战败记录
if err := l.svcCtx.StatisticsPvpModel.RecordPvp(l.ctx, in.WinUids, in.LostUids); err != nil {
return nil, errors.Wrapf(err, ErrUpdateErr, err)
err := l.svcCtx.StatisticsPvpModel.Transaction(l.ctx, nil, func(tx *gorm.DB) error {
// 名将
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.GeneralUid,
&model.UpdateRecordProps{General: true}); err != nil {
if errors.Is(err, model.ErrRowsAffectedZero) {
// insert
if err = l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, &model.StatisticsPvp{
UserId: in.GeneralUid,
GeneralCount: 1,
}); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}
} else {
return errors.Wrapf(err, ErrUpdateErr, err)
}
}
// 获胜记录
if err := l.reports(tx, true, in.WinItems); err != nil {
return errors.Wrapf(err, "获胜PvP记录失败: %+v", err)
}
// 战败记录
if err := l.reports(tx, false, in.LostItems); err != nil {
return errors.Wrapf(err, "获胜PvP记录失败: %+v", err)
}
return nil
})
if err != nil {
return nil, errors.Wrapf(err, "PvP战报-事务执行失败 err: %+v", err)
}
return &pb.Empty{}, nil
}
func (l *StatPvpReportLogic) reports(tx *gorm.DB, win bool, items []*pb.StatPvPReportReq_Item) error {
return l.svcCtx.StatisticsPvpModel.Transaction(l.ctx, tx, func(tx *gorm.DB) error {
for _, item := range items {
if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, item.Uid,
&model.UpdateRecordProps{
Win: win,
Lost: !win,
Damage: &item.Damage,
DeDamage: &item.DeDamage,
KillUnitCount: &item.KillUnit,
DeKillUnitCount: &item.DeKillUnit,
}); err != nil {
if errors.Is(err, model.ErrRowsAffectedZero) {
// insert
var winCount int64
var lostCount int64
if win {
winCount = 1
} else {
lostCount = 1
}
if err = l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, &model.StatisticsPvp{
UserId: item.Uid,
WinCount: winCount,
LostCount: lostCount,
Damage: item.Damage,
DeDamage: item.DeDamage,
KillUnitCount: item.KillUnit,
DeKillUnitCount: item.DeKillUnit,
}); err != nil {
return errors.Wrapf(err, ErrInsertErr, err)
}
} else {
return errors.Wrapf(err, ErrUpdateErr, err)
}
}
}
return nil
})
}

@ -31,16 +31,6 @@ func (s *UserCenterServer) RetrievePlatformUser(ctx context.Context, in *pb.Plat
}
// statistics
func (s *UserCenterServer) StatPvpDamage(ctx context.Context, in *pb.StatPvPDamageReq) (*pb.Empty, error) {
l := statistics.NewStatPvpDamageLogic(ctx, s.svcCtx)
return l.StatPvpDamage(in)
}
func (s *UserCenterServer) StatPvpKillUnit(ctx context.Context, in *pb.StatPvPKillUnitReq) (*pb.Empty, error) {
l := statistics.NewStatPvpKillUnitLogic(ctx, s.svcCtx)
return l.StatPvpKillUnit(in)
}
func (s *UserCenterServer) StatPvpKill(ctx context.Context, in *pb.StatPvPKillReq) (*pb.Empty, error) {
l := statistics.NewStatPvpKillLogic(ctx, s.svcCtx)
return l.StatPvpKill(in)

@ -26,7 +26,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
log.New(os.Stdout, "\r\n", log.LstdFlags),
logger.Config{
SlowThreshold: 1 * time.Second,
LogLevel: logger.Warn,
LogLevel: logger.Info,
IgnoreRecordNotFoundError: true,
Colorful: true,
},

@ -258,142 +258,6 @@ func (x *PlatformUserResp) GetUser() *User {
return nil
}
// 通知-PvP伤害 statistics.pvp.damage
type StatPvPDamageReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` // 造成伤害的用户ID
TargetUid *int64 `protobuf:"varint,2,opt,name=targetUid,proto3,oneof" json:"targetUid,omitempty"` // 目标用户ID可能是基地不一定有
Damage float32 `protobuf:"fixed32,3,opt,name=damage,proto3" json:"damage,omitempty"` // 伤害量
}
func (x *StatPvPDamageReq) Reset() {
*x = StatPvPDamageReq{}
if protoimpl.UnsafeEnabled {
mi := &file_user_center_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StatPvPDamageReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatPvPDamageReq) ProtoMessage() {}
func (x *StatPvPDamageReq) ProtoReflect() protoreflect.Message {
mi := &file_user_center_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StatPvPDamageReq.ProtoReflect.Descriptor instead.
func (*StatPvPDamageReq) Descriptor() ([]byte, []int) {
return file_user_center_proto_rawDescGZIP(), []int{4}
}
func (x *StatPvPDamageReq) GetUid() int64 {
if x != nil {
return x.Uid
}
return 0
}
func (x *StatPvPDamageReq) GetTargetUid() int64 {
if x != nil && x.TargetUid != nil {
return *x.TargetUid
}
return 0
}
func (x *StatPvPDamageReq) GetDamage() float32 {
if x != nil {
return x.Damage
}
return 0
}
// 通知-PvP击杀单位 statistics.pvp.killunit
type StatPvPKillUnitReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID
TargetUid *int64 `protobuf:"varint,2,opt,name=targetUid,proto3,oneof" json:"targetUid,omitempty"` // 目标用户
Attacker string `protobuf:"bytes,3,opt,name=attacker,proto3" json:"attacker,omitempty"` // 造成击杀东西building:兵营 U0001:xxx兵 S0001: 技能)
Victim string `protobuf:"bytes,4,opt,name=victim,proto3" json:"victim,omitempty"` // 被击杀的东西U0001:xxx兵
}
func (x *StatPvPKillUnitReq) Reset() {
*x = StatPvPKillUnitReq{}
if protoimpl.UnsafeEnabled {
mi := &file_user_center_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StatPvPKillUnitReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatPvPKillUnitReq) ProtoMessage() {}
func (x *StatPvPKillUnitReq) ProtoReflect() protoreflect.Message {
mi := &file_user_center_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StatPvPKillUnitReq.ProtoReflect.Descriptor instead.
func (*StatPvPKillUnitReq) Descriptor() ([]byte, []int) {
return file_user_center_proto_rawDescGZIP(), []int{5}
}
func (x *StatPvPKillUnitReq) GetUid() int64 {
if x != nil {
return x.Uid
}
return 0
}
func (x *StatPvPKillUnitReq) GetTargetUid() int64 {
if x != nil && x.TargetUid != nil {
return *x.TargetUid
}
return 0
}
func (x *StatPvPKillUnitReq) GetAttacker() string {
if x != nil {
return x.Attacker
}
return ""
}
func (x *StatPvPKillUnitReq) GetVictim() string {
if x != nil {
return x.Victim
}
return ""
}
// 通知-PvP杀兵营(人) statistics.pvp.kill
type StatPvPKillReq struct {
state protoimpl.MessageState
@ -408,7 +272,7 @@ type StatPvPKillReq struct {
func (x *StatPvPKillReq) Reset() {
*x = StatPvPKillReq{}
if protoimpl.UnsafeEnabled {
mi := &file_user_center_proto_msgTypes[6]
mi := &file_user_center_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -421,7 +285,7 @@ func (x *StatPvPKillReq) String() string {
func (*StatPvPKillReq) ProtoMessage() {}
func (x *StatPvPKillReq) ProtoReflect() protoreflect.Message {
mi := &file_user_center_proto_msgTypes[6]
mi := &file_user_center_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -434,7 +298,7 @@ func (x *StatPvPKillReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use StatPvPKillReq.ProtoReflect.Descriptor instead.
func (*StatPvPKillReq) Descriptor() ([]byte, []int) {
return file_user_center_proto_rawDescGZIP(), []int{6}
return file_user_center_proto_rawDescGZIP(), []int{4}
}
func (x *StatPvPKillReq) GetUid() int64 {
@ -471,7 +335,7 @@ type StatPvPFirstBloodReq struct {
func (x *StatPvPFirstBloodReq) Reset() {
*x = StatPvPFirstBloodReq{}
if protoimpl.UnsafeEnabled {
mi := &file_user_center_proto_msgTypes[7]
mi := &file_user_center_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -484,7 +348,7 @@ func (x *StatPvPFirstBloodReq) String() string {
func (*StatPvPFirstBloodReq) ProtoMessage() {}
func (x *StatPvPFirstBloodReq) ProtoReflect() protoreflect.Message {
mi := &file_user_center_proto_msgTypes[7]
mi := &file_user_center_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -497,7 +361,7 @@ func (x *StatPvPFirstBloodReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use StatPvPFirstBloodReq.ProtoReflect.Descriptor instead.
func (*StatPvPFirstBloodReq) Descriptor() ([]byte, []int) {
return file_user_center_proto_rawDescGZIP(), []int{7}
return file_user_center_proto_rawDescGZIP(), []int{5}
}
func (x *StatPvPFirstBloodReq) GetUid() int64 {
@ -520,16 +384,16 @@ type StatPvPReportReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
WinCamp int32 `protobuf:"varint,1,opt,name=winCamp,proto3" json:"winCamp,omitempty"` // 获胜阵营 1-蓝 2-红
GeneralUid int64 `protobuf:"varint,2,opt,name=generalUid,proto3" json:"generalUid,omitempty"` // 名将UID
WinUids []int64 `protobuf:"varint,3,rep,packed,name=winUids,proto3" json:"winUids,omitempty"` // 战胜方玩家列表
LostUids []int64 `protobuf:"varint,4,rep,packed,name=lostUids,proto3" json:"lostUids,omitempty"` // 战败方玩家列表
WinCamp int32 `protobuf:"varint,1,opt,name=winCamp,proto3" json:"winCamp,omitempty"` // 获胜阵营 1-蓝 2-红
GeneralUid int64 `protobuf:"varint,2,opt,name=generalUid,proto3" json:"generalUid,omitempty"` // 名将UID
WinItems []*StatPvPReportReq_Item `protobuf:"bytes,3,rep,name=winItems,proto3" json:"winItems,omitempty"` // 获胜方数据
LostItems []*StatPvPReportReq_Item `protobuf:"bytes,4,rep,name=lostItems,proto3" json:"lostItems,omitempty"` // 战败方数据
}
func (x *StatPvPReportReq) Reset() {
*x = StatPvPReportReq{}
if protoimpl.UnsafeEnabled {
mi := &file_user_center_proto_msgTypes[8]
mi := &file_user_center_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -542,7 +406,7 @@ func (x *StatPvPReportReq) String() string {
func (*StatPvPReportReq) ProtoMessage() {}
func (x *StatPvPReportReq) ProtoReflect() protoreflect.Message {
mi := &file_user_center_proto_msgTypes[8]
mi := &file_user_center_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -555,7 +419,7 @@ func (x *StatPvPReportReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use StatPvPReportReq.ProtoReflect.Descriptor instead.
func (*StatPvPReportReq) Descriptor() ([]byte, []int) {
return file_user_center_proto_rawDescGZIP(), []int{8}
return file_user_center_proto_rawDescGZIP(), []int{6}
}
func (x *StatPvPReportReq) GetWinCamp() int32 {
@ -572,16 +436,16 @@ func (x *StatPvPReportReq) GetGeneralUid() int64 {
return 0
}
func (x *StatPvPReportReq) GetWinUids() []int64 {
func (x *StatPvPReportReq) GetWinItems() []*StatPvPReportReq_Item {
if x != nil {
return x.WinUids
return x.WinItems
}
return nil
}
func (x *StatPvPReportReq) GetLostUids() []int64 {
func (x *StatPvPReportReq) GetLostItems() []*StatPvPReportReq_Item {
if x != nil {
return x.LostUids
return x.LostItems
}
return nil
}
@ -599,7 +463,7 @@ type RankPvpReq struct {
func (x *RankPvpReq) Reset() {
*x = RankPvpReq{}
if protoimpl.UnsafeEnabled {
mi := &file_user_center_proto_msgTypes[9]
mi := &file_user_center_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -612,7 +476,7 @@ func (x *RankPvpReq) String() string {
func (*RankPvpReq) ProtoMessage() {}
func (x *RankPvpReq) ProtoReflect() protoreflect.Message {
mi := &file_user_center_proto_msgTypes[9]
mi := &file_user_center_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -625,7 +489,7 @@ func (x *RankPvpReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use RankPvpReq.ProtoReflect.Descriptor instead.
func (*RankPvpReq) Descriptor() ([]byte, []int) {
return file_user_center_proto_rawDescGZIP(), []int{9}
return file_user_center_proto_rawDescGZIP(), []int{7}
}
func (x *RankPvpReq) GetType() int32 {
@ -654,7 +518,7 @@ type RankPvpResp struct {
func (x *RankPvpResp) Reset() {
*x = RankPvpResp{}
if protoimpl.UnsafeEnabled {
mi := &file_user_center_proto_msgTypes[10]
mi := &file_user_center_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -667,7 +531,7 @@ func (x *RankPvpResp) String() string {
func (*RankPvpResp) ProtoMessage() {}
func (x *RankPvpResp) ProtoReflect() protoreflect.Message {
mi := &file_user_center_proto_msgTypes[10]
mi := &file_user_center_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -680,7 +544,7 @@ func (x *RankPvpResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use RankPvpResp.ProtoReflect.Descriptor instead.
func (*RankPvpResp) Descriptor() ([]byte, []int) {
return file_user_center_proto_rawDescGZIP(), []int{10}
return file_user_center_proto_rawDescGZIP(), []int{8}
}
func (x *RankPvpResp) GetType() int32 {
@ -697,6 +561,85 @@ func (x *RankPvpResp) GetItems() []*RankPvpResp_Item {
return nil
}
type StatPvPReportReq_Item struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID
Damage int64 `protobuf:"varint,2,opt,name=damage,proto3" json:"damage,omitempty"` // 伤害量
DeDamage int64 `protobuf:"varint,3,opt,name=deDamage,proto3" json:"deDamage,omitempty"` // 承受伤害
KillUnit int64 `protobuf:"varint,4,opt,name=killUnit,proto3" json:"killUnit,omitempty"` // 击杀单位数量
DeKillUnit int64 `protobuf:"varint,5,opt,name=deKillUnit,proto3" json:"deKillUnit,omitempty"` // 被杀单位数量
}
func (x *StatPvPReportReq_Item) Reset() {
*x = StatPvPReportReq_Item{}
if protoimpl.UnsafeEnabled {
mi := &file_user_center_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StatPvPReportReq_Item) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatPvPReportReq_Item) ProtoMessage() {}
func (x *StatPvPReportReq_Item) ProtoReflect() protoreflect.Message {
mi := &file_user_center_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StatPvPReportReq_Item.ProtoReflect.Descriptor instead.
func (*StatPvPReportReq_Item) Descriptor() ([]byte, []int) {
return file_user_center_proto_rawDescGZIP(), []int{6, 0}
}
func (x *StatPvPReportReq_Item) GetUid() int64 {
if x != nil {
return x.Uid
}
return 0
}
func (x *StatPvPReportReq_Item) GetDamage() int64 {
if x != nil {
return x.Damage
}
return 0
}
func (x *StatPvPReportReq_Item) GetDeDamage() int64 {
if x != nil {
return x.DeDamage
}
return 0
}
func (x *StatPvPReportReq_Item) GetKillUnit() int64 {
if x != nil {
return x.KillUnit
}
return 0
}
func (x *StatPvPReportReq_Item) GetDeKillUnit() int64 {
if x != nil {
return x.DeKillUnit
}
return 0
}
type RankPvpResp_Item struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -711,7 +654,7 @@ type RankPvpResp_Item struct {
func (x *RankPvpResp_Item) Reset() {
*x = RankPvpResp_Item{}
if protoimpl.UnsafeEnabled {
mi := &file_user_center_proto_msgTypes[11]
mi := &file_user_center_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -724,7 +667,7 @@ func (x *RankPvpResp_Item) String() string {
func (*RankPvpResp_Item) ProtoMessage() {}
func (x *RankPvpResp_Item) ProtoReflect() protoreflect.Message {
mi := &file_user_center_proto_msgTypes[11]
mi := &file_user_center_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -737,7 +680,7 @@ func (x *RankPvpResp_Item) ProtoReflect() protoreflect.Message {
// Deprecated: Use RankPvpResp_Item.ProtoReflect.Descriptor instead.
func (*RankPvpResp_Item) Descriptor() ([]byte, []int) {
return file_user_center_proto_rawDescGZIP(), []int{10, 0}
return file_user_center_proto_rawDescGZIP(), []int{8, 0}
}
func (x *RankPvpResp_Item) GetUid() int64 {
@ -791,66 +734,56 @@ var file_user_center_proto_rawDesc = []byte{
0x22, 0x30, 0x0a, 0x10, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x55, 0x73, 0x65, 0x72,
0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73,
0x65, 0x72, 0x22, 0x6d, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x44, 0x61, 0x6d,
0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67,
0x65, 0x74, 0x55, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x09, 0x74,
0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x64,
0x61, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x06, 0x64, 0x61, 0x6d,
0x61, 0x67, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69,
0x64, 0x22, 0x8b, 0x01, 0x0a, 0x12, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x4b, 0x69, 0x6c,
0x6c, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x09, 0x74, 0x61,
0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52,
0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1a, 0x0a,
0x08, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x69, 0x63,
0x74, 0x69, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x76, 0x69, 0x63, 0x74, 0x69,
0x6d, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64, 0x22,
0x5e, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x4b, 0x69, 0x6c, 0x6c, 0x52, 0x65,
0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03,
0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69,
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x18, 0x03,
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x22,
0x3c, 0x0a, 0x14, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x46, 0x69, 0x72, 0x73, 0x74, 0x42,
0x6c, 0x6f, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x82, 0x01,
0x0a, 0x10, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52,
0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x69, 0x6e, 0x43, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x07, 0x77, 0x69, 0x6e, 0x43, 0x61, 0x6d, 0x70, 0x12, 0x1e, 0x0a, 0x0a,
0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x55, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x55, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07,
0x77, 0x69, 0x6e, 0x55, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x07, 0x77,
0x69, 0x6e, 0x55, 0x69, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x73, 0x74, 0x55, 0x69,
0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x6f, 0x73, 0x74, 0x55, 0x69,
0x64, 0x73, 0x22, 0x34, 0x0a, 0x0a, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x52, 0x65, 0x71,
0x65, 0x72, 0x22, 0x5e, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x4b, 0x69, 0x6c,
0x6c, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
0x55, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65,
0x74, 0x55, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61,
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72,
0x61, 0x6c, 0x22, 0x3c, 0x0a, 0x14, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x46, 0x69, 0x72,
0x73, 0x74, 0x42, 0x6c, 0x6f, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04,
0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
0x22, 0xc7, 0x02, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x52, 0x65, 0x70, 0x6f,
0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x69, 0x6e, 0x43, 0x61, 0x6d, 0x70,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x77, 0x69, 0x6e, 0x43, 0x61, 0x6d, 0x70, 0x12,
0x1e, 0x0a, 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x55, 0x69, 0x64, 0x18, 0x02, 0x20,
0x01, 0x28, 0x03, 0x52, 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x55, 0x69, 0x64, 0x12,
0x35, 0x0a, 0x08, 0x77, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x52, 0x65,
0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x08, 0x77, 0x69,
0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x37, 0x0a, 0x09, 0x6c, 0x6f, 0x73, 0x74, 0x49, 0x74,
0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x53,
0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x2e,
0x49, 0x74, 0x65, 0x6d, 0x52, 0x09, 0x6c, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x1a,
0x88, 0x01, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x61,
0x6d, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x64, 0x61, 0x6d, 0x61,
0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x44, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x65, 0x44, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1a,
0x0a, 0x08, 0x6b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03,
0x52, 0x08, 0x6b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65,
0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a,
0x64, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x22, 0x34, 0x0a, 0x0a, 0x52, 0x61,
0x6e, 0x6b, 0x50, 0x76, 0x70, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x74, 0x6f, 0x70, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x6f, 0x70, 0x4e,
0x22, 0xab, 0x01, 0x0a, 0x0b, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x52, 0x65, 0x73, 0x70,
0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x6f, 0x70, 0x4e, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x74, 0x6f, 0x70, 0x4e, 0x22, 0xab, 0x01, 0x0a, 0x0b, 0x52, 0x61, 0x6e,
0x6b, 0x50, 0x76, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x05,
0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x62,
0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x49, 0x74, 0x65,
0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x5c, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d,
0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75,
0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x16,
0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x32, 0xfd, 0x02, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x43,
0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x14, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76,
0x65, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x12, 0x13, 0x2e,
0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52,
0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d,
0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x30, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x74,
0x50, 0x76, 0x70, 0x44, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x53,
0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x44, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a,
0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x34, 0x0a, 0x0f, 0x73, 0x74,
0x61, 0x74, 0x50, 0x76, 0x70, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x16, 0x2e,
0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e,
0x69, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70,
0x52, 0x65, 0x73, 0x70, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
0x1a, 0x5c, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x32, 0x95,
0x02, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x41, 0x0a,
0x14, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72,
0x6d, 0x55, 0x73, 0x65, 0x72, 0x12, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66,
0x6f, 0x72, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e,
0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70,
0x12, 0x2c, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x50, 0x76, 0x70, 0x4b, 0x69, 0x6c, 0x6c, 0x12,
0x12, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x4b, 0x69, 0x6c, 0x6c,
0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x38,
@ -879,43 +812,40 @@ func file_user_center_proto_rawDescGZIP() []byte {
return file_user_center_proto_rawDescData
}
var file_user_center_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_user_center_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_user_center_proto_goTypes = []interface{}{
(*User)(nil), // 0: pb.User
(*Empty)(nil), // 1: pb.Empty
(*PlatformUserReq)(nil), // 2: pb.PlatformUserReq
(*PlatformUserResp)(nil), // 3: pb.PlatformUserResp
(*StatPvPDamageReq)(nil), // 4: pb.StatPvPDamageReq
(*StatPvPKillUnitReq)(nil), // 5: pb.StatPvPKillUnitReq
(*StatPvPKillReq)(nil), // 6: pb.StatPvPKillReq
(*StatPvPFirstBloodReq)(nil), // 7: pb.StatPvPFirstBloodReq
(*StatPvPReportReq)(nil), // 8: pb.StatPvPReportReq
(*RankPvpReq)(nil), // 9: pb.RankPvpReq
(*RankPvpResp)(nil), // 10: pb.RankPvpResp
(*RankPvpResp_Item)(nil), // 11: pb.RankPvpResp.Item
(*User)(nil), // 0: pb.User
(*Empty)(nil), // 1: pb.Empty
(*PlatformUserReq)(nil), // 2: pb.PlatformUserReq
(*PlatformUserResp)(nil), // 3: pb.PlatformUserResp
(*StatPvPKillReq)(nil), // 4: pb.StatPvPKillReq
(*StatPvPFirstBloodReq)(nil), // 5: pb.StatPvPFirstBloodReq
(*StatPvPReportReq)(nil), // 6: pb.StatPvPReportReq
(*RankPvpReq)(nil), // 7: pb.RankPvpReq
(*RankPvpResp)(nil), // 8: pb.RankPvpResp
(*StatPvPReportReq_Item)(nil), // 9: pb.StatPvPReportReq.Item
(*RankPvpResp_Item)(nil), // 10: pb.RankPvpResp.Item
}
var file_user_center_proto_depIdxs = []int32{
0, // 0: pb.PlatformUserResp.user:type_name -> pb.User
11, // 1: pb.RankPvpResp.items:type_name -> pb.RankPvpResp.Item
2, // 2: pb.userCenter.retrievePlatformUser:input_type -> pb.PlatformUserReq
4, // 3: pb.userCenter.statPvpDamage:input_type -> pb.StatPvPDamageReq
5, // 4: pb.userCenter.statPvpKillUnit:input_type -> pb.StatPvPKillUnitReq
6, // 5: pb.userCenter.statPvpKill:input_type -> pb.StatPvPKillReq
7, // 6: pb.userCenter.statPvpFirstBlood:input_type -> pb.StatPvPFirstBloodReq
8, // 7: pb.userCenter.statPvpReport:input_type -> pb.StatPvPReportReq
9, // 8: pb.userCenter.rankPvp:input_type -> pb.RankPvpReq
9, // 1: pb.StatPvPReportReq.winItems:type_name -> pb.StatPvPReportReq.Item
9, // 2: pb.StatPvPReportReq.lostItems:type_name -> pb.StatPvPReportReq.Item
10, // 3: pb.RankPvpResp.items:type_name -> pb.RankPvpResp.Item
2, // 4: pb.userCenter.retrievePlatformUser:input_type -> pb.PlatformUserReq
4, // 5: pb.userCenter.statPvpKill:input_type -> pb.StatPvPKillReq
5, // 6: pb.userCenter.statPvpFirstBlood:input_type -> pb.StatPvPFirstBloodReq
6, // 7: pb.userCenter.statPvpReport:input_type -> pb.StatPvPReportReq
7, // 8: pb.userCenter.rankPvp:input_type -> pb.RankPvpReq
3, // 9: pb.userCenter.retrievePlatformUser:output_type -> pb.PlatformUserResp
1, // 10: pb.userCenter.statPvpDamage:output_type -> pb.Empty
1, // 11: pb.userCenter.statPvpKillUnit:output_type -> pb.Empty
1, // 12: pb.userCenter.statPvpKill:output_type -> pb.Empty
1, // 13: pb.userCenter.statPvpFirstBlood:output_type -> pb.Empty
1, // 14: pb.userCenter.statPvpReport:output_type -> pb.Empty
10, // 15: pb.userCenter.rankPvp:output_type -> pb.RankPvpResp
9, // [9:16] is the sub-list for method output_type
2, // [2:9] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
1, // 10: pb.userCenter.statPvpKill:output_type -> pb.Empty
1, // 11: pb.userCenter.statPvpFirstBlood:output_type -> pb.Empty
1, // 12: pb.userCenter.statPvpReport:output_type -> pb.Empty
8, // 13: pb.userCenter.rankPvp:output_type -> pb.RankPvpResp
9, // [9:14] is the sub-list for method output_type
4, // [4:9] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_user_center_proto_init() }
@ -973,7 +903,7 @@ func file_user_center_proto_init() {
}
}
file_user_center_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatPvPDamageReq); i {
switch v := v.(*StatPvPKillReq); i {
case 0:
return &v.state
case 1:
@ -985,7 +915,7 @@ func file_user_center_proto_init() {
}
}
file_user_center_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatPvPKillUnitReq); i {
switch v := v.(*StatPvPFirstBloodReq); i {
case 0:
return &v.state
case 1:
@ -997,7 +927,7 @@ func file_user_center_proto_init() {
}
}
file_user_center_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatPvPKillReq); i {
switch v := v.(*StatPvPReportReq); i {
case 0:
return &v.state
case 1:
@ -1009,7 +939,7 @@ func file_user_center_proto_init() {
}
}
file_user_center_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatPvPFirstBloodReq); i {
switch v := v.(*RankPvpReq); i {
case 0:
return &v.state
case 1:
@ -1021,7 +951,7 @@ func file_user_center_proto_init() {
}
}
file_user_center_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatPvPReportReq); i {
switch v := v.(*RankPvpResp); i {
case 0:
return &v.state
case 1:
@ -1033,7 +963,7 @@ func file_user_center_proto_init() {
}
}
file_user_center_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RankPvpReq); i {
switch v := v.(*StatPvPReportReq_Item); i {
case 0:
return &v.state
case 1:
@ -1045,18 +975,6 @@ func file_user_center_proto_init() {
}
}
file_user_center_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RankPvpResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_user_center_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RankPvpResp_Item); i {
case 0:
return &v.state
@ -1069,15 +987,13 @@ func file_user_center_proto_init() {
}
}
}
file_user_center_proto_msgTypes[4].OneofWrappers = []interface{}{}
file_user_center_proto_msgTypes[5].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_user_center_proto_rawDesc,
NumEnums: 0,
NumMessages: 12,
NumMessages: 11,
NumExtensions: 0,
NumServices: 1,
},

@ -28,21 +28,6 @@ message PlatformUserResp {
User user = 1;
}
// -PvP statistics.pvp.damage
message StatPvPDamageReq {
int64 uid = 1; // ID
optional int64 targetUid = 2; // ID
float damage = 3; //
}
// -PvP statistics.pvp.killunit
message StatPvPKillUnitReq {
int64 uid = 1; // ID
optional int64 targetUid = 2; //
string attacker = 3; // 西building: U0001:xxx S0001:
string victim = 4; // 西U0001:xxx
}
// -PvP( statistics.pvp.kill
message StatPvPKillReq {
int64 uid = 1; // ID
@ -58,10 +43,17 @@ message StatPvPFirstBloodReq {
// -PvP statistics.pvp.report
message StatPvPReportReq {
message Item {
int64 uid = 1; // ID
int64 damage = 2; //
int64 deDamage = 3; //
int64 killUnit = 4; //
int64 deKillUnit = 5; //
}
int32 winCamp = 1; // 1- 2-
int64 generalUid = 2; // UID
repeated int64 winUids = 3; //
repeated int64 lostUids = 4; //
repeated Item winItems = 3; //
repeated Item lostItems = 4; //
}
// rank
@ -86,8 +78,6 @@ service userCenter {
rpc retrievePlatformUser(PlatformUserReq) returns (PlatformUserResp);
// statistics
rpc statPvpDamage(StatPvPDamageReq) returns (Empty);
rpc statPvpKillUnit(StatPvPKillUnitReq) returns (Empty);
rpc statPvpKill(StatPvPKillReq) returns (Empty);
rpc statPvpFirstBlood(StatPvPFirstBloodReq) returns (Empty);
rpc statPvpReport(StatPvPReportReq) returns (Empty);

@ -25,8 +25,6 @@ type UserCenterClient interface {
// user
RetrievePlatformUser(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*PlatformUserResp, error)
// statistics
StatPvpDamage(ctx context.Context, in *StatPvPDamageReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpKillUnit(ctx context.Context, in *StatPvPKillUnitReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpFirstBlood(ctx context.Context, in *StatPvPFirstBloodReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*Empty, error)
@ -51,24 +49,6 @@ func (c *userCenterClient) RetrievePlatformUser(ctx context.Context, in *Platfor
return out, nil
}
func (c *userCenterClient) StatPvpDamage(ctx context.Context, in *StatPvPDamageReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.userCenter/statPvpDamage", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) StatPvpKillUnit(ctx context.Context, in *StatPvPKillUnitReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.userCenter/statPvpKillUnit", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
err := c.cc.Invoke(ctx, "/pb.userCenter/statPvpKill", in, out, opts...)
@ -112,8 +92,6 @@ type UserCenterServer interface {
// user
RetrievePlatformUser(context.Context, *PlatformUserReq) (*PlatformUserResp, error)
// statistics
StatPvpDamage(context.Context, *StatPvPDamageReq) (*Empty, error)
StatPvpKillUnit(context.Context, *StatPvPKillUnitReq) (*Empty, error)
StatPvpKill(context.Context, *StatPvPKillReq) (*Empty, error)
StatPvpFirstBlood(context.Context, *StatPvPFirstBloodReq) (*Empty, error)
StatPvpReport(context.Context, *StatPvPReportReq) (*Empty, error)
@ -129,12 +107,6 @@ type UnimplementedUserCenterServer struct {
func (UnimplementedUserCenterServer) RetrievePlatformUser(context.Context, *PlatformUserReq) (*PlatformUserResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method RetrievePlatformUser not implemented")
}
func (UnimplementedUserCenterServer) StatPvpDamage(context.Context, *StatPvPDamageReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method StatPvpDamage not implemented")
}
func (UnimplementedUserCenterServer) StatPvpKillUnit(context.Context, *StatPvPKillUnitReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method StatPvpKillUnit not implemented")
}
func (UnimplementedUserCenterServer) StatPvpKill(context.Context, *StatPvPKillReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method StatPvpKill not implemented")
}
@ -178,42 +150,6 @@ func _UserCenter_RetrievePlatformUser_Handler(srv interface{}, ctx context.Conte
return interceptor(ctx, in, info, handler)
}
func _UserCenter_StatPvpDamage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatPvPDamageReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).StatPvpDamage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/statPvpDamage",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).StatPvpDamage(ctx, req.(*StatPvPDamageReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_StatPvpKillUnit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatPvPKillUnitReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).StatPvpKillUnit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/statPvpKillUnit",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).StatPvpKillUnit(ctx, req.(*StatPvPKillUnitReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_StatPvpKill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StatPvPKillReq)
if err := dec(in); err != nil {
@ -297,14 +233,6 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
MethodName: "retrievePlatformUser",
Handler: _UserCenter_RetrievePlatformUser_Handler,
},
{
MethodName: "statPvpDamage",
Handler: _UserCenter_StatPvpDamage_Handler,
},
{
MethodName: "statPvpKillUnit",
Handler: _UserCenter_StatPvpKillUnit_Handler,
},
{
MethodName: "statPvpKill",
Handler: _UserCenter_StatPvpKill_Handler,

@ -27,10 +27,14 @@ func main() {
ctx := svc.NewServiceContext(c)
svr := server.NewUserCenterServer(ctx)
platformUserRetriever := platform_user.NewUserRetriever(ctx)
platformUserRetriever.Scheduler()
rank.InitRankJob(ctx)
if c.UserRetriever.Enabled {
platformUserRetriever := platform_user.NewUserRetriever(ctx)
platformUserRetriever.Scheduler()
}
if c.Rank.Enabled {
rank.InitRankJob(ctx)
}
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
pb.RegisterUserCenterServer(grpcServer, svr)

@ -13,25 +13,22 @@ import (
)
type (
Empty = pb.Empty
PlatformUserReq = pb.PlatformUserReq
PlatformUserResp = pb.PlatformUserResp
RankPvpReq = pb.RankPvpReq
RankPvpResp = pb.RankPvpResp
RankPvpResp_Item = pb.RankPvpResp_Item
StatPvPDamageReq = pb.StatPvPDamageReq
StatPvPFirstBloodReq = pb.StatPvPFirstBloodReq
StatPvPKillReq = pb.StatPvPKillReq
StatPvPKillUnitReq = pb.StatPvPKillUnitReq
StatPvPReportReq = pb.StatPvPReportReq
User = pb.User
Empty = pb.Empty
PlatformUserReq = pb.PlatformUserReq
PlatformUserResp = pb.PlatformUserResp
RankPvpReq = pb.RankPvpReq
RankPvpResp = pb.RankPvpResp
RankPvpResp_Item = pb.RankPvpResp_Item
StatPvPFirstBloodReq = pb.StatPvPFirstBloodReq
StatPvPKillReq = pb.StatPvPKillReq
StatPvPReportReq = pb.StatPvPReportReq
StatPvPReportReq_Item = pb.StatPvPReportReq_Item
User = pb.User
UserCenter interface {
// user
RetrievePlatformUser(ctx context.Context, in *PlatformUserReq, opts ...grpc.CallOption) (*PlatformUserResp, error)
// statistics
StatPvpDamage(ctx context.Context, in *StatPvPDamageReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpKillUnit(ctx context.Context, in *StatPvPKillUnitReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpFirstBlood(ctx context.Context, in *StatPvPFirstBloodReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*Empty, error)
@ -57,16 +54,6 @@ func (m *defaultUserCenter) RetrievePlatformUser(ctx context.Context, in *Platfo
}
// statistics
func (m *defaultUserCenter) StatPvpDamage(ctx context.Context, in *StatPvPDamageReq, opts ...grpc.CallOption) (*Empty, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.StatPvpDamage(ctx, in, opts...)
}
func (m *defaultUserCenter) StatPvpKillUnit(ctx context.Context, in *StatPvPKillUnitReq, opts ...grpc.CallOption) (*Empty, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.StatPvpKillUnit(ctx, in, opts...)
}
func (m *defaultUserCenter) StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.StatPvpKill(ctx, in, opts...)

@ -17,6 +17,7 @@ require (
require (
github.com/Shopify/sarama v1.32.0 // indirect
github.com/VividCortex/mysqlerr v1.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect

@ -59,6 +59,8 @@ github.com/Shopify/sarama v1.32.0/go.mod h1:+EmJJKZWVT/faR9RcOxJerP+LId4iWdQPBGL
github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/cvHQkZ1fst0EmZnA5dFtiQdWCNCFYzb+uE2vqVgvx0=
github.com/Shopify/toxiproxy/v2 v2.3.0 h1:62YkpiP4bzdhKMH+6uC5E95y608k3zDwdzuBMsnn3uQ=
github.com/Shopify/toxiproxy/v2 v2.3.0/go.mod h1:KvQTtB6RjCJY4zqNJn7C7JDFgsG5uoHYDirfUfpIm0c=
github.com/VividCortex/mysqlerr v1.0.0 h1:5pZ2TZA+YnzPgzBfiUWGqWmKDVNBdrkf9g+DNe1Tiq8=
github.com/VividCortex/mysqlerr v1.0.0/go.mod h1:xERx8E4tBhLvpjzdUyQiSfUxeMcATEQrflDAfXsqcAE=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=

Loading…
Cancel
Save