diff --git a/app/pb/mq/mq.proto b/app/pb/mq/mq.proto index c77c195..f84ed0c 100644 --- a/app/pb/mq/mq.proto +++ b/app/pb/mq/mq.proto @@ -9,6 +9,7 @@ enum Platform { huya = 1; // 虎牙 douyu = 2; // 斗鱼 douyin = 3; // 抖音 + // 更多以后再说 } message MqDanmaku { diff --git a/app/user_center/genModel.bat b/app/user_center/gen-model.bat similarity index 70% rename from app/user_center/genModel.bat rename to app/user_center/gen-model.bat index 4e39f1d..d9bf750 100644 --- a/app/user_center/genModel.bat +++ b/app/user_center/gen-model.bat @@ -1,20 +1,18 @@ @echo off -@echo ?????????????? +chcp 65001 +@echo 开始代码生成 -set tables=user_check_in +set tables=user_integral set targetDir=.\model set templateDir=..\..\doc\template set host=127.0.0.1 set port=3306 -::set host=192.168.1.100 -::set port=3306 -::set dbname=dcg set dbname=dmgame set username=root set password=root for %%i in (%tables%) do ( - echo ????????? %dbname% ??? %%i + echo 正在生成数据库 %dbname% 的表 %%i 的golang代码 goctl model mysql datasource --url "%username%:%password%@tcp(%host%:%port%)/%dbname%" -t %%i -d %targetDir% --style go_zero --home %templateDir% ) \ No newline at end of file diff --git a/app/user_center/model/gift_model.go b/app/user_center/model/gift_model.go index 009d75a..2f96e14 100644 --- a/app/user_center/model/gift_model.go +++ b/app/user_center/model/gift_model.go @@ -2,7 +2,7 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "gorm.io/gorm" ) @@ -13,12 +13,6 @@ type ( // and implement the added methods in customGiftModel. GiftModel interface { giftModel - // Transaction 开启事务,传入方法即可 - Transaction(ctx context.Context, tx *gorm.DB, fn func(tx *gorm.DB) error) error - // InsertTx 事务插入 - InsertTx(ctx context.Context, tx *gorm.DB, data *Gift) error - // UpdateTx 事务更新 - UpdateTx(ctx context.Context, tx *gorm.DB, data *Gift) error FindByPlatformGift(ctx context.Context, platform string, giftId string) (*Gift, error) } @@ -34,32 +28,16 @@ func NewGiftModel(conn *gorm.DB) GiftModel { } } -func (m *customGiftModel) 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 *customGiftModel) InsertTx(ctx context.Context, tx *gorm.DB, data *Gift) error { - err := withTx(ctx, m.conn, tx).Create(&data).Error - return err -} - -func (m *customGiftModel) UpdateTx(ctx context.Context, tx *gorm.DB, data *Gift) error { - err := withTx(ctx, m.conn, tx).Save(data).Error - return err -} - func (m *customGiftModel) FindByPlatformGift(ctx context.Context, platform string, giftId string) (*Gift, error) { var resp Gift - db := m.conn.WithContext(ctx) + db := m.DB.WithContext(ctx) err := db.Model(&Gift{}). Where("platform = ? AND gift_id = ?", platform, giftId). Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err diff --git a/app/user_center/model/gift_model_gen.go b/app/user_center/model/gift_model_gen.go index 77edd4e..eeb0b30 100644 --- a/app/user_center/model/gift_model_gen.go +++ b/app/user_center/model/gift_model_gen.go @@ -4,22 +4,34 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "strings" "time" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" ) +var ( + giftFieldNames = builder.RawFieldNames(&Gift{}) + giftRows = strings.Join(giftFieldNames, ",") + giftRowsExpectAutoSet = strings.Join(stringx.Remove(giftFieldNames, "`create_time`", "`update_time`"), ",") + giftRowsWithPlaceHolder = strings.Join(stringx.Remove(giftFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?" +) + type ( giftModel interface { - Insert(ctx context.Context, data *Gift) error - FindOne(ctx context.Context, id int64) (*Gift, error) - Update(ctx context.Context, data *Gift) error - Delete(ctx context.Context, id int64) error + gormx.TxModel + Insert(ctx context.Context, tx *gorm.DB, data *Gift) error + FindOne(ctx context.Context, tx *gorm.DB, id int64) (*Gift, error) + FindOneByGiftIdPlatform(ctx context.Context, tx *gorm.DB, giftId string, platform string) (*Gift, error) + Update(ctx context.Context, tx *gorm.DB, data *Gift) error + Delete(ctx context.Context, tx *gorm.DB, id int64) error } defaultGiftModel struct { - conn *gorm.DB + gormx.GormConn table string } @@ -35,38 +47,53 @@ type ( } ) +var GiftTableName = "`gift`" + func newGiftModel(conn *gorm.DB) *defaultGiftModel { return &defaultGiftModel{ - conn: conn, - table: "`gift`", + GormConn: gormx.NewConn(conn), + table: GiftTableName, } } -func (m *defaultGiftModel) Insert(ctx context.Context, data *Gift) error { - err := m.conn.WithContext(ctx).Create(&data).Error +func (m *defaultGiftModel) Insert(ctx context.Context, tx *gorm.DB, data *Gift) error { + err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error return err } -func (m *defaultGiftModel) FindOne(ctx context.Context, id int64) (*Gift, error) { +func (m *defaultGiftModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*Gift, error) { + var resp Gift + err := gormx.WithTx(ctx, m.DB, tx).Model(&Gift{}).Where("`id` = ?", id).Take(&resp).Error + switch err { + case nil: + return &resp, nil + case gormx.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultGiftModel) FindOneByGiftIdPlatform(ctx context.Context, tx *gorm.DB, giftId string, platform string) (*Gift, error) { var resp Gift - err := m.conn.WithContext(ctx).Model(&Gift{}).Where("`id` = ?", id).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&Gift{}).Where("`gift_id` = ? and `platform` = ?", giftId, platform).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultGiftModel) Update(ctx context.Context, data *Gift) error { - err := m.conn.WithContext(ctx).Save(data).Error +func (m *defaultGiftModel) Update(ctx context.Context, tx *gorm.DB, data *Gift) error { + err := gormx.WithTx(ctx, m.DB, tx).Save(data).Error return err } -func (m *defaultGiftModel) Delete(ctx context.Context, id int64) error { - err := m.conn.WithContext(ctx).Delete(&Gift{}, id).Error +func (m *defaultGiftModel) Delete(ctx context.Context, tx *gorm.DB, id int64) error { + err := gormx.WithTx(ctx, m.DB, tx).Delete(&Gift{}, id).Error return err } @@ -76,6 +103,5 @@ func (m *defaultGiftModel) tableName() string { } func (Gift) TableName() string { - model := newGiftModel(nil) - return model.tableName() + return GiftTableName } diff --git a/app/user_center/model/rank_and_score.go b/app/user_center/model/rank_and_score.go new file mode 100644 index 0000000..2ec9562 --- /dev/null +++ b/app/user_center/model/rank_and_score.go @@ -0,0 +1,21 @@ +package model + +import "live-service/app/user_center/rpc/pb" + +var rankAndScoreMap map[pb.RankType]ScoreType + +func init() { + rankAndScoreMap = map[pb.RankType]ScoreType{ + pb.RankType_Damage: ScoreTypeDamage, + pb.RankType_DeDamage: ScoreTypeDeDamage, + pb.RankType_Damage: ScoreTypeDamage, + pb.RankType_Damage: ScoreTypeDamage, + pb.RankType_Damage: ScoreTypeDamage, + pb.RankType_Damage: ScoreTypeDamage, + pb.RankType_Damage: ScoreTypeDamage, + pb.RankType_Damage: ScoreTypeDamage, + pb.RankType_Damage: ScoreTypeDamage, + pb.RankType_Damage: ScoreTypeDamage, + pb.RankType_Damage: ScoreTypeDamage, + } +} diff --git a/app/user_center/model/rank_pvp_model.go b/app/user_center/model/rank_pvp_model.go index eee5aa4..a11c177 100644 --- a/app/user_center/model/rank_pvp_model.go +++ b/app/user_center/model/rank_pvp_model.go @@ -3,7 +3,7 @@ package model import ( "context" "fmt" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "gorm.io/gorm" ) @@ -55,7 +55,7 @@ func NewRankPvpModel(conn *gorm.DB) RankPvpModel { } func (m *customRankPvpModel) RankListByType(ctx context.Context, rankType, topN int32) ([]RankPvpWithPlatformUser, error) { - db := m.conn.WithContext(ctx) + db := m.DB.WithContext(ctx) limit := topN if limit > MaxRankN { limit = MaxRankN @@ -70,7 +70,7 @@ func (m *customRankPvpModel) RankListByType(ctx context.Context, rankType, topN switch err { case nil: return result, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err @@ -78,7 +78,7 @@ func (m *customRankPvpModel) RankListByType(ctx context.Context, rankType, topN } func (m *customRankPvpModel) UpdateRank(ctx context.Context, rankType int32, data []RankPvp) error { - db := m.conn.WithContext(ctx) + db := m.DB.WithContext(ctx) return db.Transaction(func(tx *gorm.DB) error { var err error // delete all by rank_type diff --git a/app/user_center/model/rank_pvp_model_gen.go b/app/user_center/model/rank_pvp_model_gen.go index e7400cb..14f13d5 100644 --- a/app/user_center/model/rank_pvp_model_gen.go +++ b/app/user_center/model/rank_pvp_model_gen.go @@ -4,28 +4,39 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "strings" "time" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" ) +var ( + rankPvpFieldNames = builder.RawFieldNames(&RankPvp{}) + rankPvpRows = strings.Join(rankPvpFieldNames, ",") + rankPvpRowsExpectAutoSet = strings.Join(stringx.Remove(rankPvpFieldNames, "`create_time`", "`update_time`"), ",") + rankPvpRowsWithPlaceHolder = strings.Join(stringx.Remove(rankPvpFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?" +) + type ( rankPvpModel interface { - Insert(ctx context.Context, data *RankPvp) error - FindOne(ctx context.Context, id int64) (*RankPvp, error) - FindOneByUserIdRankType(ctx context.Context, userId int64, rankType int64) (*RankPvp, error) - Update(ctx context.Context, data *RankPvp) error - Delete(ctx context.Context, id int64) error + gormx.TxModel + Insert(ctx context.Context, tx *gorm.DB, data *RankPvp) error + FindOne(ctx context.Context, tx *gorm.DB, id int64) (*RankPvp, error) + FindOneByUserIdRankType(ctx context.Context, tx *gorm.DB, userId int64, rankType int64) (*RankPvp, error) + Update(ctx context.Context, tx *gorm.DB, data *RankPvp) error + Delete(ctx context.Context, tx *gorm.DB, id int64) error } defaultRankPvpModel struct { - conn *gorm.DB + gormx.GormConn table string } RankPvp struct { - Id int64 `gorm:"column:id"` // 主键 + Id int64 `gorm:"column:id;primaryKey"` // 主键 UserId int64 `gorm:"column:user_id"` // 用户ID RankType int64 `gorm:"column:rank_type"` // 类型 1: 伤害 2: 名将次数 3: 击杀单位 4: 击杀玩家 Score int64 `gorm:"column:score"` // 伤害量 @@ -34,51 +45,53 @@ type ( } ) +var RankPvpTableName = "`rank_pvp`" + func newRankPvpModel(conn *gorm.DB) *defaultRankPvpModel { return &defaultRankPvpModel{ - conn: conn, - table: "`rank_pvp`", + GormConn: gormx.NewConn(conn), + table: RankPvpTableName, } } -func (m *defaultRankPvpModel) Insert(ctx context.Context, data *RankPvp) error { - err := m.conn.WithContext(ctx).Create(&data).Error +func (m *defaultRankPvpModel) Insert(ctx context.Context, tx *gorm.DB, data *RankPvp) error { + err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error return err } -func (m *defaultRankPvpModel) FindOne(ctx context.Context, id int64) (*RankPvp, error) { +func (m *defaultRankPvpModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*RankPvp, error) { var resp RankPvp - err := m.conn.WithContext(ctx).Model(&RankPvp{}).Where("`id` = ?", id).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&RankPvp{}).Where("`id` = ?", id).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultRankPvpModel) FindOneByUserIdRankType(ctx context.Context, userId int64, rankType int64) (*RankPvp, error) { +func (m *defaultRankPvpModel) FindOneByUserIdRankType(ctx context.Context, tx *gorm.DB, userId int64, rankType int64) (*RankPvp, error) { var resp RankPvp - err := m.conn.WithContext(ctx).Model(&RankPvp{}).Where("`user_id` = ? and `rank_type` = ?", userId, rankType).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&RankPvp{}).Where("`user_id` = ? and `rank_type` = ?", userId, rankType).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultRankPvpModel) Update(ctx context.Context, data *RankPvp) error { - err := m.conn.WithContext(ctx).Save(data).Error +func (m *defaultRankPvpModel) Update(ctx context.Context, tx *gorm.DB, data *RankPvp) error { + err := gormx.WithTx(ctx, m.DB, tx).Save(data).Error return err } -func (m *defaultRankPvpModel) Delete(ctx context.Context, id int64) error { - err := m.conn.WithContext(ctx).Delete(&RankPvp{}, id).Error +func (m *defaultRankPvpModel) Delete(ctx context.Context, tx *gorm.DB, id int64) error { + err := gormx.WithTx(ctx, m.DB, tx).Delete(&RankPvp{}, id).Error return err } @@ -88,6 +101,5 @@ func (m *defaultRankPvpModel) tableName() string { } func (RankPvp) TableName() string { - model := newRankPvpModel(nil) - return model.tableName() + return RankPvpTableName } diff --git a/app/user_center/model/statistics_pvp_model.go b/app/user_center/model/statistics_pvp_model.go index 1728abe..51e1054 100644 --- a/app/user_center/model/statistics_pvp_model.go +++ b/app/user_center/model/statistics_pvp_model.go @@ -3,7 +3,7 @@ package model import ( "context" "fmt" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "gorm.io/gorm" ) @@ -31,14 +31,12 @@ type ( // and implement the added methods in customStatisticsPvpModel. StatisticsPvpModel interface { statisticsPvpModel - // 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, limit int) ([]UserAndScore, error) + // FindScoreByType 根据类型获取分数 + FindScoreByType() } UserAndScore struct { @@ -73,19 +71,9 @@ func NewStatisticsPvpModel(conn *gorm.DB) StatisticsPvpModel { } } -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) 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 := withTx(ctx, m.conn, tx) + db := gormx.WithTx(ctx, m.DB, tx) db = db.Model(&StatisticsPvp{}).Where("user_id = ?", userId) data := make(map[string]interface{}) @@ -130,13 +118,13 @@ func (m *customStatisticsPvpModel) UpdateRecord(ctx context.Context, tx *gorm.DB return result.Error } if result.RowsAffected == 0 { - return ErrRowsAffectedZero + return gormx.ErrRowsAffectedZero } return nil } func (m *customStatisticsPvpModel) FindGreaterByScore(ctx context.Context, score int64, scoreType ScoreType, limit int) ([]UserAndScore, error) { - db := m.conn.WithContext(ctx) + db := m.DB.WithContext(ctx) if limit > MaxRankN { limit = MaxRankN @@ -160,7 +148,7 @@ func (m *customStatisticsPvpModel) FindGreaterByScore(ctx context.Context, score switch err { case nil: return result, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err diff --git a/app/user_center/model/statistics_pvp_model_gen.go b/app/user_center/model/statistics_pvp_model_gen.go index 86bdb6f..3ade2b5 100644 --- a/app/user_center/model/statistics_pvp_model_gen.go +++ b/app/user_center/model/statistics_pvp_model_gen.go @@ -4,22 +4,33 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "strings" "time" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" ) +var ( + statisticsPvpFieldNames = builder.RawFieldNames(&StatisticsPvp{}) + statisticsPvpRows = strings.Join(statisticsPvpFieldNames, ",") + statisticsPvpRowsExpectAutoSet = strings.Join(stringx.Remove(statisticsPvpFieldNames, "`create_time`", "`update_time`"), ",") + statisticsPvpRowsWithPlaceHolder = strings.Join(stringx.Remove(statisticsPvpFieldNames, "`user_id`", "`create_time`", "`update_time`"), "=?,") + "=?" +) + type ( statisticsPvpModel interface { - Insert(ctx context.Context, data *StatisticsPvp) error - FindOne(ctx context.Context, userId int64) (*StatisticsPvp, error) - Update(ctx context.Context, data *StatisticsPvp) error - Delete(ctx context.Context, userId int64) error + gormx.TxModel + Insert(ctx context.Context, tx *gorm.DB, data *StatisticsPvp) error + FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*StatisticsPvp, error) + Update(ctx context.Context, tx *gorm.DB, data *StatisticsPvp) error + Delete(ctx context.Context, tx *gorm.DB, userId int64) error } defaultStatisticsPvpModel struct { - conn *gorm.DB + gormx.GormConn table string } @@ -42,38 +53,40 @@ type ( } ) +var StatisticsPvpTableName = "`statistics_pvp`" + func newStatisticsPvpModel(conn *gorm.DB) *defaultStatisticsPvpModel { return &defaultStatisticsPvpModel{ - conn: conn, - table: "`statistics_pvp`", + GormConn: gormx.NewConn(conn), + table: StatisticsPvpTableName, } } -func (m *defaultStatisticsPvpModel) Insert(ctx context.Context, data *StatisticsPvp) error { - err := m.conn.WithContext(ctx).Create(&data).Error +func (m *defaultStatisticsPvpModel) Insert(ctx context.Context, tx *gorm.DB, data *StatisticsPvp) error { + err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error return err } -func (m *defaultStatisticsPvpModel) FindOne(ctx context.Context, userId int64) (*StatisticsPvp, error) { +func (m *defaultStatisticsPvpModel) FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*StatisticsPvp, error) { var resp StatisticsPvp - err := m.conn.WithContext(ctx).Model(&StatisticsPvp{}).Where("`user_id` = ?", userId).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&StatisticsPvp{}).Where("`user_id` = ?", userId).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultStatisticsPvpModel) Update(ctx context.Context, data *StatisticsPvp) error { - err := m.conn.WithContext(ctx).Save(data).Error +func (m *defaultStatisticsPvpModel) Update(ctx context.Context, tx *gorm.DB, data *StatisticsPvp) error { + err := gormx.WithTx(ctx, m.DB, tx).Save(data).Error return err } -func (m *defaultStatisticsPvpModel) Delete(ctx context.Context, userId int64) error { - err := m.conn.WithContext(ctx).Delete(&StatisticsPvp{}, userId).Error +func (m *defaultStatisticsPvpModel) Delete(ctx context.Context, tx *gorm.DB, userId int64) error { + err := gormx.WithTx(ctx, m.DB, tx).Delete(&StatisticsPvp{}, userId).Error return err } @@ -83,6 +96,5 @@ func (m *defaultStatisticsPvpModel) tableName() string { } func (StatisticsPvp) TableName() string { - model := newStatisticsPvpModel(nil) - return model.tableName() + return StatisticsPvpTableName } diff --git a/app/user_center/model/user_check_in_model.go b/app/user_center/model/user_check_in_model.go index 3dba276..31faca9 100644 --- a/app/user_center/model/user_check_in_model.go +++ b/app/user_center/model/user_check_in_model.go @@ -2,7 +2,7 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "github.com/jinzhu/now" "gorm.io/gorm" "time" @@ -15,7 +15,6 @@ type ( // and implement the added methods in customUserCheckInModel. UserCheckInModel interface { userCheckInModel - InsertTx(ctx context.Context, tx *gorm.DB, data *UserCheckIn) error // FindThisWeek 查询用户本周签到记录 FindThisWeek(ctx context.Context, tx *gorm.DB, userId int64) ([]UserCheckIn, error) // CheckInToday 查询用户本日是否已签到 @@ -34,13 +33,8 @@ func NewUserCheckInModel(conn *gorm.DB) UserCheckInModel { } } -func (m *customUserCheckInModel) InsertTx(ctx context.Context, tx *gorm.DB, data *UserCheckIn) error { - err := withTx(ctx, m.conn, tx).Create(&data).Error - return err -} - func (m *customUserCheckInModel) FindThisWeek(ctx context.Context, tx *gorm.DB, userId int64) ([]UserCheckIn, error) { - db := withTx(ctx, m.conn, tx) + db := gormx.WithTx(ctx, m.DB, tx) // 取签到时间大于本周一的所有该用户签到记录,按签到时间升序排列 var resp []UserCheckIn err := db.Model(&UserCheckIn{}). @@ -49,7 +43,7 @@ func (m *customUserCheckInModel) FindThisWeek(ctx context.Context, tx *gorm.DB, switch err { case nil: return resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return []UserCheckIn{}, nil default: return nil, err @@ -57,7 +51,7 @@ func (m *customUserCheckInModel) FindThisWeek(ctx context.Context, tx *gorm.DB, } func (m *customUserCheckInModel) CheckInToday(ctx context.Context, tx *gorm.DB, userId int64) (bool, error) { - db := withTx(ctx, m.conn, tx) + db := gormx.WithTx(ctx, m.DB, tx) n := time.Now() var count int64 @@ -68,7 +62,7 @@ func (m *customUserCheckInModel) CheckInToday(ctx context.Context, tx *gorm.DB, switch err { case nil: return count > 0, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return false, nil default: return false, err diff --git a/app/user_center/model/user_check_in_model_gen.go b/app/user_center/model/user_check_in_model_gen.go index 8704a41..277967b 100644 --- a/app/user_center/model/user_check_in_model_gen.go +++ b/app/user_center/model/user_check_in_model_gen.go @@ -4,10 +4,10 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" "strings" "time" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "github.com/zeromicro/go-zero/core/stores/builder" "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" @@ -22,14 +22,15 @@ var ( type ( userCheckInModel interface { - Insert(ctx context.Context, data *UserCheckIn) error - FindOne(ctx context.Context, id int64) (*UserCheckIn, error) - Update(ctx context.Context, data *UserCheckIn) error - Delete(ctx context.Context, id int64) error + gormx.TxModel + Insert(ctx context.Context, tx *gorm.DB, data *UserCheckIn) error + FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserCheckIn, error) + Update(ctx context.Context, tx *gorm.DB, data *UserCheckIn) error + Delete(ctx context.Context, tx *gorm.DB, id int64) error } defaultUserCheckInModel struct { - conn *gorm.DB + gormx.GormConn table string } @@ -40,38 +41,40 @@ type ( } ) +var UserCheckInTableName = "`user_check_in`" + func newUserCheckInModel(conn *gorm.DB) *defaultUserCheckInModel { return &defaultUserCheckInModel{ - conn: conn, - table: "`user_check_in`", + GormConn: gormx.NewConn(conn), + table: UserCheckInTableName, } } -func (m *defaultUserCheckInModel) Insert(ctx context.Context, data *UserCheckIn) error { - err := m.conn.WithContext(ctx).Create(&data).Error +func (m *defaultUserCheckInModel) Insert(ctx context.Context, tx *gorm.DB, data *UserCheckIn) error { + err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error return err } -func (m *defaultUserCheckInModel) FindOne(ctx context.Context, id int64) (*UserCheckIn, error) { +func (m *defaultUserCheckInModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserCheckIn, error) { var resp UserCheckIn - err := m.conn.WithContext(ctx).Model(&UserCheckIn{}).Where("`id` = ?", id).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&UserCheckIn{}).Where("`id` = ?", id).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultUserCheckInModel) Update(ctx context.Context, data *UserCheckIn) error { - err := m.conn.WithContext(ctx).Save(data).Error +func (m *defaultUserCheckInModel) Update(ctx context.Context, tx *gorm.DB, data *UserCheckIn) error { + err := gormx.WithTx(ctx, m.DB, tx).Save(data).Error return err } -func (m *defaultUserCheckInModel) Delete(ctx context.Context, id int64) error { - err := m.conn.WithContext(ctx).Delete(&UserCheckIn{}, id).Error +func (m *defaultUserCheckInModel) Delete(ctx context.Context, tx *gorm.DB, id int64) error { + err := gormx.WithTx(ctx, m.DB, tx).Delete(&UserCheckIn{}, id).Error return err } @@ -81,6 +84,5 @@ func (m *defaultUserCheckInModel) tableName() string { } func (UserCheckIn) TableName() string { - model := newUserCheckInModel(nil) - return model.tableName() + return UserCheckInTableName } diff --git a/app/user_center/model/user_gift_model_gen.go b/app/user_center/model/user_gift_model_gen.go index 09e46fb..458fa29 100644 --- a/app/user_center/model/user_gift_model_gen.go +++ b/app/user_center/model/user_gift_model_gen.go @@ -4,22 +4,33 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "strings" "time" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" ) +var ( + userGiftFieldNames = builder.RawFieldNames(&UserGift{}) + userGiftRows = strings.Join(userGiftFieldNames, ",") + userGiftRowsExpectAutoSet = strings.Join(stringx.Remove(userGiftFieldNames, "`create_time`", "`update_time`"), ",") + userGiftRowsWithPlaceHolder = strings.Join(stringx.Remove(userGiftFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?" +) + type ( userGiftModel interface { - Insert(ctx context.Context, data *UserGift) error - FindOne(ctx context.Context, id int64) (*UserGift, error) - Update(ctx context.Context, data *UserGift) error - Delete(ctx context.Context, id int64) error + gormx.TxModel + Insert(ctx context.Context, tx *gorm.DB, data *UserGift) error + FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserGift, error) + Update(ctx context.Context, tx *gorm.DB, data *UserGift) error + Delete(ctx context.Context, tx *gorm.DB, id int64) error } defaultUserGiftModel struct { - conn *gorm.DB + gormx.GormConn table string } @@ -37,38 +48,40 @@ type ( } ) +var UserGiftTableName = "`user_gift`" + func newUserGiftModel(conn *gorm.DB) *defaultUserGiftModel { return &defaultUserGiftModel{ - conn: conn, - table: "`user_gift`", + GormConn: gormx.NewConn(conn), + table: UserGiftTableName, } } -func (m *defaultUserGiftModel) Insert(ctx context.Context, data *UserGift) error { - err := m.conn.WithContext(ctx).Create(&data).Error +func (m *defaultUserGiftModel) Insert(ctx context.Context, tx *gorm.DB, data *UserGift) error { + err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error return err } -func (m *defaultUserGiftModel) FindOne(ctx context.Context, id int64) (*UserGift, error) { +func (m *defaultUserGiftModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserGift, error) { var resp UserGift - err := m.conn.WithContext(ctx).Model(&UserGift{}).Where("`id` = ?", id).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&UserGift{}).Where("`id` = ?", id).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultUserGiftModel) Update(ctx context.Context, data *UserGift) error { - err := m.conn.WithContext(ctx).Save(data).Error +func (m *defaultUserGiftModel) Update(ctx context.Context, tx *gorm.DB, data *UserGift) error { + err := gormx.WithTx(ctx, m.DB, tx).Save(data).Error return err } -func (m *defaultUserGiftModel) Delete(ctx context.Context, id int64) error { - err := m.conn.WithContext(ctx).Delete(&UserGift{}, id).Error +func (m *defaultUserGiftModel) Delete(ctx context.Context, tx *gorm.DB, id int64) error { + err := gormx.WithTx(ctx, m.DB, tx).Delete(&UserGift{}, id).Error return err } @@ -78,6 +91,5 @@ func (m *defaultUserGiftModel) tableName() string { } func (UserGift) TableName() string { - model := newUserGiftModel(nil) - return model.tableName() + return UserGiftTableName } diff --git a/app/user_center/model/user_gift_pack_model.go b/app/user_center/model/user_gift_pack_model.go new file mode 100644 index 0000000..1861b5b --- /dev/null +++ b/app/user_center/model/user_gift_pack_model.go @@ -0,0 +1,51 @@ +package model + +import ( + "context" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" + "gorm.io/gorm" +) + +var _ UserGiftPackModel = (*customUserGiftPackModel)(nil) + +type ( + // UserGiftPackModel is an interface to be customized, add more methods here, + // and implement the added methods in customUserGiftPackModel. + UserGiftPackModel interface { + userGiftPackModel + // FindOneByUserPack 获取用户领取的礼包 + FindOneByUserPack(ctx context.Context, tx *gorm.DB, userId int64, packType string) (*UserGiftPack, error) + // AddDrawCount 新增领取次数 + AddDrawCount(ctx context.Context, tx *gorm.DB, userId int64, packType string) error + } + + PackContent struct { + Integral int64 `json:"integral"` // 奖励积分数量 + Title []string `json:"title,optional"` // 称号列表 + } + + customUserGiftPackModel struct { + *defaultUserGiftPackModel + } +) + +// NewUserGiftPackModel returns a model for the database table. +func NewUserGiftPackModel(conn *gorm.DB) UserGiftPackModel { + return &customUserGiftPackModel{ + defaultUserGiftPackModel: newUserGiftPackModel(conn), + } +} + +func (m *customUserGiftPackModel) FindOneByUserPack(ctx context.Context, tx *gorm.DB, userId int64, packType string) (*UserGiftPack, error) { + var resp UserGiftPack + err := withTx(ctx, m.conn, tx).Model(&UserGiftPack{}). + Where("user_id = ? AND pack_type = ?", userId, packType).Take(&resp).Error + switch err { + case nil: + return &resp, nil + case gormx.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} diff --git a/app/user_center/model/user_gift_pack_model_gen.go b/app/user_center/model/user_gift_pack_model_gen.go new file mode 100644 index 0000000..43cfb2e --- /dev/null +++ b/app/user_center/model/user_gift_pack_model_gen.go @@ -0,0 +1,91 @@ +// Code generated by goctl. DO NOT EDIT! + +package model + +import ( + "context" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "gorm.io/plugin/optimisticlock" + "strings" + "time" + + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stringx" + "gorm.io/gorm" +) + +var ( + userGiftPackFieldNames = builder.RawFieldNames(&UserGiftPack{}) + userGiftPackRows = strings.Join(userGiftPackFieldNames, ",") + userGiftPackRowsExpectAutoSet = strings.Join(stringx.Remove(userGiftPackFieldNames, "`create_time`", "`update_time`"), ",") + userGiftPackRowsWithPlaceHolder = strings.Join(stringx.Remove(userGiftPackFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?" +) + +type ( + userGiftPackModel interface { + Insert(ctx context.Context, data *UserGiftPack) error + FindOne(ctx context.Context, id int64) (*UserGiftPack, error) + Update(ctx context.Context, data *UserGiftPack) error + Delete(ctx context.Context, id int64) error + } + + defaultUserGiftPackModel struct { + conn *gorm.DB + table string + } + + UserGiftPack struct { + Id int64 `gorm:"column:id;primaryKey"` // 主键 + UserId int64 `gorm:"column:user_id"` // 用户ID + PackType string `gorm:"column:pack_type"` // 礼包类型 + PackContent string `gorm:"column:pack_content"` // 礼包内容(冗余) + DrawCount int64 `gorm:"column:draw_count"` // 已领取数目 + DrawTime time.Time `gorm:"column:draw_time;default:null"` // 领取时间 + Version optimisticlock.Version `gorm:"column:version"` // 乐观锁,版本号 + } +) + +func newUserGiftPackModel(conn *gorm.DB) *defaultUserGiftPackModel { + return &defaultUserGiftPackModel{ + conn: conn, + table: "`user_gift_pack`", + } +} + +func (m *defaultUserGiftPackModel) Insert(ctx context.Context, data *UserGiftPack) error { + err := m.conn.WithContext(ctx).Create(&data).Error + return err +} + +func (m *defaultUserGiftPackModel) FindOne(ctx context.Context, id int64) (*UserGiftPack, error) { + var resp UserGiftPack + err := m.conn.WithContext(ctx).Model(&UserGiftPack{}).Where("`id` = ?", id).Take(&resp).Error + switch err { + case nil: + return &resp, nil + case gormc.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultUserGiftPackModel) Update(ctx context.Context, data *UserGiftPack) error { + err := m.conn.WithContext(ctx).Save(data).Error + return err +} + +func (m *defaultUserGiftPackModel) Delete(ctx context.Context, id int64) error { + err := m.conn.WithContext(ctx).Delete(&UserGiftPack{}, id).Error + + return err +} + +func (m *defaultUserGiftPackModel) tableName() string { + return m.table +} + +func (UserGiftPack) TableName() string { + model := newUserGiftPackModel(nil) + return model.tableName() +} diff --git a/app/user_center/model/user_integral_model.go b/app/user_center/model/user_integral_model.go index 3f6f44d..d656a2c 100644 --- a/app/user_center/model/user_integral_model.go +++ b/app/user_center/model/user_integral_model.go @@ -2,7 +2,7 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "github.com/pkg/errors" "gorm.io/gorm" "gorm.io/plugin/optimisticlock" @@ -16,10 +16,7 @@ type ( // and implement the added methods in customUserIntegralModel. UserIntegralModel interface { userIntegralModel - Transact(ctx context.Context, tx *gorm.DB, fn func(tx *gorm.DB) error) error - InsertTx(ctx context.Context, tx *gorm.DB, data *UserIntegral) error - FindOneTx(ctx context.Context, tx *gorm.DB, userId int64) (*UserIntegral, error) - UpdateTx(ctx context.Context, tx *gorm.DB, integral *UserIntegral) error + UpdateIntegral(ctx context.Context, tx *gorm.DB, integral *UserIntegral) error // ChangeIntegral 用户积分变动 ChangeIntegral(ctx context.Context, tx *gorm.DB, userId int64, change int64) (int64, error) } @@ -36,58 +33,34 @@ func NewUserIntegralModel(conn *gorm.DB) UserIntegralModel { } } -func (m *customUserIntegralModel) Transact(ctx context.Context, tx *gorm.DB, fn func(tx *gorm.DB) error) error { - return withTx(ctx, m.conn, tx).Transaction(fn) -} - -func (m *customUserIntegralModel) InsertTx(ctx context.Context, tx *gorm.DB, data *UserIntegral) error { - err := withTx(ctx, m.conn, tx).Create(&data).Error - return err -} - -func (m *customUserIntegralModel) UpdateTx(ctx context.Context, tx *gorm.DB, integral *UserIntegral) error { +func (m *customUserIntegralModel) UpdateIntegral(ctx context.Context, tx *gorm.DB, integral *UserIntegral) error { if integral.Integral < 0 { return errors.New("无法将积分更新至负数") } - db := withTx(ctx, m.conn, tx) + db := gormx.WithTx(ctx, m.DB, tx) result := db.Model(&integral).Updates(&UserIntegral{Integral: integral.Integral, Version: optimisticlock.Version{Int64: 1}}) if result.Error != nil { return result.Error } if result.RowsAffected == 0 { - return ErrRowsAffectedZero + return gormx.ErrRowsAffectedZero } return nil } -func (m *customUserIntegralModel) FindOneTx(ctx context.Context, tx *gorm.DB, userId int64) (*UserIntegral, error) { - var resp UserIntegral - err := withTx(ctx, m.conn, tx).Model(&UserIntegral{}). - Where("`user_id` = ?", userId).Take(&resp).Error - switch err { - case nil: - return &resp, nil - case gormc.ErrNotFound: - return nil, ErrNotFound - default: - return nil, err - } -} - func (m *customUserIntegralModel) ChangeIntegral(ctx context.Context, tx *gorm.DB, userId int64, change int64) (int64, error) { resp := change - var err error - for i := VersionRetryCount; i > 0; i-- { - err = withTx(ctx, m.conn, tx).Transaction(func(tx *gorm.DB) error { - data, err := m.FindOneTx(ctx, tx, userId) + err := gormx.WithRetry(VersionRetryCount, func() error { + return m.Transact(tx, func(tx *gorm.DB) error { + data, err := m.FindOne(ctx, tx, userId) if err != nil { if errors.Is(err, ErrNotFound) { if change < 0 { return nerr.NewWithCode(nerr.UserIntegralNotEnoughError) } // 用户积分记录不存在,进行插入 - if err = m.InsertTx(ctx, tx, &UserIntegral{ + if err = m.Insert(ctx, tx, &UserIntegral{ UserId: userId, Integral: change, }); err != nil { @@ -102,8 +75,8 @@ func (m *customUserIntegralModel) ChangeIntegral(ctx context.Context, tx *gorm.D return errors.New("用户积分不足") } data.Integral += change - if err = m.UpdateTx(ctx, tx, data); err != nil { - if errors.Is(err, ErrRowsAffectedZero) { + if err = m.UpdateIntegral(ctx, tx, data); err != nil { + if errors.Is(err, gormx.ErrRowsAffectedZero) { return err } return errors.Wrap(err, "更新用户积分失败") @@ -111,14 +84,8 @@ func (m *customUserIntegralModel) ChangeIntegral(ctx context.Context, tx *gorm.D resp = data.Integral return nil }) - if err != nil && errors.Is(err, ErrRowsAffectedZero) { - // 未能正确更新,直接重试 - continue - } else { - // 其它错误退出循环 - break - } - } - + }, func(err error) bool { + return errors.Is(err, gormx.ErrRowsAffectedZero) + }) return resp, err } diff --git a/app/user_center/model/user_integral_model_gen.go b/app/user_center/model/user_integral_model_gen.go index b38297c..cc5119c 100644 --- a/app/user_center/model/user_integral_model_gen.go +++ b/app/user_center/model/user_integral_model_gen.go @@ -4,23 +4,34 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" "gorm.io/plugin/optimisticlock" + "strings" "time" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" ) +var ( + userIntegralFieldNames = builder.RawFieldNames(&UserIntegral{}) + userIntegralRows = strings.Join(userIntegralFieldNames, ",") + userIntegralRowsExpectAutoSet = strings.Join(stringx.Remove(userIntegralFieldNames, "`create_time`", "`update_time`"), ",") + userIntegralRowsWithPlaceHolder = strings.Join(stringx.Remove(userIntegralFieldNames, "`user_id`", "`create_time`", "`update_time`"), "=?,") + "=?" +) + type ( userIntegralModel interface { - Insert(ctx context.Context, data *UserIntegral) error - FindOne(ctx context.Context, integral int64) (*UserIntegral, error) - Update(ctx context.Context, data *UserIntegral) error - Delete(ctx context.Context, integral int64) error + gormx.TxModel + Insert(ctx context.Context, tx *gorm.DB, data *UserIntegral) error + FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*UserIntegral, error) + Update(ctx context.Context, tx *gorm.DB, data *UserIntegral) error + Delete(ctx context.Context, tx *gorm.DB, userId int64) error } defaultUserIntegralModel struct { - conn *gorm.DB + gormx.GormConn table string } @@ -33,38 +44,48 @@ type ( } ) +var UserIntegralTableName = "`user_integral`" + func newUserIntegralModel(conn *gorm.DB) *defaultUserIntegralModel { return &defaultUserIntegralModel{ - conn: conn, - table: "`user_integral`", + GormConn: gormx.NewConn(conn), + table: UserIntegralTableName, } } -func (m *defaultUserIntegralModel) Insert(ctx context.Context, data *UserIntegral) error { - err := m.conn.WithContext(ctx).Create(&data).Error +func (m *defaultUserIntegralModel) Insert(ctx context.Context, tx *gorm.DB, data *UserIntegral) error { + err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error return err } -func (m *defaultUserIntegralModel) FindOne(ctx context.Context, integral int64) (*UserIntegral, error) { +func (m *defaultUserIntegralModel) FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*UserIntegral, error) { var resp UserIntegral - err := m.conn.WithContext(ctx).Model(&UserIntegral{}).Where("`integral` = ?", integral).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&UserIntegral{}).Where("`user_id` = ?", userId).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultUserIntegralModel) Update(ctx context.Context, data *UserIntegral) error { - err := m.conn.WithContext(ctx).Save(data).Error - return err +func (m *defaultUserIntegralModel) Update(ctx context.Context, tx *gorm.DB, data *UserIntegral) error { + + result := gormx.WithTx(ctx, m.DB, tx).Save(data) + if result.Error != nil { + return result.Error + } + if result.RowsAffected == 0 { + return gormx.ErrRowsAffectedZero + } + return nil + } -func (m *defaultUserIntegralModel) Delete(ctx context.Context, integral int64) error { - err := m.conn.WithContext(ctx).Delete(&UserIntegral{}, integral).Error +func (m *defaultUserIntegralModel) Delete(ctx context.Context, tx *gorm.DB, userId int64) error { + err := gormx.WithTx(ctx, m.DB, tx).Delete(&UserIntegral{}, userId).Error return err } @@ -74,6 +95,5 @@ func (m *defaultUserIntegralModel) tableName() string { } func (UserIntegral) TableName() string { - model := newUserIntegralModel(nil) - return model.tableName() + return UserIntegralTableName } diff --git a/app/user_center/model/user_model.go b/app/user_center/model/user_model.go index b78e4f8..4b6128f 100644 --- a/app/user_center/model/user_model.go +++ b/app/user_center/model/user_model.go @@ -1,8 +1,6 @@ package model import ( - "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" "gorm.io/gorm" ) @@ -13,10 +11,6 @@ type ( // and implement the added methods in customUserModel. UserModel interface { userModel - Transact(ctx context.Context, tx *gorm.DB, fn func(tx *gorm.DB) error) error - // InsertTx 插入事务 - InsertTx(ctx context.Context, tx *gorm.DB, data *User) error - FindOneTx(ctx context.Context, tx *gorm.DB, id int64) (*User, error) } customUserModel struct { @@ -30,25 +24,3 @@ func NewUserModel(conn *gorm.DB) UserModel { defaultUserModel: newUserModel(conn), } } - -func (m *customUserModel) Transact(ctx context.Context, tx *gorm.DB, fn func(tx *gorm.DB) error) error { - return withTx(ctx, m.conn, tx).Transaction(fn) -} - -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 - } -} diff --git a/app/user_center/model/user_model_gen.go b/app/user_center/model/user_model_gen.go index 8b3a1e1..a4726df 100644 --- a/app/user_center/model/user_model_gen.go +++ b/app/user_center/model/user_model_gen.go @@ -4,10 +4,10 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" "strings" "time" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "github.com/zeromicro/go-zero/core/stores/builder" "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" @@ -22,57 +22,60 @@ var ( type ( userModel interface { - Insert(ctx context.Context, data *User) error - FindOne(ctx context.Context, id int64) (*User, error) - Update(ctx context.Context, data *User) error - Delete(ctx context.Context, id int64) error + gormx.TxModel + Insert(ctx context.Context, tx *gorm.DB, data *User) error + FindOne(ctx context.Context, tx *gorm.DB, id int64) (*User, error) + Update(ctx context.Context, tx *gorm.DB, data *User) error + Delete(ctx context.Context, tx *gorm.DB, id int64) error } defaultUserModel struct { - conn *gorm.DB + gormx.GormConn table string } User struct { - Id int64 `gorm:"primaryKey"` // 用户ID + Id int64 `gorm:"column:id;primaryKey"` // 用户ID Username string `gorm:"column:username"` // 用户名 CreateTime time.Time `gorm:"column:create_time;default:null"` // 创建时间 UpdateTime time.Time `gorm:"column:update_time;default:null"` // 更新时间 } ) +var UserTableName = "`user`" + func newUserModel(conn *gorm.DB) *defaultUserModel { return &defaultUserModel{ - conn: conn, - table: "`user`", + GormConn: gormx.NewConn(conn), + table: UserTableName, } } -func (m *defaultUserModel) Insert(ctx context.Context, data *User) error { - err := m.conn.WithContext(ctx).Create(data).Error +func (m *defaultUserModel) Insert(ctx context.Context, tx *gorm.DB, data *User) error { + err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error return err } -func (m *defaultUserModel) FindOne(ctx context.Context, id int64) (*User, error) { +func (m *defaultUserModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*User, error) { var resp User - err := m.conn.WithContext(ctx).Model(&User{}).Where("`id` = ?", id).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&User{}).Where("`id` = ?", id).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultUserModel) Update(ctx context.Context, data *User) error { - err := m.conn.WithContext(ctx).Save(data).Error +func (m *defaultUserModel) Update(ctx context.Context, tx *gorm.DB, data *User) error { + err := gormx.WithTx(ctx, m.DB, tx).Save(data).Error return err } -func (m *defaultUserModel) Delete(ctx context.Context, id int64) error { - err := m.conn.WithContext(ctx).Delete(&User{}, id).Error +func (m *defaultUserModel) Delete(ctx context.Context, tx *gorm.DB, id int64) error { + err := gormx.WithTx(ctx, m.DB, tx).Delete(&User{}, id).Error return err } @@ -82,6 +85,5 @@ func (m *defaultUserModel) tableName() string { } func (User) TableName() string { - model := newUserModel(nil) - return model.tableName() + return UserTableName } diff --git a/app/user_center/model/user_nobility_model_gen.go b/app/user_center/model/user_nobility_model_gen.go index 04977c7..2075f90 100644 --- a/app/user_center/model/user_nobility_model_gen.go +++ b/app/user_center/model/user_nobility_model_gen.go @@ -4,72 +4,81 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "strings" "time" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" ) -const ( - TableNameUserNobility = "`user_nobility`" +var ( + userNobilityFieldNames = builder.RawFieldNames(&UserNobility{}) + userNobilityRows = strings.Join(userNobilityFieldNames, ",") + userNobilityRowsExpectAutoSet = strings.Join(stringx.Remove(userNobilityFieldNames, "`create_time`", "`update_time`"), ",") + userNobilityRowsWithPlaceHolder = strings.Join(stringx.Remove(userNobilityFieldNames, "`user_id`", "`create_time`", "`update_time`"), "=?,") + "=?" ) type ( userNobilityModel interface { - Insert(ctx context.Context, data *UserNobility) error - FindOne(ctx context.Context, userId int64) (*UserNobility, error) - Update(ctx context.Context, data *UserNobility) error - Delete(ctx context.Context, userId int64) error + gormx.TxModel + Insert(ctx context.Context, tx *gorm.DB, data *UserNobility) error + FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*UserNobility, error) + Update(ctx context.Context, tx *gorm.DB, data *UserNobility) error + Delete(ctx context.Context, tx *gorm.DB, userId int64) error } defaultUserNobilityModel struct { - conn *gorm.DB + gormx.GormConn table string } UserNobility struct { UserId int64 `gorm:"column:user_id;primaryKey"` // 用户ID NobilityLevel int64 `gorm:"column:nobility_level"` // 贵族等级,0表示非贵族 - Forever BitBool `gorm:"forever"` // 是否永久贵族 - StartTime time.Time `gorm:"start_time"` // 开始时间 - EndTime time.Time `gorm:"end_time"` // 结束时间 + Forever BitBool `gorm:"column:forever"` // 是否永久贵族 + StartTime time.Time `gorm:"column:start_time;default:null"` // 开始时间 + EndTime time.Time `gorm:"column:end_time;default:null"` // 结束时间 CreateTime time.Time `gorm:"column:create_time;default:null"` // 创建时间 UpdateTime time.Time `gorm:"column:update_time;default:null"` // 更新时间 } ) +var UserNobilityTableName = "`user_nobility`" + func newUserNobilityModel(conn *gorm.DB) *defaultUserNobilityModel { return &defaultUserNobilityModel{ - conn: conn, - table: TableNameUserNobility, + GormConn: gormx.NewConn(conn), + table: UserNobilityTableName, } } -func (m *defaultUserNobilityModel) Insert(ctx context.Context, data *UserNobility) error { - err := m.conn.WithContext(ctx).Create(&data).Error +func (m *defaultUserNobilityModel) Insert(ctx context.Context, tx *gorm.DB, data *UserNobility) error { + err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error return err } -func (m *defaultUserNobilityModel) FindOne(ctx context.Context, userId int64) (*UserNobility, error) { +func (m *defaultUserNobilityModel) FindOne(ctx context.Context, tx *gorm.DB, userId int64) (*UserNobility, error) { var resp UserNobility - err := m.conn.WithContext(ctx).Model(&UserNobility{}).Where("`user_id` = ?", userId).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&UserNobility{}).Where("`user_id` = ?", userId).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultUserNobilityModel) Update(ctx context.Context, data *UserNobility) error { - err := m.conn.WithContext(ctx).Save(data).Error +func (m *defaultUserNobilityModel) Update(ctx context.Context, tx *gorm.DB, data *UserNobility) error { + err := gormx.WithTx(ctx, m.DB, tx).Save(data).Error return err } -func (m *defaultUserNobilityModel) Delete(ctx context.Context, userId int64) error { - err := m.conn.WithContext(ctx).Delete(&UserNobility{}, userId).Error +func (m *defaultUserNobilityModel) Delete(ctx context.Context, tx *gorm.DB, userId int64) error { + err := gormx.WithTx(ctx, m.DB, tx).Delete(&UserNobility{}, userId).Error return err } @@ -79,5 +88,5 @@ func (m *defaultUserNobilityModel) tableName() string { } func (UserNobility) TableName() string { - return TableNameUserNobility + return UserNobilityTableName } diff --git a/app/user_center/model/user_platform_model.go b/app/user_center/model/user_platform_model.go index b1a7995..ba4818f 100644 --- a/app/user_center/model/user_platform_model.go +++ b/app/user_center/model/user_platform_model.go @@ -3,7 +3,7 @@ package model import ( "context" "fmt" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "gorm.io/gorm" ) @@ -14,10 +14,6 @@ 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, tx *gorm.DB, platform, pUid string) (*UserPlatform, error) // FindFullByPlatform 查询系统用户信息(包括平台用户) @@ -58,25 +54,15 @@ func NewUserPlatformModel(conn *gorm.DB) UserPlatformModel { } } -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) InsertTx(ctx context.Context, tx *gorm.DB, data *UserPlatform) error { - return withTx(ctx, m.conn, tx).Create(data).Error -} - func (m *customUserPlatformModel) FindOneByPlatformAndPUid(ctx context.Context, tx *gorm.DB, platform, pUid string) (*UserPlatform, error) { - db := withTx(ctx, m.conn, tx) + db := gormx.WithTx(ctx, m.DB, tx) var resp UserPlatform err := db.Model(&UserPlatform{}).Where("`platform` = ? AND `p_uid` = ?", platform, pUid).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err @@ -84,7 +70,7 @@ func (m *customUserPlatformModel) FindOneByPlatformAndPUid(ctx context.Context, } func (m *customUserPlatformModel) FindFullByPlatform(ctx context.Context, tx *gorm.DB, platform, pUid string) (*FullUser, error) { - db := withTx(ctx, m.conn, tx) + db := gormx.WithTx(ctx, m.DB, tx) var resp FullUser err := db. Joins("UserNobility"). @@ -94,7 +80,7 @@ func (m *customUserPlatformModel) FindFullByPlatform(ctx context.Context, tx *go switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err @@ -103,14 +89,14 @@ func (m *customUserPlatformModel) FindFullByPlatform(ctx context.Context, tx *go func (m *customUserPlatformModel) FindEmptyList(ctx context.Context, num int64) ([]UserPlatform, error) { var resp []UserPlatform - err := m.conn.WithContext(ctx). + err := gormx.WithTx(ctx, m.DB, nil). Table(m.tableName()). Where("JSON_LENGTH(`p_info`) = 0 LIMIT ?", num). Find(&resp).Error switch err { case nil: return resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err @@ -119,14 +105,14 @@ func (m *customUserPlatformModel) FindEmptyList(ctx context.Context, num int64) func (m *customUserPlatformModel) FindUpdatableList(ctx context.Context, duration int64, num int64) ([]UserPlatform, error) { var resp []UserPlatform - err := m.conn.WithContext(ctx). + err := gormx.WithTx(ctx, m.DB, nil). Table(m.tableName()). Where("`update_time` < (NOW() - INTERVAL ? HOUR) LIMIT ?", duration, num). Find(&resp).Error switch err { case nil: return resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err @@ -135,7 +121,7 @@ func (m *customUserPlatformModel) FindUpdatableList(ctx context.Context, duratio func (m *customUserPlatformModel) FindOneForRankByUserId(ctx context.Context, uid int64) (*UserPlatformForRank, error) { var resp UserPlatformForRank - err := m.conn.WithContext(ctx). + err := gormx.WithTx(ctx, m.DB, nil). Table(m.table). Select(fmt.Sprintf("%s.user_id, %s.p_uname, %s.p_avatar", m.table, m.table, m.table)). Where("user_id = ?", uid). @@ -143,7 +129,7 @@ func (m *customUserPlatformModel) FindOneForRankByUserId(ctx context.Context, ui switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err @@ -151,7 +137,7 @@ func (m *customUserPlatformModel) FindOneForRankByUserId(ctx context.Context, ui } func (m *customUserPlatformModel) UpdateNobilityByPUid(ctx context.Context, pUid int64, nobility int64) error { - return m.conn.WithContext(ctx). + return gormx.WithTx(ctx, m.DB, nil). Model(&UserPlatform{}). Where("p_uid", pUid). Update("p_nobility_level", nobility).Error @@ -159,14 +145,14 @@ func (m *customUserPlatformModel) UpdateNobilityByPUid(ctx context.Context, pUid func (m *customUserPlatformModel) FindUserIdByPlatform(ctx context.Context, platform, pUid string) (int64, error) { var resp int64 - err := m.conn.WithContext(ctx). + err := gormx.WithTx(ctx, m.DB, nil). Table(m.table). Select(fmt.Sprintf("%s.user_id", m.table)). Where("platform = ? AND p_uid = ?", platform, pUid).Take(&resp).Error switch err { case nil: return resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return 0, ErrNotFound default: return 0, err diff --git a/app/user_center/model/user_platform_model_gen.go b/app/user_center/model/user_platform_model_gen.go index 3263c9a..83ebbe8 100644 --- a/app/user_center/model/user_platform_model_gen.go +++ b/app/user_center/model/user_platform_model_gen.go @@ -4,31 +4,39 @@ package model import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "strings" "time" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" + "github.com/zeromicro/go-zero/core/stores/builder" + "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" ) -const ( - TableNameUserPlatform = "`user_platform`" +var ( + userPlatformFieldNames = builder.RawFieldNames(&UserPlatform{}) + userPlatformRows = strings.Join(userPlatformFieldNames, ",") + userPlatformRowsExpectAutoSet = strings.Join(stringx.Remove(userPlatformFieldNames, "`create_time`", "`update_time`"), ",") + userPlatformRowsWithPlaceHolder = strings.Join(stringx.Remove(userPlatformFieldNames, "`id`", "`create_time`", "`update_time`"), "=?,") + "=?" ) type ( userPlatformModel interface { - Insert(ctx context.Context, data *UserPlatform) error - FindOne(ctx context.Context, id int64) (*UserPlatform, error) - Update(ctx context.Context, data *UserPlatform) error - Delete(ctx context.Context, id int64) error + gormx.TxModel + Insert(ctx context.Context, tx *gorm.DB, data *UserPlatform) error + FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserPlatform, error) + FindOneByPlatformPUid(ctx context.Context, tx *gorm.DB, platform string, pUid string) (*UserPlatform, error) + Update(ctx context.Context, tx *gorm.DB, data *UserPlatform) error + Delete(ctx context.Context, tx *gorm.DB, id int64) error } defaultUserPlatformModel struct { - conn *gorm.DB + gormx.GormConn table string } UserPlatform struct { - Id int64 `gorm:"primaryKey"` // 主键 + Id int64 `gorm:"column:id;primaryKey"` // 主键 UserId int64 `gorm:"column:user_id"` // 用户ID Platform string `gorm:"column:platform"` // 平台类型 POpenid string `gorm:"column:p_openid"` // 平台用户openid @@ -36,44 +44,59 @@ type ( PUname string `gorm:"column:p_uname"` // 平台用户名 PInfo string `gorm:"column:p_info"` // 平台用户原始信息(json) PAvatar string `gorm:"column:p_avatar"` // 平台用户头像地址 - PNobilityLevel int32 `gorm:"p_nobility_level"` // 平台贵族等级 根据平台不同等级有所不同,代码逻辑判断 0代表不是贵族 + PNobilityLevel int64 `gorm:"column:p_nobility_level"` // 平台贵族等级 CreateTime time.Time `gorm:"column:create_time;default:null"` // 创建时间 UpdateTime time.Time `gorm:"column:update_time;default:null"` // 更新时间 } ) +var UserPlatformTableName = "`user_platform`" + func newUserPlatformModel(conn *gorm.DB) *defaultUserPlatformModel { return &defaultUserPlatformModel{ - conn: conn, - table: TableNameUserPlatform, + GormConn: gormx.NewConn(conn), + table: UserPlatformTableName, } } -func (m *defaultUserPlatformModel) Insert(ctx context.Context, data *UserPlatform) error { - err := m.conn.WithContext(ctx).Create(data).Error +func (m *defaultUserPlatformModel) Insert(ctx context.Context, tx *gorm.DB, data *UserPlatform) error { + err := gormx.WithTx(ctx, m.DB, tx).Create(&data).Error return err } -func (m *defaultUserPlatformModel) FindOne(ctx context.Context, id int64) (*UserPlatform, error) { +func (m *defaultUserPlatformModel) FindOne(ctx context.Context, tx *gorm.DB, id int64) (*UserPlatform, error) { + var resp UserPlatform + err := gormx.WithTx(ctx, m.DB, tx).Model(&UserPlatform{}).Where("`id` = ?", id).Take(&resp).Error + switch err { + case nil: + return &resp, nil + case gormx.ErrNotFound: + return nil, ErrNotFound + default: + return nil, err + } +} + +func (m *defaultUserPlatformModel) FindOneByPlatformPUid(ctx context.Context, tx *gorm.DB, platform string, pUid string) (*UserPlatform, error) { var resp UserPlatform - err := m.conn.WithContext(ctx).Model(&UserPlatform{}).Where("`id` = ?", id).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&UserPlatform{}).Where("`platform` = ? and `p_uid` = ?", platform, pUid).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } } -func (m *defaultUserPlatformModel) Update(ctx context.Context, data *UserPlatform) error { - err := m.conn.WithContext(ctx).Save(data).Error +func (m *defaultUserPlatformModel) Update(ctx context.Context, tx *gorm.DB, data *UserPlatform) error { + err := gormx.WithTx(ctx, m.DB, tx).Save(data).Error return err } -func (m *defaultUserPlatformModel) Delete(ctx context.Context, id int64) error { - err := m.conn.WithContext(ctx).Delete(&UserPlatform{}, id).Error +func (m *defaultUserPlatformModel) Delete(ctx context.Context, tx *gorm.DB, id int64) error { + err := gormx.WithTx(ctx, m.DB, tx).Delete(&UserPlatform{}, id).Error return err } @@ -83,5 +106,5 @@ func (m *defaultUserPlatformModel) tableName() string { } func (UserPlatform) TableName() string { - return TableNameUserPlatform + return UserPlatformTableName } diff --git a/app/user_center/model/util.go b/app/user_center/model/util.go deleted file mode 100644 index fa7469e..0000000 --- a/app/user_center/model/util.go +++ /dev/null @@ -1,14 +0,0 @@ -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) - } -} diff --git a/app/user_center/model/vars.go b/app/user_center/model/vars.go index 38cc4af..7e9c8a1 100644 --- a/app/user_center/model/vars.go +++ b/app/user_center/model/vars.go @@ -7,9 +7,8 @@ import ( ) var ErrNotFound = gorm.ErrRecordNotFound -var ErrRowsAffectedZero = errors.New("RowsAffected zero") -const VersionRetryCount = 5 // 乐观锁重试次数 +const VersionRetryCount = 10 // 乐观锁重试次数 // BitBool is an implementation of a bool for the MySQL type BIT(1). // This type allows you to avoid wasting an entire byte for MySQL's boolean type TINYINT. diff --git a/app/user_center/rpc/etc/user_center-dev.yaml b/app/user_center/rpc/etc/user_center-dev.yaml index d03fc70..2d620cc 100644 --- a/app/user_center/rpc/etc/user_center-dev.yaml +++ b/app/user_center/rpc/etc/user_center-dev.yaml @@ -61,4 +61,23 @@ Integral: bilibili: 0.001 # 平台免费礼物到积分的转换 FreeToIntegral: - bilibili: 0.00025 \ No newline at end of file + bilibili: 0.00025 +GiftPack: + - PackType: starter + PackName: 新手礼包 + Condition: + UserLimit: 1 + UserResetType: unset + StartTime: "2022-05-21 09:00:00" + EndTime: "2022-05-21 09:00:00" + Content: + Integral: 50000 + - PackType: subsistence + PackName: 低保 + Condition: + UserLimit: 3 + UserResetType: daily + StartTime: "2022-05-21 09:00:00" + EndTime: "2022-05-21 09:00:00" + Content: + Integrals: [ 10000, 8000, 4000 ] \ No newline at end of file diff --git a/app/user_center/rpc/internal/config/config.go b/app/user_center/rpc/internal/config/config.go index f519ac0..1cf0ede 100644 --- a/app/user_center/rpc/internal/config/config.go +++ b/app/user_center/rpc/internal/config/config.go @@ -10,6 +10,28 @@ type ( Addr []string // 连接地址 Topic string } + GiftPack struct { + PackType string // 礼包类型 + PackName string // 礼包名称 + // Condition 领取条件 + Condition struct { + UserLimit int32 // 单人可领取数量 + UserResetType string `json:",optional"` // 用户礼包重置类型: 不重置(unset)|每天(daily)|每周(weekly)|每月(monthly) + StartTime string // 可领取时间(开始) 两个时间相等则不限期领取 + EndTime string // 可领取时间(结束) + } + // Content 礼包内容 + Content struct { + Integral int64 `json:",default=0"` // 积分数 + Integrals []int64 `json:",optional"` // 积分数(多次领取,每次不同) + + // Title 奖励称号列表 + Title []struct { + Id int64 // 称号ID + Duration int64 // 持续时长,单位: 秒 -1无限 + } `json:",optional"` + } + } // Config 配置 Config struct { @@ -69,5 +91,7 @@ type ( GiftToRMB map[string]float64 // 平台礼物到RMB的转换 FreeToIntegral map[string]float64 // 平台免费礼物到积分的转换 } + // GiftPack 礼包配置 + GiftPackMap []GiftPack } ) diff --git a/app/user_center/rpc/internal/logic/gift/draw_gift_pack_logic.go b/app/user_center/rpc/internal/logic/gift/draw_gift_pack_logic.go new file mode 100644 index 0000000..fdb5d7f --- /dev/null +++ b/app/user_center/rpc/internal/logic/gift/draw_gift_pack_logic.go @@ -0,0 +1,30 @@ +package gift + +import ( + "context" + + "live-service/app/user_center/rpc/internal/svc" + "live-service/app/user_center/rpc/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type DrawGiftPackLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewDrawGiftPackLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DrawGiftPackLogic { + return &DrawGiftPackLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *DrawGiftPackLogic) DrawGiftPack(in *pb.DrawGiftPackReq) (*pb.DrawGiftPackResp, error) { + // todo: add your logic here and delete this line + + return &pb.DrawGiftPackResp{}, nil +} diff --git a/app/user_center/rpc/internal/logic/gift/user_buy_nobility_logic.go b/app/user_center/rpc/internal/logic/gift/user_buy_nobility_logic.go index e9ed6ff..0454e9d 100644 --- a/app/user_center/rpc/internal/logic/gift/user_buy_nobility_logic.go +++ b/app/user_center/rpc/internal/logic/gift/user_buy_nobility_logic.go @@ -2,7 +2,6 @@ package gift import ( "context" - "live-service/app/user_center/rpc/internal/svc" "live-service/app/user_center/rpc/pb" @@ -26,7 +25,28 @@ func NewUserBuyNobilityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *U // UserBuyNobility 用户购买贵族 // 1. 记录送礼 // 2. 新增积分 +// 3. 修改贵族 func (l *UserBuyNobilityLogic) UserBuyNobility(in *pb.UserBuyNobilityReq) (*pb.UserBuyNobilityResp, error) { // TODO 未完成 + //// 记录送礼信息 + //{ + // dbUserGift := &model.UserGift{ + // Id: uuid.NextId(), + // UserId: in.UserId, + // Platform: in.Platform, + // RoomId: in.RoomId, + // GiftId: strconv.FormatInt(in.GiftId, 10), + // GiftName: in.GiftName, + // Num: in.Num, + // } + // if in.IsPaid { + // dbUserGift.Price = in.Price + // } else { + // dbUserGift.FreePrice = in.Price + // } + // if err := l.svcCtx.UserGiftModel.Insert(l.ctx, nil, dbUserGift); err != nil { + // l.Logger.Errorf("记录用户[%d]送礼信息 [%d:%s:%d] 失败,操作继续...", in.UserId, in.GiftId, in.GiftName, in.Num) + // } + //} return &pb.UserBuyNobilityResp{}, nil } diff --git a/app/user_center/rpc/internal/logic/gift/user_send_gift_logic.go b/app/user_center/rpc/internal/logic/gift/user_send_gift_logic.go index 5371592..28225bb 100644 --- a/app/user_center/rpc/internal/logic/gift/user_send_gift_logic.go +++ b/app/user_center/rpc/internal/logic/gift/user_send_gift_logic.go @@ -47,7 +47,7 @@ func (l *UserSendGiftLogic) UserSendGift(in *pb.UserSendGiftReq) (*pb.UserSendGi } else { dbUserGift.FreePrice = in.Price } - if err := l.svcCtx.UserGiftModel.Insert(l.ctx, dbUserGift); err != nil { + if err := l.svcCtx.UserGiftModel.Insert(l.ctx, nil, dbUserGift); err != nil { l.Logger.Errorf("记录用户[%d]送礼信息 [%d:%s:%d] 失败,操作继续...", in.UserId, in.GiftId, in.GiftName, in.Num) } } diff --git a/app/user_center/rpc/internal/logic/gift_collect/collector_bilibili.go b/app/user_center/rpc/internal/logic/gift_collect/collector_bilibili.go index 7251967..e7ccaeb 100644 --- a/app/user_center/rpc/internal/logic/gift_collect/collector_bilibili.go +++ b/app/user_center/rpc/internal/logic/gift_collect/collector_bilibili.go @@ -3,6 +3,7 @@ package gift_collect import ( "context" "encoding/json" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "git.noahlan.cn/northlan/ntools-go/uuid" "github.com/pkg/errors" "gorm.io/gorm" @@ -70,8 +71,7 @@ func GiftCollectorBilibili(ctx context.Context, svcCtx *svc.ServiceContext) (ret } ret = make(map[int64]GiftData) for i := 0; i < batches; i++ { - // TODO 错误处理 - _ = svcCtx.GiftModel.Transaction(ctx, nil, func(tx *gorm.DB) error { + _ = svcCtx.GiftModel.TransactCtx(ctx, nil, func(tx *gorm.DB) error { lenJ := (i + 1) * batchSize if lenJ > dataLen { lenJ = dataLen @@ -103,10 +103,10 @@ func GiftCollectorBilibili(ctx context.Context, svcCtx *svc.ServiceContext) (ret } ret[giftData.Id] = giftData - if err = svcCtx.GiftModel.UpdateTx(ctx, tx, dbGift); err != nil { - if errors.Is(err, model.ErrRowsAffectedZero) { + if err = svcCtx.GiftModel.Update(ctx, tx, dbGift); err != nil { + if errors.Is(err, gormx.ErrRowsAffectedZero) { err = nil - _ = svcCtx.GiftModel.InsertTx(ctx, tx, dbGift) + _ = svcCtx.GiftModel.Insert(ctx, tx, dbGift) } } } diff --git a/app/user_center/rpc/internal/logic/integral/get_user_integral_logic.go b/app/user_center/rpc/internal/logic/integral/get_user_integral_logic.go index 2db2e73..d0b72c6 100644 --- a/app/user_center/rpc/internal/logic/integral/get_user_integral_logic.go +++ b/app/user_center/rpc/internal/logic/integral/get_user_integral_logic.go @@ -28,7 +28,7 @@ func NewGetUserIntegralLogic(ctx context.Context, svcCtx *svc.ServiceContext) *G // GetUserIntegral 获取用户积分 func (l *GetUserIntegralLogic) GetUserIntegral(in *pb.UserIdReq) (*pb.UserIntegralResp, error) { // 查询当前用户积分 - integral, err := l.svcCtx.UserIntegralModel.FindOneTx(l.ctx, nil, in.UserId) + integral, err := l.svcCtx.UserIntegralModel.FindOne(l.ctx, nil, in.UserId) if err != nil { return nil, errors.Wrapf(nerr.NewWithCode(nerr.DBError), "查询用户积分失败, err:%+v", err) } diff --git a/app/user_center/rpc/internal/logic/platform_user/platform_user_retrieve.go b/app/user_center/rpc/internal/logic/platform_user/platform_user_retrieve.go index 7275995..b889cec 100644 --- a/app/user_center/rpc/internal/logic/platform_user/platform_user_retrieve.go +++ b/app/user_center/rpc/internal/logic/platform_user/platform_user_retrieve.go @@ -121,7 +121,7 @@ func (r *UserRetriever) retrieveList(list []model.UserPlatform) { dbModel.PAvatar = pUser.PAvatar dbModel.PInfo = pUser.PInfo dbModel.UpdateTime = time.Now() - _ = r.svcCtx.UserPlatformModel.Update(r.ctx, &dbModel) + _ = r.svcCtx.UserPlatformModel.Update(r.ctx, nil, &dbModel) } } diff --git a/app/user_center/rpc/internal/logic/rank/rank_pvp_submit_logic.go b/app/user_center/rpc/internal/logic/rank/rank_pvp_submit_logic.go new file mode 100644 index 0000000..d05cb89 --- /dev/null +++ b/app/user_center/rpc/internal/logic/rank/rank_pvp_submit_logic.go @@ -0,0 +1,30 @@ +package rank + +import ( + "context" + + "live-service/app/user_center/rpc/internal/svc" + "live-service/app/user_center/rpc/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type RankPvpSubmitLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewRankPvpSubmitLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RankPvpSubmitLogic { + return &RankPvpSubmitLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *RankPvpSubmitLogic) RankPvpSubmit(in *pb.RankPvpSubmitReq) (*pb.RankPvpSubmitResp, error) { + // todo: add your logic here and delete this line + + return &pb.RankPvpSubmitResp{}, nil +} diff --git a/app/user_center/rpc/internal/logic/rank/user_rank_pvp_logic.go b/app/user_center/rpc/internal/logic/rank/user_rank_pvp_logic.go new file mode 100644 index 0000000..94f48b1 --- /dev/null +++ b/app/user_center/rpc/internal/logic/rank/user_rank_pvp_logic.go @@ -0,0 +1,37 @@ +package rank + +import ( + "context" + + "live-service/app/user_center/rpc/internal/svc" + "live-service/app/user_center/rpc/pb" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UserRankPvpLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUserRankPvpLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserRankPvpLogic { + return &UserRankPvpLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *UserRankPvpLogic) UserRankPvp(in *pb.UserRankReq) (*pb.UserRankResp, error) { + // 1. 查询用户自己当前分数 + // 2. 获取排名 + // 3. 所有排名信息(需要首先判断) + if in.AllRankType { + //in.UserId + + } else { + // 只查询一种类型 + } + return &pb.UserRankResp{}, nil +} diff --git a/app/user_center/rpc/internal/logic/statistics/stat_pvp_first_blood_logic.go b/app/user_center/rpc/internal/logic/statistics/stat_pvp_first_blood_logic.go index c3d6b9f..c37ac81 100644 --- a/app/user_center/rpc/internal/logic/statistics/stat_pvp_first_blood_logic.go +++ b/app/user_center/rpc/internal/logic/statistics/stat_pvp_first_blood_logic.go @@ -2,6 +2,7 @@ package statistics import ( "context" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "github.com/pkg/errors" "gorm.io/gorm" "live-service/app/user_center/model" @@ -36,7 +37,7 @@ func (l *StatPvpFirstBloodLogic) StatPvpFirstBlood(in *pb.StatPvPFirstBloodReq) if in.Uid <= 0 { return &pb.Empty{}, nil } - err := l.svcCtx.StatisticsPvpModel.Transaction(l.ctx, nil, func(tx *gorm.DB) error { + err := l.svcCtx.StatisticsPvpModel.TransactCtx(l.ctx, nil, func(tx *gorm.DB) error { // 直接更新,提高效率 props := model.UpdateRecordProps{} if in.Type == TypeFirstBlood { @@ -47,7 +48,7 @@ func (l *StatPvpFirstBloodLogic) StatPvpFirstBlood(in *pb.StatPvPFirstBloodReq) if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.Uid, &props); err != nil { - if errors.Is(err, model.ErrRowsAffectedZero) { + if errors.Is(err, gormx.ErrRowsAffectedZero) { // insert dbModel := model.StatisticsPvp{ UserId: in.Uid, @@ -57,7 +58,7 @@ func (l *StatPvpFirstBloodLogic) StatPvpFirstBlood(in *pb.StatPvPFirstBloodReq) } else if in.Type == TypeDeFirstBlood { dbModel.DeFirstBloodCount = 1 } - if err = l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, &dbModel); err != nil { + if err = l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, &dbModel); err != nil { return errors.Wrapf(err, ErrInsertErr, err) } } else { diff --git a/app/user_center/rpc/internal/logic/statistics/stat_pvp_kill_logic.go b/app/user_center/rpc/internal/logic/statistics/stat_pvp_kill_logic.go index 16cd565..5595b22 100644 --- a/app/user_center/rpc/internal/logic/statistics/stat_pvp_kill_logic.go +++ b/app/user_center/rpc/internal/logic/statistics/stat_pvp_kill_logic.go @@ -2,6 +2,7 @@ package statistics import ( "context" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "github.com/pkg/errors" "gorm.io/gorm" "live-service/app/user_center/model" @@ -33,18 +34,18 @@ func (l *StatPvpKillLogic) StatPvpKill(in *pb.StatPvPKillReq) (*pb.Empty, error) return &pb.Empty{}, nil } - err := l.svcCtx.StatisticsPvpModel.Transaction(l.ctx, nil, func(tx *gorm.DB) error { + err := l.svcCtx.StatisticsPvpModel.TransactCtx(l.ctx, nil, func(tx *gorm.DB) error { // 击杀 props := model.UpdateRecordProps{ KillPlayer: true, } if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.Uid, &props); err != nil { - if errors.Is(err, model.ErrRowsAffectedZero) { + if errors.Is(err, gormx.ErrRowsAffectedZero) { dbModel := &model.StatisticsPvp{ UserId: in.Uid, KillPlayerCount: 1, } - if err := l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, dbModel); err != nil { + if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, dbModel); err != nil { return errors.Wrapf(err, ErrInsertErr, err) } } else { @@ -61,7 +62,7 @@ func (l *StatPvpKillLogic) StatPvpKill(in *pb.StatPvPKillReq) (*pb.Empty, error) DeGeneral: in.IsGeneral, } if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, in.TargetUid, &props); err != nil { - if errors.Is(err, model.ErrRowsAffectedZero) { + if errors.Is(err, gormx.ErrRowsAffectedZero) { dbModel := &model.StatisticsPvp{ UserId: in.TargetUid, DeKillUnitCount: 1, @@ -69,7 +70,7 @@ func (l *StatPvpKillLogic) StatPvpKill(in *pb.StatPvPKillReq) (*pb.Empty, error) if in.IsGeneral { dbModel.DeGeneralCount = 1 } - if err := l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, dbModel); err != nil { + if err := l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, dbModel); err != nil { return errors.Wrapf(err, ErrInsertErr, err) } } else { diff --git a/app/user_center/rpc/internal/logic/statistics/stat_pvp_report_logic.go b/app/user_center/rpc/internal/logic/statistics/stat_pvp_report_logic.go index 6966e1c..3d7455d 100644 --- a/app/user_center/rpc/internal/logic/statistics/stat_pvp_report_logic.go +++ b/app/user_center/rpc/internal/logic/statistics/stat_pvp_report_logic.go @@ -2,6 +2,7 @@ package statistics import ( "context" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "github.com/pkg/errors" "github.com/zeromicro/go-zero/core/logx" "gorm.io/gorm" @@ -30,12 +31,12 @@ func (l *StatPvpReportLogic) StatPvpReport(in *pb.StatPvPReportReq) (*pb.StatPvP { general := in.General if general.Uid > 0 { - if err := l.svcCtx.Db.Transaction(func(tx *gorm.DB) error { + if err := l.svcCtx.StatisticsPvpModel.TransactCtx(l.ctx, nil, func(tx *gorm.DB) error { if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, general.Uid, &model.UpdateRecordProps{General: true}); err != nil { - if errors.Is(err, model.ErrRowsAffectedZero) { + if errors.Is(err, gormx.ErrRowsAffectedZero) { // insert - if err = l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, &model.StatisticsPvp{ + if err = l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, &model.StatisticsPvp{ UserId: general.Uid, GeneralCount: 1, }); err != nil { @@ -80,7 +81,7 @@ func (l *StatPvpReportLogic) StatPvpReport(in *pb.StatPvPReportReq) (*pb.StatPvP winItemResp := make([]*pb.StatPvPReportResp_Item, 0, len(in.WinItems)) lostItemResp := make([]*pb.StatPvPReportResp_Item, 0, len(in.LostItems)) - if err := l.svcCtx.Db.Transaction(func(tx *gorm.DB) error { + if err := l.svcCtx.UserIntegralModel.TransactCtx(l.ctx, nil, func(tx *gorm.DB) error { for _, item := range in.WinItems { uid, damage := item.Uid, item.Damage addIntegral := int64(float64(damage) * battleReportCfg.WinRadio) @@ -119,7 +120,7 @@ func (l *StatPvpReportLogic) StatPvpReport(in *pb.StatPvPReportReq) (*pb.StatPvP } func (l *StatPvpReportLogic) reports(win bool, items []*pb.StatPvPReportReq_Item) error { - return l.svcCtx.Db.Transaction(func(tx *gorm.DB) error { + return l.svcCtx.StatisticsPvpModel.TransactCtx(l.ctx, nil, func(tx *gorm.DB) error { for _, item := range items { if err := l.svcCtx.StatisticsPvpModel.UpdateRecord(l.ctx, tx, item.Uid, &model.UpdateRecordProps{ @@ -130,7 +131,7 @@ func (l *StatPvpReportLogic) reports(win bool, items []*pb.StatPvPReportReq_Item KillUnitCount: &item.KillUnit, DeKillUnitCount: &item.DeKillUnit, }); err != nil { - if errors.Is(err, model.ErrRowsAffectedZero) { + if errors.Is(err, gormx.ErrRowsAffectedZero) { // insert var winCount int64 var lostCount int64 @@ -139,7 +140,7 @@ func (l *StatPvpReportLogic) reports(win bool, items []*pb.StatPvPReportReq_Item } else { lostCount = 1 } - if err = l.svcCtx.StatisticsPvpModel.InsertTx(l.ctx, tx, &model.StatisticsPvp{ + if err = l.svcCtx.StatisticsPvpModel.Insert(l.ctx, tx, &model.StatisticsPvp{ UserId: item.Uid, WinCount: winCount, LostCount: lostCount, diff --git a/app/user_center/rpc/internal/logic/user/retrieve_platform_user_logic.go b/app/user_center/rpc/internal/logic/user/retrieve_platform_user_logic.go index d837a26..a76f38d 100644 --- a/app/user_center/rpc/internal/logic/user/retrieve_platform_user_logic.go +++ b/app/user_center/rpc/internal/logic/user/retrieve_platform_user_logic.go @@ -33,7 +33,7 @@ func (l *RetrievePlatformUserLogic) RetrievePlatformUser(in *pb.PlatformUserReq) var dbFullUser *model.FullUser var username string - if err := l.svcCtx.UserPlatformModel.Transaction(l.ctx, nil, func(tx *gorm.DB) error { + if err := l.svcCtx.Db.Transaction(func(tx *gorm.DB) error { var err error if dbFullUser, err = l.svcCtx.UserPlatformModel.FindFullByPlatform(l.ctx, tx, in.Platform, in.PUid); err != nil { if !errors.Is(err, model.ErrNotFound) { @@ -41,7 +41,7 @@ func (l *RetrievePlatformUserLogic) RetrievePlatformUser(in *pb.PlatformUserReq) } } if dbFullUser != nil { - if one, err := l.svcCtx.UserModel.FindOneTx(l.ctx, tx, dbFullUser.UserId); err != nil { + if one, err := l.svcCtx.UserModel.FindOne(l.ctx, tx, dbFullUser.UserId); err != nil { username = one.Username } return nil @@ -50,7 +50,7 @@ func (l *RetrievePlatformUserLogic) RetrievePlatformUser(in *pb.PlatformUserReq) // insert newId := uuid.NextId() - if err := l.svcCtx.UserModel.InsertTx(l.ctx, tx, &model.User{Id: newId}); err != nil { + if err := l.svcCtx.UserModel.Insert(l.ctx, tx, &model.User{Id: newId}); err != nil { return errors.Wrap(nerr.NewWithCode(nerr.DBError), "插入用户数据失败") } dbPlatformUser := &model.UserPlatform{ @@ -60,7 +60,7 @@ func (l *RetrievePlatformUserLogic) RetrievePlatformUser(in *pb.PlatformUserReq) PUid: in.PUid, PInfo: "{}", } - if err := l.svcCtx.UserPlatformModel.InsertTx(l.ctx, tx, dbPlatformUser); err != nil { + if err := l.svcCtx.UserPlatformModel.Insert(l.ctx, tx, dbPlatformUser); err != nil { return errors.Wrap(nerr.NewWithCode(nerr.DBError), "插入平台用户数据失败") } dbFullUser = &model.FullUser{ diff --git a/app/user_center/rpc/internal/logic/user/user_check_in_logic.go b/app/user_center/rpc/internal/logic/user/user_check_in_logic.go index f1b021e..ab2d120 100644 --- a/app/user_center/rpc/internal/logic/user/user_check_in_logic.go +++ b/app/user_center/rpc/internal/logic/user/user_check_in_logic.go @@ -54,7 +54,7 @@ func (l *UserCheckInLogic) UserCheckIn(in *pb.UserIdReq) (*pb.UserCheckInResp, e return ErrAlreadyCheckIn } // 打卡记录 - if err = l.svcCtx.UserCheckInModel.InsertTx(l.ctx, tx, &model.UserCheckIn{ + if err = l.svcCtx.UserCheckInModel.Insert(l.ctx, tx, &model.UserCheckIn{ Id: uuid.NextId(), UserId: in.UserId, CheckInTime: time.Now(), diff --git a/app/user_center/rpc/internal/server/user_center_server.go b/app/user_center/rpc/internal/server/user_center_server.go index f1ca712..0b11537 100644 --- a/app/user_center/rpc/internal/server/user_center_server.go +++ b/app/user_center/rpc/internal/server/user_center_server.go @@ -82,8 +82,23 @@ func (s *UserCenterServer) StatPvpReport(ctx context.Context, in *pb.StatPvPRepo return l.StatPvpReport(in) } +func (s *UserCenterServer) DrawGiftPack(ctx context.Context, in *pb.DrawGiftPackReq) (*pb.DrawGiftPackResp, error) { + l := gift.NewDrawGiftPackLogic(ctx, s.svcCtx) + return l.DrawGiftPack(in) +} + // rankPvp pvp排行 func (s *UserCenterServer) RankPvp(ctx context.Context, in *pb.RankPvpReq) (*pb.RankPvpResp, error) { l := rank.NewRankPvpLogic(ctx, s.svcCtx) return l.RankPvp(in) } + +func (s *UserCenterServer) RankPvpSubmit(ctx context.Context, in *pb.RankPvpSubmitReq) (*pb.RankPvpSubmitResp, error) { + l := rank.NewRankPvpSubmitLogic(ctx, s.svcCtx) + return l.RankPvpSubmit(in) +} + +func (s *UserCenterServer) UserRankPvp(ctx context.Context, in *pb.UserRankReq) (*pb.UserRankResp, error) { + l := rank.NewUserRankPvpLogic(ctx, s.svcCtx) + return l.UserRankPvp(in) +} diff --git a/app/user_center/rpc/internal/svc/service_context.go b/app/user_center/rpc/internal/svc/service_context.go index 5b3557f..4be7928 100644 --- a/app/user_center/rpc/internal/svc/service_context.go +++ b/app/user_center/rpc/internal/svc/service_context.go @@ -21,6 +21,7 @@ type ServiceContext struct { UserIntegralModel model.UserIntegralModel UserNobilityModel model.UserNobilityModel UserCheckInModel model.UserCheckInModel + UserGiftPackModel model.UserGiftPackModel StatisticsPvpModel model.StatisticsPvpModel RankPvpModel model.RankPvpModel @@ -58,6 +59,7 @@ func NewServiceContext(c config.Config) *ServiceContext { UserIntegralModel: model.NewUserIntegralModel(gormDb), UserNobilityModel: model.NewUserNobilityModel(gormDb), UserCheckInModel: model.NewUserCheckInModel(gormDb), + UserGiftPackModel: model.NewUserGiftPackModel(gormDb), StatisticsPvpModel: model.NewStatisticsPvpModel(gormDb), RankPvpModel: model.NewRankPvpModel(gormDb), GiftModel: model.NewGiftModel(gormDb), diff --git a/app/user_center/rpc/pb/user_center.pb.go b/app/user_center/rpc/pb/user_center.pb.go index 623210e..74cd9c3 100644 --- a/app/user_center/rpc/pb/user_center.pb.go +++ b/app/user_center/rpc/pb/user_center.pb.go @@ -20,6 +20,132 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type GiftType int32 + +const ( + GiftType_starter GiftType = 0 // 新手礼包 + GiftType_subsistence GiftType = 1 // 低保 +) + +// Enum value maps for GiftType. +var ( + GiftType_name = map[int32]string{ + 0: "starter", + 1: "subsistence", + } + GiftType_value = map[string]int32{ + "starter": 0, + "subsistence": 1, + } +) + +func (x GiftType) Enum() *GiftType { + p := new(GiftType) + *p = x + return p +} + +func (x GiftType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GiftType) Descriptor() protoreflect.EnumDescriptor { + return file_user_center_proto_enumTypes[0].Descriptor() +} + +func (GiftType) Type() protoreflect.EnumType { + return &file_user_center_proto_enumTypes[0] +} + +func (x GiftType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GiftType.Descriptor instead. +func (GiftType) EnumDescriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{0} +} + +////////////////////// rank +type RankType int32 + +const ( + RankType_Unknown RankType = 0 + RankType_Damage RankType = 1 // 伤害榜 + RankType_DeDamage RankType = 2 // 受伤榜 + RankType_General RankType = 3 // 名将榜 + RankType_DeGeneral RankType = 4 // 落马榜 + RankType_KillUnit RankType = 5 // 小兵击杀 + RankType_DeKillUnit RankType = 6 // 小兵被杀 + RankType_KillPlayer RankType = 7 // 击杀玩家 + RankType_DeKillPlayer RankType = 8 // 被杀榜 + RankType_Win RankType = 9 // 获胜榜 + RankType_Lost RankType = 10 // 战败榜 + RankType_FirstBlood RankType = 11 // 一血榜 + RankType_DeFirstBlood RankType = 12 // 被拿一血榜 +) + +// Enum value maps for RankType. +var ( + RankType_name = map[int32]string{ + 0: "Unknown", + 1: "Damage", + 2: "DeDamage", + 3: "General", + 4: "DeGeneral", + 5: "KillUnit", + 6: "DeKillUnit", + 7: "KillPlayer", + 8: "DeKillPlayer", + 9: "Win", + 10: "Lost", + 11: "FirstBlood", + 12: "DeFirstBlood", + } + RankType_value = map[string]int32{ + "Unknown": 0, + "Damage": 1, + "DeDamage": 2, + "General": 3, + "DeGeneral": 4, + "KillUnit": 5, + "DeKillUnit": 6, + "KillPlayer": 7, + "DeKillPlayer": 8, + "Win": 9, + "Lost": 10, + "FirstBlood": 11, + "DeFirstBlood": 12, + } +) + +func (x RankType) Enum() *RankType { + p := new(RankType) + *p = x + return p +} + +func (x RankType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RankType) Descriptor() protoreflect.EnumDescriptor { + return file_user_center_proto_enumTypes[1].Descriptor() +} + +func (RankType) Type() protoreflect.EnumType { + return &file_user_center_proto_enumTypes[1] +} + +func (x RankType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RankType.Descriptor instead. +func (RankType) EnumDescriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{1} +} + // model type User struct { state protoimpl.MessageState @@ -1210,18 +1336,18 @@ func (x *StatPvPReportResp) GetLostItems() []*StatPvPReportResp_Item { return nil } -// rank -type RankPvpReq struct { +type GiftPackItem struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` // rank类型 - TopN int32 `protobuf:"varint,2,opt,name=topN,proto3" json:"topN,omitempty"` // TopN + GiftType string `protobuf:"bytes,1,opt,name=giftType,proto3" json:"giftType,omitempty"` // 礼包类型 starter:新手礼包 + Integral int64 `protobuf:"varint,2,opt,name=integral,proto3" json:"integral,omitempty"` // 获取的积分 + Title []string `protobuf:"bytes,3,rep,name=title,proto3" json:"title,omitempty"` // 获取的称号 } -func (x *RankPvpReq) Reset() { - *x = RankPvpReq{} +func (x *GiftPackItem) Reset() { + *x = GiftPackItem{} if protoimpl.UnsafeEnabled { mi := &file_user_center_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1229,13 +1355,13 @@ func (x *RankPvpReq) Reset() { } } -func (x *RankPvpReq) String() string { +func (x *GiftPackItem) String() string { return protoimpl.X.MessageStringOf(x) } -func (*RankPvpReq) ProtoMessage() {} +func (*GiftPackItem) ProtoMessage() {} -func (x *RankPvpReq) ProtoReflect() protoreflect.Message { +func (x *GiftPackItem) ProtoReflect() protoreflect.Message { mi := &file_user_center_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1247,36 +1373,44 @@ func (x *RankPvpReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use RankPvpReq.ProtoReflect.Descriptor instead. -func (*RankPvpReq) Descriptor() ([]byte, []int) { +// Deprecated: Use GiftPackItem.ProtoReflect.Descriptor instead. +func (*GiftPackItem) Descriptor() ([]byte, []int) { return file_user_center_proto_rawDescGZIP(), []int{18} } -func (x *RankPvpReq) GetType() int32 { +func (x *GiftPackItem) GetGiftType() string { if x != nil { - return x.Type + return x.GiftType } - return 0 + return "" } -func (x *RankPvpReq) GetTopN() int32 { +func (x *GiftPackItem) GetIntegral() int64 { if x != nil { - return x.TopN + return x.Integral } return 0 } -type RankPvpResp struct { +func (x *GiftPackItem) GetTitle() []string { + if x != nil { + return x.Title + } + return nil +} + +type DrawGiftPackReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` // rank类型 - Items []*RankPvpResp_Item `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` // rank数据 + Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` + Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` + GiftType string `protobuf:"bytes,3,opt,name=giftType,proto3" json:"giftType,omitempty"` } -func (x *RankPvpResp) Reset() { - *x = RankPvpResp{} +func (x *DrawGiftPackReq) Reset() { + *x = DrawGiftPackReq{} if protoimpl.UnsafeEnabled { mi := &file_user_center_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1284,13 +1418,13 @@ func (x *RankPvpResp) Reset() { } } -func (x *RankPvpResp) String() string { +func (x *DrawGiftPackReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*RankPvpResp) ProtoMessage() {} +func (*DrawGiftPackReq) ProtoMessage() {} -func (x *RankPvpResp) ProtoReflect() protoreflect.Message { +func (x *DrawGiftPackReq) ProtoReflect() protoreflect.Message { mi := &file_user_center_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1302,40 +1436,46 @@ func (x *RankPvpResp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use RankPvpResp.ProtoReflect.Descriptor instead. -func (*RankPvpResp) Descriptor() ([]byte, []int) { +// Deprecated: Use DrawGiftPackReq.ProtoReflect.Descriptor instead. +func (*DrawGiftPackReq) Descriptor() ([]byte, []int) { return file_user_center_proto_rawDescGZIP(), []int{19} } -func (x *RankPvpResp) GetType() int32 { +func (x *DrawGiftPackReq) GetUid() int64 { if x != nil { - return x.Type + return x.Uid } return 0 } -func (x *RankPvpResp) GetItems() []*RankPvpResp_Item { +func (x *DrawGiftPackReq) GetUname() string { if x != nil { - return x.Items + return x.Uname } - return nil + return "" } -type StatPvPReportReq_Item struct { +func (x *DrawGiftPackReq) GetGiftType() string { + if x != nil { + return x.GiftType + } + return "" +} + +type DrawGiftPackResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID - Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` // 用户名 - Damage int64 `protobuf:"varint,3,opt,name=damage,proto3" json:"damage,omitempty"` // 伤害量 - DeDamage int64 `protobuf:"varint,4,opt,name=deDamage,proto3" json:"deDamage,omitempty"` // 承受伤害 - KillUnit int64 `protobuf:"varint,5,opt,name=killUnit,proto3" json:"killUnit,omitempty"` // 击杀单位数量 - DeKillUnit int64 `protobuf:"varint,6,opt,name=deKillUnit,proto3" json:"deKillUnit,omitempty"` // 被杀单位数量 + Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` + Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` + Code int32 `protobuf:"varint,3,opt,name=code,proto3" json:"code,omitempty"` // 领取结果 200:成功 201100:已经领取过 201101:已领取完 + Msg string `protobuf:"bytes,4,opt,name=msg,proto3" json:"msg,omitempty"` // 消息 [领取成功|已经领取过|该用户已领取(当日|每周|每月)完所有礼包] + Item *GiftPackItem `protobuf:"bytes,10,opt,name=item,proto3" json:"item,omitempty"` } -func (x *StatPvPReportReq_Item) Reset() { - *x = StatPvPReportReq_Item{} +func (x *DrawGiftPackResp) Reset() { + *x = DrawGiftPackResp{} if protoimpl.UnsafeEnabled { mi := &file_user_center_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1343,13 +1483,13 @@ func (x *StatPvPReportReq_Item) Reset() { } } -func (x *StatPvPReportReq_Item) String() string { +func (x *DrawGiftPackResp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*StatPvPReportReq_Item) ProtoMessage() {} +func (*DrawGiftPackResp) ProtoMessage() {} -func (x *StatPvPReportReq_Item) ProtoReflect() protoreflect.Message { +func (x *DrawGiftPackResp) ProtoReflect() protoreflect.Message { mi := &file_user_center_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1361,64 +1501,57 @@ func (x *StatPvPReportReq_Item) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use StatPvPReportReq_Item.ProtoReflect.Descriptor instead. -func (*StatPvPReportReq_Item) Descriptor() ([]byte, []int) { - return file_user_center_proto_rawDescGZIP(), []int{16, 0} +// Deprecated: Use DrawGiftPackResp.ProtoReflect.Descriptor instead. +func (*DrawGiftPackResp) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{20} } -func (x *StatPvPReportReq_Item) GetUid() int64 { +func (x *DrawGiftPackResp) GetUid() int64 { if x != nil { return x.Uid } return 0 } -func (x *StatPvPReportReq_Item) GetUname() string { +func (x *DrawGiftPackResp) GetUname() string { if x != nil { return x.Uname } return "" } -func (x *StatPvPReportReq_Item) GetDamage() int64 { - if x != nil { - return x.Damage - } - return 0 -} - -func (x *StatPvPReportReq_Item) GetDeDamage() int64 { +func (x *DrawGiftPackResp) GetCode() int32 { if x != nil { - return x.DeDamage + return x.Code } return 0 } -func (x *StatPvPReportReq_Item) GetKillUnit() int64 { +func (x *DrawGiftPackResp) GetMsg() string { if x != nil { - return x.KillUnit + return x.Msg } - return 0 + return "" } -func (x *StatPvPReportReq_Item) GetDeKillUnit() int64 { +func (x *DrawGiftPackResp) GetItem() *GiftPackItem { if x != nil { - return x.DeKillUnit + return x.Item } - return 0 + return nil } -type StatPvPReportReq_General struct { +type RankPvpReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` // 名将UID - Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` // 名将用户名 + Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` // rank类型 + TopN int32 `protobuf:"varint,2,opt,name=topN,proto3" json:"topN,omitempty"` // TopN } -func (x *StatPvPReportReq_General) Reset() { - *x = StatPvPReportReq_General{} +func (x *RankPvpReq) Reset() { + *x = RankPvpReq{} if protoimpl.UnsafeEnabled { mi := &file_user_center_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1426,13 +1559,13 @@ func (x *StatPvPReportReq_General) Reset() { } } -func (x *StatPvPReportReq_General) String() string { +func (x *RankPvpReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*StatPvPReportReq_General) ProtoMessage() {} +func (*RankPvpReq) ProtoMessage() {} -func (x *StatPvPReportReq_General) ProtoReflect() protoreflect.Message { +func (x *RankPvpReq) ProtoReflect() protoreflect.Message { mi := &file_user_center_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1444,37 +1577,36 @@ func (x *StatPvPReportReq_General) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use StatPvPReportReq_General.ProtoReflect.Descriptor instead. -func (*StatPvPReportReq_General) Descriptor() ([]byte, []int) { - return file_user_center_proto_rawDescGZIP(), []int{16, 1} +// Deprecated: Use RankPvpReq.ProtoReflect.Descriptor instead. +func (*RankPvpReq) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{21} } -func (x *StatPvPReportReq_General) GetUid() int64 { +func (x *RankPvpReq) GetType() int32 { if x != nil { - return x.Uid + return x.Type } return 0 } -func (x *StatPvPReportReq_General) GetUname() string { +func (x *RankPvpReq) GetTopN() int32 { if x != nil { - return x.Uname + return x.TopN } - return "" + return 0 } -type StatPvPReportResp_Item struct { +type RankPvpResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID - Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` // 用户名 - AddonIntegral int64 `protobuf:"varint,3,opt,name=addonIntegral,proto3" json:"addonIntegral,omitempty"` // 本次获取的积分 + Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` // rank类型 + Items []*RankPvpResp_Item `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` // rank数据 } -func (x *StatPvPReportResp_Item) Reset() { - *x = StatPvPReportResp_Item{} +func (x *RankPvpResp) Reset() { + *x = RankPvpResp{} if protoimpl.UnsafeEnabled { mi := &file_user_center_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1482,13 +1614,13 @@ func (x *StatPvPReportResp_Item) Reset() { } } -func (x *StatPvPReportResp_Item) String() string { +func (x *RankPvpResp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*StatPvPReportResp_Item) ProtoMessage() {} +func (*RankPvpResp) ProtoMessage() {} -func (x *StatPvPReportResp_Item) ProtoReflect() protoreflect.Message { +func (x *RankPvpResp) ProtoReflect() protoreflect.Message { mi := &file_user_center_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1500,45 +1632,37 @@ func (x *StatPvPReportResp_Item) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use StatPvPReportResp_Item.ProtoReflect.Descriptor instead. -func (*StatPvPReportResp_Item) Descriptor() ([]byte, []int) { - return file_user_center_proto_rawDescGZIP(), []int{17, 0} +// Deprecated: Use RankPvpResp.ProtoReflect.Descriptor instead. +func (*RankPvpResp) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{22} } -func (x *StatPvPReportResp_Item) GetUid() int64 { +func (x *RankPvpResp) GetType() int32 { if x != nil { - return x.Uid + return x.Type } return 0 } -func (x *StatPvPReportResp_Item) GetUname() string { - if x != nil { - return x.Uname - } - return "" -} - -func (x *StatPvPReportResp_Item) GetAddonIntegral() int64 { +func (x *RankPvpResp) GetItems() []*RankPvpResp_Item { if x != nil { - return x.AddonIntegral + return x.Items } - return 0 + return nil } -type RankPvpResp_Item struct { +// RankPvpSubmitReq 手动排行榜结算 +type RankPvpSubmitReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` - Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` - Score int64 `protobuf:"varint,3,opt,name=score,proto3" json:"score,omitempty"` - Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"` + RankType int32 `protobuf:"varint,1,opt,name=rankType,proto3" json:"rankType,omitempty"` // 待结算的排行榜类型 + AllRankType bool `protobuf:"varint,2,opt,name=allRankType,proto3" json:"allRankType,omitempty"` // 是否直接结算所有排行类型 } -func (x *RankPvpResp_Item) Reset() { - *x = RankPvpResp_Item{} +func (x *RankPvpSubmitReq) Reset() { + *x = RankPvpSubmitReq{} if protoimpl.UnsafeEnabled { mi := &file_user_center_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1546,13 +1670,13 @@ func (x *RankPvpResp_Item) Reset() { } } -func (x *RankPvpResp_Item) String() string { +func (x *RankPvpSubmitReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*RankPvpResp_Item) ProtoMessage() {} +func (*RankPvpSubmitReq) ProtoMessage() {} -func (x *RankPvpResp_Item) ProtoReflect() protoreflect.Message { +func (x *RankPvpSubmitReq) ProtoReflect() protoreflect.Message { mi := &file_user_center_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1564,48 +1688,673 @@ func (x *RankPvpResp_Item) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use RankPvpResp_Item.ProtoReflect.Descriptor instead. -func (*RankPvpResp_Item) Descriptor() ([]byte, []int) { - return file_user_center_proto_rawDescGZIP(), []int{19, 0} +// Deprecated: Use RankPvpSubmitReq.ProtoReflect.Descriptor instead. +func (*RankPvpSubmitReq) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{23} } -func (x *RankPvpResp_Item) GetUid() int64 { +func (x *RankPvpSubmitReq) GetRankType() int32 { if x != nil { - return x.Uid + return x.RankType } return 0 } -func (x *RankPvpResp_Item) GetUname() string { +func (x *RankPvpSubmitReq) GetAllRankType() bool { if x != nil { - return x.Uname + return x.AllRankType } - return "" + return false } -func (x *RankPvpResp_Item) GetScore() int64 { - if x != nil { - return x.Score +type RankPvpSubmitResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items []*RankPvpSubmitResp_Item `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` +} + +func (x *RankPvpSubmitResp) Reset() { + *x = RankPvpSubmitResp{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -func (x *RankPvpResp_Item) GetAvatar() string { +func (x *RankPvpSubmitResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RankPvpSubmitResp) ProtoMessage() {} + +func (x *RankPvpSubmitResp) ProtoReflect() protoreflect.Message { + mi := &file_user_center_proto_msgTypes[24] + 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 RankPvpSubmitResp.ProtoReflect.Descriptor instead. +func (*RankPvpSubmitResp) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{24} +} + +func (x *RankPvpSubmitResp) GetItems() []*RankPvpSubmitResp_Item { if x != nil { - return x.Avatar + return x.Items } - return "" + return nil } -var File_user_center_proto protoreflect.FileDescriptor +// UserRankReq 查询用户自己的排行 +type UserRankReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -var file_user_center_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xd6, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` // 系统用户ID + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // 用户名 + RankType int32 `protobuf:"varint,3,opt,name=rankType,proto3" json:"rankType,omitempty"` // 排行榜类型 + AllRankType bool `protobuf:"varint,4,opt,name=allRankType,proto3" json:"allRankType,omitempty"` // 直接查询所有排行类型 +} + +func (x *UserRankReq) Reset() { + *x = UserRankReq{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserRankReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserRankReq) ProtoMessage() {} + +func (x *UserRankReq) ProtoReflect() protoreflect.Message { + mi := &file_user_center_proto_msgTypes[25] + 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 UserRankReq.ProtoReflect.Descriptor instead. +func (*UserRankReq) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{25} +} + +func (x *UserRankReq) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *UserRankReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *UserRankReq) GetRankType() int32 { + if x != nil { + return x.RankType + } + return 0 +} + +func (x *UserRankReq) GetAllRankType() bool { + if x != nil { + return x.AllRankType + } + return false +} + +type UserRankResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items []*UserRankResp_Item `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` +} + +func (x *UserRankResp) Reset() { + *x = UserRankResp{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserRankResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserRankResp) ProtoMessage() {} + +func (x *UserRankResp) ProtoReflect() protoreflect.Message { + mi := &file_user_center_proto_msgTypes[26] + 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 UserRankResp.ProtoReflect.Descriptor instead. +func (*UserRankResp) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{26} +} + +func (x *UserRankResp) GetItems() []*UserRankResp_Item { + if x != nil { + return x.Items + } + 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 + Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` // 用户名 + Damage int64 `protobuf:"varint,3,opt,name=damage,proto3" json:"damage,omitempty"` // 伤害量 + DeDamage int64 `protobuf:"varint,4,opt,name=deDamage,proto3" json:"deDamage,omitempty"` // 承受伤害 + KillUnit int64 `protobuf:"varint,5,opt,name=killUnit,proto3" json:"killUnit,omitempty"` // 击杀单位数量 + DeKillUnit int64 `protobuf:"varint,6,opt,name=deKillUnit,proto3" json:"deKillUnit,omitempty"` // 被杀单位数量 +} + +func (x *StatPvPReportReq_Item) Reset() { + *x = StatPvPReportReq_Item{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[27] + 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[27] + 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{16, 0} +} + +func (x *StatPvPReportReq_Item) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *StatPvPReportReq_Item) GetUname() string { + if x != nil { + return x.Uname + } + return "" +} + +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 StatPvPReportReq_General struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` // 名将UID + Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` // 名将用户名 +} + +func (x *StatPvPReportReq_General) Reset() { + *x = StatPvPReportReq_General{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatPvPReportReq_General) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatPvPReportReq_General) ProtoMessage() {} + +func (x *StatPvPReportReq_General) ProtoReflect() protoreflect.Message { + mi := &file_user_center_proto_msgTypes[28] + 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_General.ProtoReflect.Descriptor instead. +func (*StatPvPReportReq_General) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{16, 1} +} + +func (x *StatPvPReportReq_General) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *StatPvPReportReq_General) GetUname() string { + if x != nil { + return x.Uname + } + return "" +} + +type StatPvPReportResp_Item struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID + Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` // 用户名 + AddonIntegral int64 `protobuf:"varint,3,opt,name=addonIntegral,proto3" json:"addonIntegral,omitempty"` // 本次获取的积分 +} + +func (x *StatPvPReportResp_Item) Reset() { + *x = StatPvPReportResp_Item{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatPvPReportResp_Item) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatPvPReportResp_Item) ProtoMessage() {} + +func (x *StatPvPReportResp_Item) ProtoReflect() protoreflect.Message { + mi := &file_user_center_proto_msgTypes[29] + 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 StatPvPReportResp_Item.ProtoReflect.Descriptor instead. +func (*StatPvPReportResp_Item) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{17, 0} +} + +func (x *StatPvPReportResp_Item) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *StatPvPReportResp_Item) GetUname() string { + if x != nil { + return x.Uname + } + return "" +} + +func (x *StatPvPReportResp_Item) GetAddonIntegral() int64 { + if x != nil { + return x.AddonIntegral + } + return 0 +} + +type RankPvpResp_Item struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` + Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` + Score int64 `protobuf:"varint,3,opt,name=score,proto3" json:"score,omitempty"` + Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"` +} + +func (x *RankPvpResp_Item) Reset() { + *x = RankPvpResp_Item{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RankPvpResp_Item) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RankPvpResp_Item) ProtoMessage() {} + +func (x *RankPvpResp_Item) ProtoReflect() protoreflect.Message { + mi := &file_user_center_proto_msgTypes[30] + 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 RankPvpResp_Item.ProtoReflect.Descriptor instead. +func (*RankPvpResp_Item) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{22, 0} +} + +func (x *RankPvpResp_Item) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *RankPvpResp_Item) GetUname() string { + if x != nil { + return x.Uname + } + return "" +} + +func (x *RankPvpResp_Item) GetScore() int64 { + if x != nil { + return x.Score + } + return 0 +} + +func (x *RankPvpResp_Item) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +type RankPvpSubmitResp_Result struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"` + Integral int64 `protobuf:"varint,4,opt,name=integral,proto3" json:"integral,omitempty"` // 获取到的积分数 + Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` // 获取到的称号 + TitleDuration int64 `protobuf:"varint,6,opt,name=titleDuration,proto3" json:"titleDuration,omitempty"` // 称号持续时间(单位: 秒,负数为无限长) +} + +func (x *RankPvpSubmitResp_Result) Reset() { + *x = RankPvpSubmitResp_Result{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RankPvpSubmitResp_Result) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RankPvpSubmitResp_Result) ProtoMessage() {} + +func (x *RankPvpSubmitResp_Result) ProtoReflect() protoreflect.Message { + mi := &file_user_center_proto_msgTypes[31] + 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 RankPvpSubmitResp_Result.ProtoReflect.Descriptor instead. +func (*RankPvpSubmitResp_Result) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{24, 0} +} + +func (x *RankPvpSubmitResp_Result) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *RankPvpSubmitResp_Result) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *RankPvpSubmitResp_Result) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +func (x *RankPvpSubmitResp_Result) GetIntegral() int64 { + if x != nil { + return x.Integral + } + return 0 +} + +func (x *RankPvpSubmitResp_Result) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *RankPvpSubmitResp_Result) GetTitleDuration() int64 { + if x != nil { + return x.TitleDuration + } + return 0 +} + +type RankPvpSubmitResp_Item struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RankType int32 `protobuf:"varint,1,opt,name=rankType,proto3" json:"rankType,omitempty"` // 排行榜类型 + Results []*RankPvpSubmitResp_Result `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"` // 上榜玩家? +} + +func (x *RankPvpSubmitResp_Item) Reset() { + *x = RankPvpSubmitResp_Item{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RankPvpSubmitResp_Item) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RankPvpSubmitResp_Item) ProtoMessage() {} + +func (x *RankPvpSubmitResp_Item) ProtoReflect() protoreflect.Message { + mi := &file_user_center_proto_msgTypes[32] + 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 RankPvpSubmitResp_Item.ProtoReflect.Descriptor instead. +func (*RankPvpSubmitResp_Item) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{24, 1} +} + +func (x *RankPvpSubmitResp_Item) GetRankType() int32 { + if x != nil { + return x.RankType + } + return 0 +} + +func (x *RankPvpSubmitResp_Item) GetResults() []*RankPvpSubmitResp_Result { + if x != nil { + return x.Results + } + return nil +} + +type UserRankResp_Item struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RankType int32 `protobuf:"varint,1,opt,name=rankType,proto3" json:"rankType,omitempty"` // 排行类型 + Pos int32 `protobuf:"varint,2,opt,name=pos,proto3" json:"pos,omitempty"` // 名次 +} + +func (x *UserRankResp_Item) Reset() { + *x = UserRankResp_Item{} + if protoimpl.UnsafeEnabled { + mi := &file_user_center_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserRankResp_Item) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserRankResp_Item) ProtoMessage() {} + +func (x *UserRankResp_Item) ProtoReflect() protoreflect.Message { + mi := &file_user_center_proto_msgTypes[33] + 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 UserRankResp_Item.ProtoReflect.Descriptor instead. +func (*UserRankResp_Item) Descriptor() ([]byte, []int) { + return file_user_center_proto_rawDescGZIP(), []int{26, 0} +} + +func (x *UserRankResp_Item) GetRankType() int32 { + if x != nil { + return x.RankType + } + return 0 +} + +func (x *UserRankResp_Item) GetPos() int32 { + if x != nil { + return x.Pos + } + return 0 +} + +var File_user_center_proto protoreflect.FileDescriptor + +var file_user_center_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xd6, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, + 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x55, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x55, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x55, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x55, @@ -1748,63 +2497,150 @@ var file_user_center_proto_rawDesc = []byte{ 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x64, 0x64, 0x6f, 0x6e, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x61, 0x64, - 0x64, 0x6f, 0x6e, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 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, 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, - 0x84, 0x05, 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, 0x36, 0x0a, 0x0f, 0x67, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x42, 0x79, - 0x50, 0x55, 0x69, 0x64, 0x12, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, - 0x72, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3f, 0x0a, 0x0e, 0x43, 0x68, 0x61, - 0x6e, 0x67, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x15, 0x2e, 0x70, 0x62, - 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, - 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x6e, - 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x0f, 0x47, 0x65, - 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x0d, 0x2e, - 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, - 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x31, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, - 0x6e, 0x12, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x52, 0x65, 0x71, - 0x1a, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x39, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x6e, - 0x64, 0x47, 0x69, 0x66, 0x74, 0x12, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, - 0x65, 0x6e, 0x64, 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x6e, 0x64, 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x42, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x42, 0x75, 0x79, 0x4e, 0x6f, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x75, 0x79, - 0x4e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x70, 0x62, - 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x75, 0x79, 0x4e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, - 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, 0x0a, 0x11, 0x73, 0x74, 0x61, 0x74, 0x50, 0x76, 0x70, 0x46, 0x69, 0x72, - 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x6f, 0x64, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x50, 0x76, 0x50, 0x46, 0x69, 0x72, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x6f, 0x64, 0x52, 0x65, - 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3c, 0x0a, 0x0d, - 0x73, 0x74, 0x61, 0x74, 0x50, 0x76, 0x70, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x2e, - 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x07, 0x72, 0x61, - 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x50, - 0x76, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x50, - 0x76, 0x70, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x6f, 0x6e, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0x5c, 0x0a, 0x0c, 0x47, + 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x67, + 0x69, 0x66, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, + 0x69, 0x66, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, + 0x72, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, + 0x72, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x22, 0x55, 0x0a, 0x0f, 0x44, 0x72, 0x61, + 0x77, 0x47, 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 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, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x22, 0x86, 0x01, 0x0a, 0x10, 0x44, 0x72, 0x61, 0x77, 0x47, 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, + 0x6b, 0x52, 0x65, 0x73, 0x70, 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, 0x12, 0x0a, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6d, 0x73, 0x67, 0x12, 0x24, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x49, + 0x74, 0x65, 0x6d, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 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, 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, 0x22, 0x50, 0x0a, + 0x10, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, + 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, + 0x0b, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0b, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, + 0xd0, 0x02, 0x0a, 0x11, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x30, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, + 0x70, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x49, 0x74, 0x65, 0x6d, + 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0xac, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, + 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, + 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x1a, + 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, + 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x44, 0x75, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x5a, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1a, + 0x0a, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x72, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x62, + 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x73, 0x22, 0x7f, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, + 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x54, + 0x79, 0x70, 0x65, 0x22, 0x71, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x52, 0x61, 0x6e, 0x6b, 0x52, + 0x65, 0x73, 0x70, 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x61, 0x6e, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x1a, 0x34, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x61, 0x6e, 0x6b, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x61, 0x6e, 0x6b, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x2a, 0x28, 0x0a, 0x08, 0x47, 0x69, 0x66, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x72, 0x10, 0x00, 0x12, + 0x0f, 0x0a, 0x0b, 0x73, 0x75, 0x62, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x10, 0x01, + 0x2a, 0xc2, 0x01, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, + 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x61, + 0x6d, 0x61, 0x67, 0x65, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x65, 0x44, 0x61, 0x6d, 0x61, + 0x67, 0x65, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x10, + 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x10, 0x04, + 0x12, 0x0c, 0x0a, 0x08, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x10, 0x05, 0x12, 0x0e, + 0x0a, 0x0a, 0x44, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x10, 0x06, 0x12, 0x0e, + 0x0a, 0x0a, 0x4b, 0x69, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x07, 0x12, 0x10, + 0x0a, 0x0c, 0x44, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x08, + 0x12, 0x07, 0x0a, 0x03, 0x57, 0x69, 0x6e, 0x10, 0x09, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x6f, 0x73, + 0x74, 0x10, 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x46, 0x69, 0x72, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x6f, + 0x64, 0x10, 0x0b, 0x12, 0x10, 0x0a, 0x0c, 0x44, 0x65, 0x46, 0x69, 0x72, 0x73, 0x74, 0x42, 0x6c, + 0x6f, 0x6f, 0x64, 0x10, 0x0c, 0x32, 0xaf, 0x06, 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, 0x36, 0x0a, 0x0f, 0x67, 0x65, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x49, 0x64, 0x42, 0x79, 0x50, 0x55, 0x69, 0x64, 0x12, 0x13, 0x2e, 0x70, 0x62, 0x2e, + 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, + 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x3f, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, + 0x6c, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x6e, 0x74, + 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x36, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x67, + 0x72, 0x61, 0x6c, 0x12, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x52, + 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, + 0x67, 0x72, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x12, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x39, 0x0a, 0x0c, 0x75, + 0x73, 0x65, 0x72, 0x53, 0x65, 0x6e, 0x64, 0x47, 0x69, 0x66, 0x74, 0x12, 0x13, 0x2e, 0x70, 0x62, + 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x6e, 0x64, 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, 0x71, + 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x6e, 0x64, 0x47, 0x69, + 0x66, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x42, 0x75, + 0x79, 0x4e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x42, 0x75, 0x79, 0x4e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x65, + 0x71, 0x1a, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x75, 0x79, 0x4e, 0x6f, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 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, 0x0a, 0x11, 0x73, 0x74, 0x61, 0x74, + 0x50, 0x76, 0x70, 0x46, 0x69, 0x72, 0x73, 0x74, 0x42, 0x6c, 0x6f, 0x6f, 0x64, 0x12, 0x18, 0x2e, + 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x46, 0x69, 0x72, 0x73, 0x74, 0x42, + 0x6c, 0x6f, 0x6f, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x3c, 0x0a, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x50, 0x76, 0x70, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x39, 0x0a, 0x0c, 0x64, 0x72, 0x61, 0x77, 0x47, 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, 0x6b, + 0x12, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x47, 0x69, 0x66, 0x74, 0x50, 0x61, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x47, + 0x69, 0x66, 0x74, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2a, 0x0a, 0x07, 0x72, + 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x6b, + 0x50, 0x76, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x6b, + 0x50, 0x76, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3c, 0x0a, 0x0d, 0x72, 0x61, 0x6e, 0x6b, 0x50, + 0x76, 0x70, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, + 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, + 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x30, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x52, 0x61, 0x6e, + 0x6b, 0x50, 0x76, 0x70, 0x12, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x61, + 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1819,72 +2655,95 @@ func file_user_center_proto_rawDescGZIP() []byte { return file_user_center_proto_rawDescData } -var file_user_center_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_user_center_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_user_center_proto_msgTypes = make([]protoimpl.MessageInfo, 34) 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 - (*UserIdReq)(nil), // 4: pb.UserIdReq - (*UserIdResp)(nil), // 5: pb.UserIdResp - (*ChangeIntegralReq)(nil), // 6: pb.ChangeIntegralReq - (*ChangeIntegralResp)(nil), // 7: pb.ChangeIntegralResp - (*UserIntegralResp)(nil), // 8: pb.UserIntegralResp - (*UserCheckInResp)(nil), // 9: pb.UserCheckInResp - (*UserSendGiftReq)(nil), // 10: pb.UserSendGiftReq - (*UserSendGiftResp)(nil), // 11: pb.UserSendGiftResp - (*UserBuyNobilityReq)(nil), // 12: pb.UserBuyNobilityReq - (*UserBuyNobilityResp)(nil), // 13: pb.UserBuyNobilityResp - (*StatPvPKillReq)(nil), // 14: pb.StatPvPKillReq - (*StatPvPFirstBloodReq)(nil), // 15: pb.StatPvPFirstBloodReq - (*StatPvPReportReq)(nil), // 16: pb.StatPvPReportReq - (*StatPvPReportResp)(nil), // 17: pb.StatPvPReportResp - (*RankPvpReq)(nil), // 18: pb.RankPvpReq - (*RankPvpResp)(nil), // 19: pb.RankPvpResp - (*StatPvPReportReq_Item)(nil), // 20: pb.StatPvPReportReq.Item - (*StatPvPReportReq_General)(nil), // 21: pb.StatPvPReportReq.General - (*StatPvPReportResp_Item)(nil), // 22: pb.StatPvPReportResp.Item - (*RankPvpResp_Item)(nil), // 23: pb.RankPvpResp.Item + (GiftType)(0), // 0: pb.GiftType + (RankType)(0), // 1: pb.RankType + (*User)(nil), // 2: pb.User + (*Empty)(nil), // 3: pb.Empty + (*PlatformUserReq)(nil), // 4: pb.PlatformUserReq + (*PlatformUserResp)(nil), // 5: pb.PlatformUserResp + (*UserIdReq)(nil), // 6: pb.UserIdReq + (*UserIdResp)(nil), // 7: pb.UserIdResp + (*ChangeIntegralReq)(nil), // 8: pb.ChangeIntegralReq + (*ChangeIntegralResp)(nil), // 9: pb.ChangeIntegralResp + (*UserIntegralResp)(nil), // 10: pb.UserIntegralResp + (*UserCheckInResp)(nil), // 11: pb.UserCheckInResp + (*UserSendGiftReq)(nil), // 12: pb.UserSendGiftReq + (*UserSendGiftResp)(nil), // 13: pb.UserSendGiftResp + (*UserBuyNobilityReq)(nil), // 14: pb.UserBuyNobilityReq + (*UserBuyNobilityResp)(nil), // 15: pb.UserBuyNobilityResp + (*StatPvPKillReq)(nil), // 16: pb.StatPvPKillReq + (*StatPvPFirstBloodReq)(nil), // 17: pb.StatPvPFirstBloodReq + (*StatPvPReportReq)(nil), // 18: pb.StatPvPReportReq + (*StatPvPReportResp)(nil), // 19: pb.StatPvPReportResp + (*GiftPackItem)(nil), // 20: pb.GiftPackItem + (*DrawGiftPackReq)(nil), // 21: pb.DrawGiftPackReq + (*DrawGiftPackResp)(nil), // 22: pb.DrawGiftPackResp + (*RankPvpReq)(nil), // 23: pb.RankPvpReq + (*RankPvpResp)(nil), // 24: pb.RankPvpResp + (*RankPvpSubmitReq)(nil), // 25: pb.RankPvpSubmitReq + (*RankPvpSubmitResp)(nil), // 26: pb.RankPvpSubmitResp + (*UserRankReq)(nil), // 27: pb.UserRankReq + (*UserRankResp)(nil), // 28: pb.UserRankResp + (*StatPvPReportReq_Item)(nil), // 29: pb.StatPvPReportReq.Item + (*StatPvPReportReq_General)(nil), // 30: pb.StatPvPReportReq.General + (*StatPvPReportResp_Item)(nil), // 31: pb.StatPvPReportResp.Item + (*RankPvpResp_Item)(nil), // 32: pb.RankPvpResp.Item + (*RankPvpSubmitResp_Result)(nil), // 33: pb.RankPvpSubmitResp.Result + (*RankPvpSubmitResp_Item)(nil), // 34: pb.RankPvpSubmitResp.Item + (*UserRankResp_Item)(nil), // 35: pb.UserRankResp.Item } var file_user_center_proto_depIdxs = []int32{ - 0, // 0: pb.PlatformUserResp.user:type_name -> pb.User - 7, // 1: pb.UserSendGiftResp.integral:type_name -> pb.ChangeIntegralResp - 0, // 2: pb.UserBuyNobilityResp.user:type_name -> pb.User - 7, // 3: pb.UserBuyNobilityResp.integral:type_name -> pb.ChangeIntegralResp - 21, // 4: pb.StatPvPReportReq.general:type_name -> pb.StatPvPReportReq.General - 20, // 5: pb.StatPvPReportReq.winItems:type_name -> pb.StatPvPReportReq.Item - 20, // 6: pb.StatPvPReportReq.lostItems:type_name -> pb.StatPvPReportReq.Item - 22, // 7: pb.StatPvPReportResp.general:type_name -> pb.StatPvPReportResp.Item - 22, // 8: pb.StatPvPReportResp.winItems:type_name -> pb.StatPvPReportResp.Item - 22, // 9: pb.StatPvPReportResp.lostItems:type_name -> pb.StatPvPReportResp.Item - 23, // 10: pb.RankPvpResp.items:type_name -> pb.RankPvpResp.Item - 2, // 11: pb.userCenter.retrievePlatformUser:input_type -> pb.PlatformUserReq - 2, // 12: pb.userCenter.getUserIdByPUid:input_type -> pb.PlatformUserReq - 6, // 13: pb.userCenter.ChangeIntegral:input_type -> pb.ChangeIntegralReq - 4, // 14: pb.userCenter.GetUserIntegral:input_type -> pb.UserIdReq - 4, // 15: pb.userCenter.UserCheckIn:input_type -> pb.UserIdReq - 10, // 16: pb.userCenter.userSendGift:input_type -> pb.UserSendGiftReq - 12, // 17: pb.userCenter.userBuyNobility:input_type -> pb.UserBuyNobilityReq - 14, // 18: pb.userCenter.statPvpKill:input_type -> pb.StatPvPKillReq - 15, // 19: pb.userCenter.statPvpFirstBlood:input_type -> pb.StatPvPFirstBloodReq - 16, // 20: pb.userCenter.statPvpReport:input_type -> pb.StatPvPReportReq - 18, // 21: pb.userCenter.rankPvp:input_type -> pb.RankPvpReq - 3, // 22: pb.userCenter.retrievePlatformUser:output_type -> pb.PlatformUserResp - 5, // 23: pb.userCenter.getUserIdByPUid:output_type -> pb.UserIdResp - 7, // 24: pb.userCenter.ChangeIntegral:output_type -> pb.ChangeIntegralResp - 8, // 25: pb.userCenter.GetUserIntegral:output_type -> pb.UserIntegralResp - 9, // 26: pb.userCenter.UserCheckIn:output_type -> pb.UserCheckInResp - 11, // 27: pb.userCenter.userSendGift:output_type -> pb.UserSendGiftResp - 13, // 28: pb.userCenter.userBuyNobility:output_type -> pb.UserBuyNobilityResp - 1, // 29: pb.userCenter.statPvpKill:output_type -> pb.Empty - 1, // 30: pb.userCenter.statPvpFirstBlood:output_type -> pb.Empty - 17, // 31: pb.userCenter.statPvpReport:output_type -> pb.StatPvPReportResp - 19, // 32: pb.userCenter.rankPvp:output_type -> pb.RankPvpResp - 22, // [22:33] is the sub-list for method output_type - 11, // [11:22] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 2, // 0: pb.PlatformUserResp.user:type_name -> pb.User + 9, // 1: pb.UserSendGiftResp.integral:type_name -> pb.ChangeIntegralResp + 2, // 2: pb.UserBuyNobilityResp.user:type_name -> pb.User + 9, // 3: pb.UserBuyNobilityResp.integral:type_name -> pb.ChangeIntegralResp + 30, // 4: pb.StatPvPReportReq.general:type_name -> pb.StatPvPReportReq.General + 29, // 5: pb.StatPvPReportReq.winItems:type_name -> pb.StatPvPReportReq.Item + 29, // 6: pb.StatPvPReportReq.lostItems:type_name -> pb.StatPvPReportReq.Item + 31, // 7: pb.StatPvPReportResp.general:type_name -> pb.StatPvPReportResp.Item + 31, // 8: pb.StatPvPReportResp.winItems:type_name -> pb.StatPvPReportResp.Item + 31, // 9: pb.StatPvPReportResp.lostItems:type_name -> pb.StatPvPReportResp.Item + 20, // 10: pb.DrawGiftPackResp.item:type_name -> pb.GiftPackItem + 32, // 11: pb.RankPvpResp.items:type_name -> pb.RankPvpResp.Item + 34, // 12: pb.RankPvpSubmitResp.items:type_name -> pb.RankPvpSubmitResp.Item + 35, // 13: pb.UserRankResp.items:type_name -> pb.UserRankResp.Item + 33, // 14: pb.RankPvpSubmitResp.Item.results:type_name -> pb.RankPvpSubmitResp.Result + 4, // 15: pb.userCenter.retrievePlatformUser:input_type -> pb.PlatformUserReq + 4, // 16: pb.userCenter.getUserIdByPUid:input_type -> pb.PlatformUserReq + 8, // 17: pb.userCenter.ChangeIntegral:input_type -> pb.ChangeIntegralReq + 6, // 18: pb.userCenter.GetUserIntegral:input_type -> pb.UserIdReq + 6, // 19: pb.userCenter.UserCheckIn:input_type -> pb.UserIdReq + 12, // 20: pb.userCenter.userSendGift:input_type -> pb.UserSendGiftReq + 14, // 21: pb.userCenter.userBuyNobility:input_type -> pb.UserBuyNobilityReq + 16, // 22: pb.userCenter.statPvpKill:input_type -> pb.StatPvPKillReq + 17, // 23: pb.userCenter.statPvpFirstBlood:input_type -> pb.StatPvPFirstBloodReq + 18, // 24: pb.userCenter.statPvpReport:input_type -> pb.StatPvPReportReq + 21, // 25: pb.userCenter.drawGiftPack:input_type -> pb.DrawGiftPackReq + 23, // 26: pb.userCenter.rankPvp:input_type -> pb.RankPvpReq + 25, // 27: pb.userCenter.rankPvpSubmit:input_type -> pb.RankPvpSubmitReq + 27, // 28: pb.userCenter.userRankPvp:input_type -> pb.UserRankReq + 5, // 29: pb.userCenter.retrievePlatformUser:output_type -> pb.PlatformUserResp + 7, // 30: pb.userCenter.getUserIdByPUid:output_type -> pb.UserIdResp + 9, // 31: pb.userCenter.ChangeIntegral:output_type -> pb.ChangeIntegralResp + 10, // 32: pb.userCenter.GetUserIntegral:output_type -> pb.UserIntegralResp + 11, // 33: pb.userCenter.UserCheckIn:output_type -> pb.UserCheckInResp + 13, // 34: pb.userCenter.userSendGift:output_type -> pb.UserSendGiftResp + 15, // 35: pb.userCenter.userBuyNobility:output_type -> pb.UserBuyNobilityResp + 3, // 36: pb.userCenter.statPvpKill:output_type -> pb.Empty + 3, // 37: pb.userCenter.statPvpFirstBlood:output_type -> pb.Empty + 19, // 38: pb.userCenter.statPvpReport:output_type -> pb.StatPvPReportResp + 22, // 39: pb.userCenter.drawGiftPack:output_type -> pb.DrawGiftPackResp + 24, // 40: pb.userCenter.rankPvp:output_type -> pb.RankPvpResp + 26, // 41: pb.userCenter.rankPvpSubmit:output_type -> pb.RankPvpSubmitResp + 28, // 42: pb.userCenter.userRankPvp:output_type -> pb.UserRankResp + 29, // [29:43] is the sub-list for method output_type + 15, // [15:29] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_user_center_proto_init() } @@ -2110,7 +2969,7 @@ func file_user_center_proto_init() { } } file_user_center_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RankPvpReq); i { + switch v := v.(*GiftPackItem); i { case 0: return &v.state case 1: @@ -2122,7 +2981,7 @@ func file_user_center_proto_init() { } } file_user_center_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RankPvpResp); i { + switch v := v.(*DrawGiftPackReq); i { case 0: return &v.state case 1: @@ -2134,7 +2993,7 @@ func file_user_center_proto_init() { } } file_user_center_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatPvPReportReq_Item); i { + switch v := v.(*DrawGiftPackResp); i { case 0: return &v.state case 1: @@ -2146,7 +3005,7 @@ func file_user_center_proto_init() { } } file_user_center_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatPvPReportReq_General); i { + switch v := v.(*RankPvpReq); i { case 0: return &v.state case 1: @@ -2158,7 +3017,7 @@ func file_user_center_proto_init() { } } file_user_center_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatPvPReportResp_Item); i { + switch v := v.(*RankPvpResp); i { case 0: return &v.state case 1: @@ -2170,6 +3029,90 @@ func file_user_center_proto_init() { } } file_user_center_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RankPvpSubmitReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_center_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RankPvpSubmitResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_center_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserRankReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_center_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserRankResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_center_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatPvPReportReq_Item); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_center_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatPvPReportReq_General); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_center_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatPvPReportResp_Item); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_center_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RankPvpResp_Item); i { case 0: return &v.state @@ -2181,19 +3124,56 @@ func file_user_center_proto_init() { return nil } } + file_user_center_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RankPvpSubmitResp_Result); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_center_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RankPvpSubmitResp_Item); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_center_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserRankResp_Item); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_user_center_proto_rawDesc, - NumEnums: 0, - NumMessages: 24, + NumEnums: 2, + NumMessages: 34, NumExtensions: 0, NumServices: 1, }, GoTypes: file_user_center_proto_goTypes, DependencyIndexes: file_user_center_proto_depIdxs, + EnumInfos: file_user_center_proto_enumTypes, MessageInfos: file_user_center_proto_msgTypes, }.Build() File_user_center_proto = out.File diff --git a/app/user_center/rpc/pb/user_center.proto b/app/user_center/rpc/pb/user_center.proto index 0d4b78f..369fb17 100644 --- a/app/user_center/rpc/pb/user_center.proto +++ b/app/user_center/rpc/pb/user_center.proto @@ -150,7 +150,50 @@ message StatPvPReportResp { repeated Item lostItems = 11; // 战败方数据 } -// rank +//////////////////// 礼包 + +enum GiftType { + starter = 0; // 新手礼包 + subsistence = 1; // 低保 +} + +message GiftPackItem { + string giftType = 1; // 礼包类型 starter:新手礼包 + int64 integral = 2; // 获取的积分 + repeated string title = 3; // 获取的称号 +} + +message DrawGiftPackReq { + int64 uid = 1; + string uname = 2; + string giftType = 3; +} + +message DrawGiftPackResp { + int64 uid = 1; + string uname = 2; + int32 code = 3; // 领取结果 200:成功 201100:已经领取过 201101:已领取完 + string msg = 4; // 消息 [领取成功|已经领取过|该用户已领取(当日|每周|每月)完所有礼包] + GiftPackItem item = 10; +} + +////////////////////// rank +enum RankType { + Unknown = 0; + Damage = 1; // 伤害榜 + DeDamage = 2; // 受伤榜 + General = 3; // 名将榜 + DeGeneral = 4; // 落马榜 + KillUnit = 5; // 小兵击杀 + DeKillUnit = 6; // 小兵被杀 + KillPlayer = 7; // 击杀玩家 + DeKillPlayer = 8; // 被杀榜 + Win = 9; // 获胜榜 + Lost = 10; // 战败榜 + FirstBlood = 11; // 一血榜 + DeFirstBlood = 12; // 被拿一血榜 +} + message RankPvpReq { int32 type = 1; // rank类型 int32 topN = 2; // TopN @@ -167,6 +210,45 @@ message RankPvpResp { repeated Item items = 2; // rank数据 } +// RankPvpSubmitReq 手动排行榜结算 +message RankPvpSubmitReq { + int32 rankType = 1; // 待结算的排行榜类型 + bool allRankType = 2; // 是否直接结算所有排行类型 +} + +message RankPvpSubmitResp { + message Result { + int64 userId = 1; + string username = 2; + string avatar = 3; + int64 integral = 4; // 获取到的积分数 + string title = 5; // 获取到的称号 + int64 titleDuration = 6; // 称号持续时间(单位: 秒,负数为无限长) + } + message Item { + int32 rankType = 1; // 排行榜类型 + repeated Result results = 2; // 上榜玩家? + } + + repeated Item items = 1; +} + +// UserRankReq 查询用户自己的排行 +message UserRankReq { + int64 userId = 1; // 系统用户ID + string username = 2; // 用户名 + int32 rankType = 3; // 排行榜类型 + bool allRankType = 4; // 直接查询所有排行类型 +} + +message UserRankResp { + message Item { + int32 rankType = 1; // 排行类型 + int32 pos = 2; // 名次 + } + repeated Item items = 1; +} + service userCenter { /// @ZeroGroup: platform_user @@ -196,8 +278,14 @@ service userCenter { rpc statPvpFirstBlood(StatPvPFirstBloodReq) returns (Empty); rpc statPvpReport(StatPvPReportReq) returns (StatPvPReportResp); + /// @ZeroGroup: giftPack + + rpc drawGiftPack(DrawGiftPackReq) returns(DrawGiftPackResp); + /// @ZeroGroup: rank // rankPvp pvp排行 rpc rankPvp(RankPvpReq) returns(RankPvpResp); + rpc rankPvpSubmit(RankPvpSubmitReq) returns(RankPvpSubmitResp); + rpc userRankPvp(UserRankReq) returns (UserRankResp); } \ No newline at end of file diff --git a/app/user_center/rpc/pb/user_center_grpc.pb.go b/app/user_center/rpc/pb/user_center_grpc.pb.go index e95fea4..8825a98 100644 --- a/app/user_center/rpc/pb/user_center_grpc.pb.go +++ b/app/user_center/rpc/pb/user_center_grpc.pb.go @@ -38,8 +38,11 @@ type UserCenterClient interface { 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) (*StatPvPReportResp, error) + DrawGiftPack(ctx context.Context, in *DrawGiftPackReq, opts ...grpc.CallOption) (*DrawGiftPackResp, error) // rankPvp pvp排行 RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error) + RankPvpSubmit(ctx context.Context, in *RankPvpSubmitReq, opts ...grpc.CallOption) (*RankPvpSubmitResp, error) + UserRankPvp(ctx context.Context, in *UserRankReq, opts ...grpc.CallOption) (*UserRankResp, error) } type userCenterClient struct { @@ -140,6 +143,15 @@ func (c *userCenterClient) StatPvpReport(ctx context.Context, in *StatPvPReportR return out, nil } +func (c *userCenterClient) DrawGiftPack(ctx context.Context, in *DrawGiftPackReq, opts ...grpc.CallOption) (*DrawGiftPackResp, error) { + out := new(DrawGiftPackResp) + err := c.cc.Invoke(ctx, "/pb.userCenter/drawGiftPack", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *userCenterClient) RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error) { out := new(RankPvpResp) err := c.cc.Invoke(ctx, "/pb.userCenter/rankPvp", in, out, opts...) @@ -149,6 +161,24 @@ func (c *userCenterClient) RankPvp(ctx context.Context, in *RankPvpReq, opts ... return out, nil } +func (c *userCenterClient) RankPvpSubmit(ctx context.Context, in *RankPvpSubmitReq, opts ...grpc.CallOption) (*RankPvpSubmitResp, error) { + out := new(RankPvpSubmitResp) + err := c.cc.Invoke(ctx, "/pb.userCenter/rankPvpSubmit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userCenterClient) UserRankPvp(ctx context.Context, in *UserRankReq, opts ...grpc.CallOption) (*UserRankResp, error) { + out := new(UserRankResp) + err := c.cc.Invoke(ctx, "/pb.userCenter/userRankPvp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // UserCenterServer is the server API for UserCenter service. // All implementations must embed UnimplementedUserCenterServer // for forward compatibility @@ -169,8 +199,11 @@ type UserCenterServer interface { StatPvpKill(context.Context, *StatPvPKillReq) (*Empty, error) StatPvpFirstBlood(context.Context, *StatPvPFirstBloodReq) (*Empty, error) StatPvpReport(context.Context, *StatPvPReportReq) (*StatPvPReportResp, error) + DrawGiftPack(context.Context, *DrawGiftPackReq) (*DrawGiftPackResp, error) // rankPvp pvp排行 RankPvp(context.Context, *RankPvpReq) (*RankPvpResp, error) + RankPvpSubmit(context.Context, *RankPvpSubmitReq) (*RankPvpSubmitResp, error) + UserRankPvp(context.Context, *UserRankReq) (*UserRankResp, error) mustEmbedUnimplementedUserCenterServer() } @@ -208,9 +241,18 @@ func (UnimplementedUserCenterServer) StatPvpFirstBlood(context.Context, *StatPvP func (UnimplementedUserCenterServer) StatPvpReport(context.Context, *StatPvPReportReq) (*StatPvPReportResp, error) { return nil, status.Errorf(codes.Unimplemented, "method StatPvpReport not implemented") } +func (UnimplementedUserCenterServer) DrawGiftPack(context.Context, *DrawGiftPackReq) (*DrawGiftPackResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method DrawGiftPack not implemented") +} func (UnimplementedUserCenterServer) RankPvp(context.Context, *RankPvpReq) (*RankPvpResp, error) { return nil, status.Errorf(codes.Unimplemented, "method RankPvp not implemented") } +func (UnimplementedUserCenterServer) RankPvpSubmit(context.Context, *RankPvpSubmitReq) (*RankPvpSubmitResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method RankPvpSubmit not implemented") +} +func (UnimplementedUserCenterServer) UserRankPvp(context.Context, *UserRankReq) (*UserRankResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserRankPvp not implemented") +} func (UnimplementedUserCenterServer) mustEmbedUnimplementedUserCenterServer() {} // UnsafeUserCenterServer may be embedded to opt out of forward compatibility for this service. @@ -404,6 +446,24 @@ func _UserCenter_StatPvpReport_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _UserCenter_DrawGiftPack_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DrawGiftPackReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserCenterServer).DrawGiftPack(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.userCenter/drawGiftPack", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserCenterServer).DrawGiftPack(ctx, req.(*DrawGiftPackReq)) + } + return interceptor(ctx, in, info, handler) +} + func _UserCenter_RankPvp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RankPvpReq) if err := dec(in); err != nil { @@ -422,6 +482,42 @@ func _UserCenter_RankPvp_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _UserCenter_RankPvpSubmit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RankPvpSubmitReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserCenterServer).RankPvpSubmit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.userCenter/rankPvpSubmit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserCenterServer).RankPvpSubmit(ctx, req.(*RankPvpSubmitReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserCenter_UserRankPvp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserRankReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserCenterServer).UserRankPvp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.userCenter/userRankPvp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserCenterServer).UserRankPvp(ctx, req.(*UserRankReq)) + } + return interceptor(ctx, in, info, handler) +} + // UserCenter_ServiceDesc is the grpc.ServiceDesc for UserCenter service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -469,10 +565,22 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{ MethodName: "statPvpReport", Handler: _UserCenter_StatPvpReport_Handler, }, + { + MethodName: "drawGiftPack", + Handler: _UserCenter_DrawGiftPack_Handler, + }, { MethodName: "rankPvp", Handler: _UserCenter_RankPvp_Handler, }, + { + MethodName: "rankPvpSubmit", + Handler: _UserCenter_RankPvpSubmit_Handler, + }, + { + MethodName: "userRankPvp", + Handler: _UserCenter_UserRankPvp_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "user_center.proto", diff --git a/app/user_center/rpc/usercenter/user_center.go b/app/user_center/rpc/usercenter/user_center.go index 31745fa..521d444 100644 --- a/app/user_center/rpc/usercenter/user_center.go +++ b/app/user_center/rpc/usercenter/user_center.go @@ -15,12 +15,19 @@ import ( type ( ChangeIntegralReq = pb.ChangeIntegralReq ChangeIntegralResp = pb.ChangeIntegralResp + DrawGiftPackReq = pb.DrawGiftPackReq + DrawGiftPackResp = pb.DrawGiftPackResp Empty = pb.Empty + GiftPackItem = pb.GiftPackItem PlatformUserReq = pb.PlatformUserReq PlatformUserResp = pb.PlatformUserResp RankPvpReq = pb.RankPvpReq RankPvpResp = pb.RankPvpResp RankPvpResp_Item = pb.RankPvpResp_Item + RankPvpSubmitReq = pb.RankPvpSubmitReq + RankPvpSubmitResp = pb.RankPvpSubmitResp + RankPvpSubmitResp_Item = pb.RankPvpSubmitResp_Item + RankPvpSubmitResp_Result = pb.RankPvpSubmitResp_Result StatPvPFirstBloodReq = pb.StatPvPFirstBloodReq StatPvPKillReq = pb.StatPvPKillReq StatPvPReportReq = pb.StatPvPReportReq @@ -35,6 +42,9 @@ type ( UserIdReq = pb.UserIdReq UserIdResp = pb.UserIdResp UserIntegralResp = pb.UserIntegralResp + UserRankReq = pb.UserRankReq + UserRankResp = pb.UserRankResp + UserRankResp_Item = pb.UserRankResp_Item UserSendGiftReq = pb.UserSendGiftReq UserSendGiftResp = pb.UserSendGiftResp @@ -55,8 +65,11 @@ type ( 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) (*StatPvPReportResp, error) + DrawGiftPack(ctx context.Context, in *DrawGiftPackReq, opts ...grpc.CallOption) (*DrawGiftPackResp, error) // rankPvp pvp排行 RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error) + RankPvpSubmit(ctx context.Context, in *RankPvpSubmitReq, opts ...grpc.CallOption) (*RankPvpSubmitResp, error) + UserRankPvp(ctx context.Context, in *UserRankReq, opts ...grpc.CallOption) (*UserRankResp, error) } defaultUserCenter struct { @@ -126,8 +139,23 @@ func (m *defaultUserCenter) StatPvpReport(ctx context.Context, in *StatPvPReport return client.StatPvpReport(ctx, in, opts...) } +func (m *defaultUserCenter) DrawGiftPack(ctx context.Context, in *DrawGiftPackReq, opts ...grpc.CallOption) (*DrawGiftPackResp, error) { + client := pb.NewUserCenterClient(m.cli.Conn()) + return client.DrawGiftPack(ctx, in, opts...) +} + // rankPvp pvp排行 func (m *defaultUserCenter) RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error) { client := pb.NewUserCenterClient(m.cli.Conn()) return client.RankPvp(ctx, in, opts...) } + +func (m *defaultUserCenter) RankPvpSubmit(ctx context.Context, in *RankPvpSubmitReq, opts ...grpc.CallOption) (*RankPvpSubmitResp, error) { + client := pb.NewUserCenterClient(m.cli.Conn()) + return client.RankPvpSubmit(ctx, in, opts...) +} + +func (m *defaultUserCenter) UserRankPvp(ctx context.Context, in *UserRankReq, opts ...grpc.CallOption) (*UserRankResp, error) { + client := pb.NewUserCenterClient(m.cli.Conn()) + return client.UserRankPvp(ctx, in, opts...) +} diff --git a/common/nerr/err_code.go b/common/nerr/err_code.go index 282b2e2..e6d13a9 100644 --- a/common/nerr/err_code.go +++ b/common/nerr/err_code.go @@ -22,3 +22,10 @@ const ( const ( UserIntegralNotEnoughError uint32 = 200100 // 用户积分不足 ) + +// 礼包相关 GiftPack + +const ( + GiftPackHasDrawError = 201100 // 该礼包已经领取过 + GiftPackDrawCountLimitedError = 201101 // 该礼包已领取完 +) diff --git a/doc/template/1.3.4/rpc/main.tpl b/doc/template/1.3.4/rpc/main.tpl index 4e13a7c..2e2f047 100644 --- a/doc/template/1.3.4/rpc/main.tpl +++ b/doc/template/1.3.4/rpc/main.tpl @@ -5,6 +5,7 @@ import ( "fmt" {{.imports}} + "live-service/common/interceptor/rpcserver" "github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/service" @@ -30,6 +31,7 @@ func main() { reflection.Register(grpcServer) } }) + s.AddUnaryInterceptors(rpcserver.LoggerInterceptor) defer s.Stop() fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) diff --git a/doc/template/1.3.5/api/config.tpl b/doc/template/1.3.5/api/config.tpl new file mode 100644 index 0000000..55127ef --- /dev/null +++ b/doc/template/1.3.5/api/config.tpl @@ -0,0 +1,9 @@ +package config + +import {{.authImport}} + +type Config struct { + rest.RestConf + {{.auth}} + {{.jwtTrans}} +} diff --git a/doc/template/1.3.5/api/context.tpl b/doc/template/1.3.5/api/context.tpl new file mode 100644 index 0000000..c15c1e4 --- /dev/null +++ b/doc/template/1.3.5/api/context.tpl @@ -0,0 +1,17 @@ +package svc + +import ( + {{.configImport}} +) + +type ServiceContext struct { + Config {{.config}} + {{.middleware}} +} + +func NewServiceContext(c {{.config}}) *ServiceContext { + return &ServiceContext{ + Config: c, + {{.middlewareAssignment}} + } +} diff --git a/doc/template/1.3.5/api/etc.tpl b/doc/template/1.3.5/api/etc.tpl new file mode 100644 index 0000000..ed55cf1 --- /dev/null +++ b/doc/template/1.3.5/api/etc.tpl @@ -0,0 +1,3 @@ +Name: {{.serviceName}} +Host: {{.host}} +Port: {{.port}} diff --git a/doc/template/1.3.5/api/handler.tpl b/doc/template/1.3.5/api/handler.tpl new file mode 100644 index 0000000..033dc22 --- /dev/null +++ b/doc/template/1.3.5/api/handler.tpl @@ -0,0 +1,26 @@ +package {{.PkgName}} + +import ( + "net/http" + + "github.com/zeromicro/go-zero/rest/httpx" + {{.ImportPackages}} +) + +func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + {{if .HasRequest}}var req types.{{.RequestType}} + if err := httpx.Parse(r, &req); err != nil { + httpx.Error(w, err) + return + } + + {{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx) + {{if .HasResp}}resp, {{end}}err := l.{{.Call}}({{if .HasRequest}}&req{{end}}) + if err != nil { + httpx.Error(w, err) + } else { + {{if .HasResp}}httpx.OkJson(w, resp){{else}}httpx.Ok(w){{end}} + } + } +} diff --git a/doc/template/1.3.5/api/logic.tpl b/doc/template/1.3.5/api/logic.tpl new file mode 100644 index 0000000..7c04323 --- /dev/null +++ b/doc/template/1.3.5/api/logic.tpl @@ -0,0 +1,25 @@ +package {{.pkgName}} + +import ( + {{.imports}} +) + +type {{.logic}} struct { + logx.Logger + ctx context.Context + svcCtx *svc.ServiceContext +} + +func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) *{{.logic}} { + return &{{.logic}}{ + Logger: logx.WithContext(ctx), + ctx: ctx, + svcCtx: svcCtx, + } +} + +func (l *{{.logic}}) {{.function}}({{.request}}) {{.responseType}} { + // todo: add your logic here and delete this line + + {{.returnString}} +} diff --git a/doc/template/1.3.5/api/main.tpl b/doc/template/1.3.5/api/main.tpl new file mode 100644 index 0000000..a4ab692 --- /dev/null +++ b/doc/template/1.3.5/api/main.tpl @@ -0,0 +1,26 @@ +package main + +import ( + "flag" + "fmt" + + {{.importPackages}} +) + +var configFile = flag.String("f", "etc/{{.serviceName}}.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + + ctx := svc.NewServiceContext(c) + server := rest.MustNewServer(c.RestConf) + defer server.Stop() + + handler.RegisterHandlers(server, ctx) + + fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port) + server.Start() +} diff --git a/doc/template/1.3.5/api/middleware.tpl b/doc/template/1.3.5/api/middleware.tpl new file mode 100644 index 0000000..3a9f8e9 --- /dev/null +++ b/doc/template/1.3.5/api/middleware.tpl @@ -0,0 +1,19 @@ +package middleware + +import "net/http" + +type {{.name}} struct { +} + +func New{{.name}}() *{{.name}} { + return &{{.name}}{} +} + +func (m *{{.name}})Handle(next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + // TODO generate middleware implement function, delete after code implementation + + // Passthrough to next handler if need + next(w, r) + } +} diff --git a/doc/template/1.3.5/api/route-addition.tpl b/doc/template/1.3.5/api/route-addition.tpl new file mode 100644 index 0000000..ec9edf0 --- /dev/null +++ b/doc/template/1.3.5/api/route-addition.tpl @@ -0,0 +1,4 @@ + + server.AddRoutes( + {{.routes}} {{.jwt}}{{.signature}} {{.prefix}} {{.timeout}} + ) diff --git a/doc/template/1.3.5/api/routes.tpl b/doc/template/1.3.5/api/routes.tpl new file mode 100644 index 0000000..f13fb11 --- /dev/null +++ b/doc/template/1.3.5/api/routes.tpl @@ -0,0 +1,13 @@ +// Code generated by goctl. DO NOT EDIT. +package handler + +import ( + "net/http"{{if .hasTimeout}} + "time"{{end}} + + {{.importPackages}} +) + +func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { + {{.routesAdditions}} +} diff --git a/doc/template/1.3.5/api/template.tpl b/doc/template/1.3.5/api/template.tpl new file mode 100644 index 0000000..2176441 --- /dev/null +++ b/doc/template/1.3.5/api/template.tpl @@ -0,0 +1,24 @@ +syntax = "v1" + +info ( + title: // TODO: add title + desc: // TODO: add description + author: "{{.gitUser}}" + email: "{{.gitEmail}}" +) + +type request { + // TODO: add members here and delete this comment +} + +type response { + // TODO: add members here and delete this comment +} + +service {{.serviceName}} { + @handler GetUser // TODO: set handler name and delete this comment + get /users/id/:userId(request) returns(response) + + @handler CreateUser // TODO: set handler name and delete this comment + post /users/create(request) +} diff --git a/doc/template/1.3.5/api/types.tpl b/doc/template/1.3.5/api/types.tpl new file mode 100644 index 0000000..735ec2d --- /dev/null +++ b/doc/template/1.3.5/api/types.tpl @@ -0,0 +1,6 @@ +// Code generated by goctl. DO NOT EDIT. +package types{{if .containsTime}} +import ( + "time" +){{end}} +{{.types}} diff --git a/doc/template/1.3.5/docker/docker.tpl b/doc/template/1.3.5/docker/docker.tpl new file mode 100644 index 0000000..40ef371 --- /dev/null +++ b/doc/template/1.3.5/docker/docker.tpl @@ -0,0 +1,32 @@ +FROM golang:{{.Version}}alpine AS builder + +LABEL stage=gobuilder + +ENV CGO_ENABLED 0 +{{if .Chinese}}ENV GOPROXY https://goproxy.cn,direct +{{end}}{{if .HasTimezone}} +RUN apk update --no-cache && apk add --no-cache tzdata +{{end}} +WORKDIR /build + +ADD go.mod . +ADD go.sum . +RUN go mod download +COPY . . +{{if .Argument}}COPY {{.GoRelPath}}/etc /app/etc +{{end}}RUN go build -ldflags="-s -w" -o /app/{{.ExeFile}} {{.GoRelPath}}/{{.GoFile}} + + +FROM {{.BaseImage}} + +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +{{if .HasTimezone}}COPY --from=builder /usr/share/zoneinfo/{{.Timezone}} /usr/share/zoneinfo/{{.Timezone}} +ENV TZ {{.Timezone}} +{{end}} +WORKDIR /app +COPY --from=builder /app/{{.ExeFile}} /app/{{.ExeFile}}{{if .Argument}} +COPY --from=builder /app/etc /app/etc{{end}} +{{if .HasPort}} +EXPOSE {{.Port}} +{{end}} +CMD ["./{{.ExeFile}}"{{.Argument}}] diff --git a/doc/template/1.3.5/kube/deployment.tpl b/doc/template/1.3.5/kube/deployment.tpl new file mode 100644 index 0000000..7b81d60 --- /dev/null +++ b/doc/template/1.3.5/kube/deployment.tpl @@ -0,0 +1,115 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{.Name}} + namespace: {{.Namespace}} + labels: + app: {{.Name}} +spec: + replicas: {{.Replicas}} + revisionHistoryLimit: {{.Revisions}} + selector: + matchLabels: + app: {{.Name}} + template: + metadata: + labels: + app: {{.Name}} + spec:{{if .ServiceAccount}} + serviceAccountName: {{.ServiceAccount}}{{end}} + containers: + - name: {{.Name}} + image: {{.Image}} + lifecycle: + preStop: + exec: + command: ["sh","-c","sleep 5"] + ports: + - containerPort: {{.Port}} + readinessProbe: + tcpSocket: + port: {{.Port}} + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + tcpSocket: + port: {{.Port}} + initialDelaySeconds: 15 + periodSeconds: 20 + resources: + requests: + cpu: {{.RequestCpu}}m + memory: {{.RequestMem}}Mi + limits: + cpu: {{.LimitCpu}}m + memory: {{.LimitMem}}Mi + volumeMounts: + - name: timezone + mountPath: /etc/localtime + {{if .Secret}}imagePullSecrets: + - name: {{.Secret}} + {{end}}volumes: + - name: timezone + hostPath: + path: /usr/share/zoneinfo/Asia/Shanghai + +--- + +apiVersion: v1 +kind: Service +metadata: + name: {{.Name}}-svc + namespace: {{.Namespace}} +spec: + ports: + {{if .UseNodePort}}- nodePort: {{.NodePort}} + port: {{.Port}} + protocol: TCP + targetPort: {{.Port}} + type: NodePort{{else}}- port: {{.Port}}{{end}} + selector: + app: {{.Name}} + +--- + +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{.Name}}-hpa-c + namespace: {{.Namespace}} + labels: + app: {{.Name}}-hpa-c +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{.Name}} + minReplicas: {{.MinReplicas}} + maxReplicas: {{.MaxReplicas}} + metrics: + - type: Resource + resource: + name: cpu + targetAverageUtilization: 80 + +--- + +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{.Name}}-hpa-m + namespace: {{.Namespace}} + labels: + app: {{.Name}}-hpa-m +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{.Name}} + minReplicas: {{.MinReplicas}} + maxReplicas: {{.MaxReplicas}} + metrics: + - type: Resource + resource: + name: memory + targetAverageUtilization: 80 diff --git a/doc/template/1.3.5/kube/job.tpl b/doc/template/1.3.5/kube/job.tpl new file mode 100644 index 0000000..0da72ed --- /dev/null +++ b/doc/template/1.3.5/kube/job.tpl @@ -0,0 +1,37 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{.Name}} + namespace: {{.Namespace}} +spec: + successfulJobsHistoryLimit: {{.SuccessfulJobsHistoryLimit}} + schedule: "{{.Schedule}}" + jobTemplate: + spec: + template: + spec:{{if .ServiceAccount}} + serviceAccountName: {{.ServiceAccount}}{{end}} + {{end}}containers: + - name: {{.Name}} + image: # todo image url + resources: + requests: + cpu: {{.RequestCpu}}m + memory: {{.RequestMem}}Mi + limits: + cpu: {{.LimitCpu}}m + memory: {{.LimitMem}}Mi + command: + - ./{{.ServiceName}} + - -f + - ./{{.Name}}.yaml + volumeMounts: + - name: timezone + mountPath: /etc/localtime + imagePullSecrets: + - name: # registry secret, if no, remove this + restartPolicy: OnFailure + volumes: + - name: timezone + hostPath: + path: /usr/share/zoneinfo/Asia/Shanghai diff --git a/doc/template/1.3.5/model/delete.tpl b/doc/template/1.3.5/model/delete.tpl index 17b33a2..1628d17 100644 --- a/doc/template/1.3.5/model/delete.tpl +++ b/doc/template/1.3.5/model/delete.tpl @@ -1,14 +1,14 @@ -func (m *default{{.upperStartCamelObject}}Model) Delete(ctx context.Context, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) error { +func (m *default{{.upperStartCamelObject}}Model) Delete(ctx context.Context, tx *gorm.DB, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) error { {{if .withCache}}{{if .containsIndexCache}}data, err:=m.FindOne(ctx, {{.lowerStartCamelPrimaryKey}}) - if err!=nil{ + if err != nil { return err } {{end}} {{.keys}} - err {{if .containsIndexCache}}={{else}}:={{end}} m.ExecCtx(ctx, func(conn *gorm.DB) *gorm.DB { - return conn.Delete(&{{.upperStartCamelObject}}{}, {{.lowerStartCamelPrimaryKey}}) - }, {{.keyValues}}){{else}} err:= m.conn.WithContext(ctx).Delete(&{{.upperStartCamelObject}}{}, {{.lowerStartCamelPrimaryKey}}).Error + err {{if .containsIndexCache}}={{else}}:={{end}} m.ExecCtx(ctx, func(conn *gorm.DB) error { + return gormx.WithTx(ctx, conn, tx).Delete(&{{.upperStartCamelObject}}{}, {{.lowerStartCamelPrimaryKey}}).Error + }, {{.keyValues}}){{else}} err:= gormx.WithTx(ctx, m.DB, tx).Delete(&{{.upperStartCamelObject}}{}, {{.lowerStartCamelPrimaryKey}}).Error {{end}} return err -} +} \ No newline at end of file diff --git a/doc/template/1.3.5/model/find-one-by-field.tpl b/doc/template/1.3.5/model/find-one-by-field.tpl index 40cdce8..e4486bd 100644 --- a/doc/template/1.3.5/model/find-one-by-field.tpl +++ b/doc/template/1.3.5/model/find-one-by-field.tpl @@ -1,9 +1,9 @@ -func (m *default{{.upperStartCamelObject}}Model) FindOneBy{{.upperField}}(ctx context.Context, {{.in}}) (*{{.upperStartCamelObject}}, error) { +func (m *default{{.upperStartCamelObject}}Model) FindOneBy{{.upperField}}(ctx context.Context, tx *gorm.DB, {{.in}}) (*{{.upperStartCamelObject}}, error) { {{if .withCache}}{{.cacheKey}} var resp {{.upperStartCamelObject}} err := m.QueryRowIndexCtx(ctx, &resp, {{.cacheKeyVariable}}, m.formatPrimary, func(conn *gorm.DB, v interface{}) (interface{}, error) { - if err := conn.Model(&{{.upperStartCamelObject}}{}).Where("{{.originalField}}", {{.lowerStartCamelField}}).Take(&resp).Error; err != nil { + if err := gormx.WithTx(ctx, conn, tx).Model(&{{.upperStartCamelObject}}{}).Where("{{.originalField}}", {{.lowerStartCamelField}}).Take(&resp).Error; err != nil { return nil, err } return resp.{{.upperStartCamelPrimaryKey}}, nil @@ -11,17 +11,17 @@ func (m *default{{.upperStartCamelObject}}Model) FindOneBy{{.upperField}}(ctx co switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err } }{{else}}var resp {{.upperStartCamelObject}} - err := m.conn.WithContext(ctx).Model(&{{.upperStartCamelObject}}{}).Where("{{.originalField}}", {{.lowerStartCamelField}}).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&{{.upperStartCamelObject}}{}).Where("{{.originalField}}", {{.lowerStartCamelField}}).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err diff --git a/doc/template/1.3.5/model/find-one.tpl b/doc/template/1.3.5/model/find-one.tpl index 8c41e8c..362c002 100644 --- a/doc/template/1.3.5/model/find-one.tpl +++ b/doc/template/1.3.5/model/find-one.tpl @@ -1,23 +1,23 @@ -func (m *default{{.upperStartCamelObject}}Model) FindOne(ctx context.Context, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error) { +func (m *default{{.upperStartCamelObject}}Model) FindOne(ctx context.Context, tx *gorm.DB, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error) { {{if .withCache}}{{.cacheKey}} var resp {{.upperStartCamelObject}} - err := m.QueryRowCtx(ctx, &resp, {{.cacheKeyVariable}}, func(conn *gorm.DB) *gorm.DB { - return conn.Where("id = ?", {{.lowerStartCamelPrimaryKey}}) + err := m.QueryCtx(ctx, &resp, {{.cacheKeyVariable}}, func(conn *gorm.DB, v interface{}) error { + return gormx.WithTx(ctx, conn, tx).Model(&{{.upperStartCamelObject}}{}).Where("{{.originalPrimaryKey}} = ?", {{.lowerStartCamelPrimaryKey}}).First(&resp).Error }) switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err }{{else}}var resp {{.upperStartCamelObject}} - err := m.conn.WithContext(ctx).Model(&{{.upperStartCamelObject}}{}).Where("{{.originalPrimaryKey}} = ?", {{.lowerStartCamelPrimaryKey}}).Take(&resp).Error + err := gormx.WithTx(ctx, m.DB, tx).Model(&{{.upperStartCamelObject}}{}).Where("{{.originalPrimaryKey}} = ?", {{.lowerStartCamelPrimaryKey}}).Take(&resp).Error switch err { case nil: return &resp, nil - case gormc.ErrNotFound: + case gormx.ErrNotFound: return nil, ErrNotFound default: return nil, err diff --git a/doc/template/1.3.5/model/import-no-cache.tpl b/doc/template/1.3.5/model/import-no-cache.tpl index 69bc8bf..6e1f644 100644 --- a/doc/template/1.3.5/model/import-no-cache.tpl +++ b/doc/template/1.3.5/model/import-no-cache.tpl @@ -1,9 +1,9 @@ import ( "context" - "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" "strings" {{if .time}}"time"{{end}} + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "github.com/zeromicro/go-zero/core/stores/builder" "github.com/zeromicro/go-zero/core/stringx" "gorm.io/gorm" diff --git a/doc/template/1.3.5/model/import.tpl b/doc/template/1.3.5/model/import.tpl index 1dcc40a..eb7d49a 100644 --- a/doc/template/1.3.5/model/import.tpl +++ b/doc/template/1.3.5/model/import.tpl @@ -5,6 +5,7 @@ import ( {{if .time}}"time"{{end}} "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormc" + "git.noahlan.cn/northlan/ntools-go/gorm-zero/gormx" "github.com/zeromicro/go-zero/core/stores/builder" "github.com/zeromicro/go-zero/core/stores/cache" "github.com/zeromicro/go-zero/core/stringx" diff --git a/doc/template/1.3.5/model/insert.tpl b/doc/template/1.3.5/model/insert.tpl index 74d0286..9035e4a 100644 --- a/doc/template/1.3.5/model/insert.tpl +++ b/doc/template/1.3.5/model/insert.tpl @@ -1,8 +1,8 @@ -func (m *default{{.upperStartCamelObject}}Model) Insert(ctx context.Context, data *{{.upperStartCamelObject}}) error { +func (m *default{{.upperStartCamelObject}}Model) Insert(ctx context.Context, tx *gorm.DB, data *{{.upperStartCamelObject}}) error { {{if .withCache}}{{.keys}} - err := m.ExecCtx(ctx, func(conn *gorm.DB) *gorm.DB { - return conn.Create(&data) - }, {{.keyValues}}){{else}}err:=m.conn.WithContext(ctx).Create(&data).Error{{end}} + err := m.ExecCtx(ctx, func(conn *gorm.DB) error { + return gormx.WithTx(ctx, conn, tx).Create(&data).Error + }, {{.keyValues}}){{else}}err:=gormx.WithTx(ctx, m.DB, tx).Create(&data).Error{{end}} return err } diff --git a/doc/template/1.3.5/model/interface-delete.tpl b/doc/template/1.3.5/model/interface-delete.tpl index d10978b..698ebf4 100644 --- a/doc/template/1.3.5/model/interface-delete.tpl +++ b/doc/template/1.3.5/model/interface-delete.tpl @@ -1 +1 @@ -Delete(ctx context.Context, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) error \ No newline at end of file +Delete(ctx context.Context, tx *gorm.DB, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) error \ No newline at end of file diff --git a/doc/template/1.3.5/model/interface-find-one-by-field.tpl b/doc/template/1.3.5/model/interface-find-one-by-field.tpl index 9615aa3..f9b670a 100644 --- a/doc/template/1.3.5/model/interface-find-one-by-field.tpl +++ b/doc/template/1.3.5/model/interface-find-one-by-field.tpl @@ -1 +1 @@ -FindOneBy{{.upperField}}(ctx context.Context, {{.in}}) (*{{.upperStartCamelObject}}, error) \ No newline at end of file +FindOneBy{{.upperField}}(ctx context.Context, tx *gorm.DB, {{.in}}) (*{{.upperStartCamelObject}}, error) \ No newline at end of file diff --git a/doc/template/1.3.5/model/interface-find-one.tpl b/doc/template/1.3.5/model/interface-find-one.tpl index a7a5440..d6ada86 100644 --- a/doc/template/1.3.5/model/interface-find-one.tpl +++ b/doc/template/1.3.5/model/interface-find-one.tpl @@ -1 +1 @@ -FindOne(ctx context.Context, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error) \ No newline at end of file +FindOne(ctx context.Context, tx *gorm.DB, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error) \ No newline at end of file diff --git a/doc/template/1.3.5/model/interface-insert.tpl b/doc/template/1.3.5/model/interface-insert.tpl index f1c4008..7bb0c54 100644 --- a/doc/template/1.3.5/model/interface-insert.tpl +++ b/doc/template/1.3.5/model/interface-insert.tpl @@ -1 +1 @@ -Insert(ctx context.Context, data *{{.upperStartCamelObject}}) error \ No newline at end of file +Insert(ctx context.Context, tx *gorm.DB, data *{{.upperStartCamelObject}}) error \ No newline at end of file diff --git a/doc/template/1.3.5/model/interface-update.tpl b/doc/template/1.3.5/model/interface-update.tpl index 94cd377..caf260b 100644 --- a/doc/template/1.3.5/model/interface-update.tpl +++ b/doc/template/1.3.5/model/interface-update.tpl @@ -1 +1 @@ -Update(ctx context.Context, data *{{.upperStartCamelObject}}) error \ No newline at end of file +Update(ctx context.Context, tx *gorm.DB, data *{{.upperStartCamelObject}}) error \ No newline at end of file diff --git a/doc/template/1.3.5/model/model-new.tpl b/doc/template/1.3.5/model/model-new.tpl index 7a953a5..8dc994a 100644 --- a/doc/template/1.3.5/model/model-new.tpl +++ b/doc/template/1.3.5/model/model-new.tpl @@ -1,7 +1,9 @@ +var {{.upperStartCamelObject}}TableName = {{.table}} + func new{{.upperStartCamelObject}}Model(conn *gorm.DB{{if .withCache}}, c cache.CacheConf{{end}}) *default{{.upperStartCamelObject}}Model { return &default{{.upperStartCamelObject}}Model{ - {{if .withCache}}CachedConn: gormc.NewConn(conn, c){{else}}conn:conn{{end}}, - table: {{.table}}, + {{if .withCache}}CachedConn: gormc.NewConn(conn, c){{else}}GormConn: gormx.NewConn(conn){{end}}, + table: {{.upperStartCamelObject}}TableName, } } diff --git a/doc/template/1.3.5/model/model.tpl b/doc/template/1.3.5/model/model.tpl index bc5da8f..7c12f98 100644 --- a/doc/template/1.3.5/model/model.tpl +++ b/doc/template/1.3.5/model/model.tpl @@ -2,7 +2,6 @@ package {{.pkg}} {{if .withCache}} import ( "github.com/zeromicro/go-zero/core/stores/cache" - "github.com/zeromicro/go-zero/core/stores/sqlx" "gorm.io/gorm" ) {{else}} diff --git a/doc/template/1.3.5/model/table-name.tpl b/doc/template/1.3.5/model/table-name.tpl index 079c0a8..32738f6 100644 --- a/doc/template/1.3.5/model/table-name.tpl +++ b/doc/template/1.3.5/model/table-name.tpl @@ -4,6 +4,5 @@ func (m *default{{.upperStartCamelObject}}Model) tableName() string { } func ({{.upperStartCamelObject}}) TableName() string { - model := new{{.upperStartCamelObject}}Model(nil) - return model.tableName() + return {{.upperStartCamelObject}}TableName } \ No newline at end of file diff --git a/doc/template/1.3.5/model/types.tpl b/doc/template/1.3.5/model/types.tpl index bdb7265..944c558 100644 --- a/doc/template/1.3.5/model/types.tpl +++ b/doc/template/1.3.5/model/types.tpl @@ -1,11 +1,12 @@ type ( {{.lowerStartCamelObject}}Model interface{ + gormx.TxModel {{.method}} } default{{.upperStartCamelObject}}Model struct { - {{if .withCache}}gormc.CachedConn{{else}}conn *gorm.DB{{end}} + {{if .withCache}}gormc.CachedConn{{else}}gormx.GormConn{{end}} table string } diff --git a/doc/template/1.3.5/model/update.tpl b/doc/template/1.3.5/model/update.tpl index 98bbae6..e20b372 100644 --- a/doc/template/1.3.5/model/update.tpl +++ b/doc/template/1.3.5/model/update.tpl @@ -1,8 +1,23 @@ -func (m *default{{.upperStartCamelObject}}Model) Update(ctx context.Context, data *{{.upperStartCamelObject}}) error { +func (m *default{{.upperStartCamelObject}}Model) Update(ctx context.Context, tx *gorm.DB, data *{{.upperStartCamelObject}}) error { {{if .withCache}}{{.keys}} - err := m.ExecCtx(ctx, func(conn *gorm.DB) *gorm.DB { - return conn.Save(data) - }, {{.keyValues}}){{else}}err:=m.conn.WithContext(ctx).Save(data).Error{{end}} - return err + return m.ExecCtx(ctx, func(conn *gorm.DB) error { + result := gormx.WithTx(ctx, conn, tx).Save(data) + if result.Error != nil { + return result.Error + } + if result.RowsAffected == 0 { + return gormx.ErrRowsAffectedZero + } + return nil + }, {{.keyValues}}){{else}} + result:=gormx.WithTx(ctx, m.DB, tx).Save(data) + if result.Error != nil { + return result.Error + } + if result.RowsAffected == 0 { + return gormx.ErrRowsAffectedZero + } + return nil + {{end}} } diff --git a/doc/template/1.3.5/mongo/err.tpl b/doc/template/1.3.5/mongo/err.tpl new file mode 100644 index 0000000..cb8be41 --- /dev/null +++ b/doc/template/1.3.5/mongo/err.tpl @@ -0,0 +1,6 @@ +package model + +import "errors" + +var ErrNotFound = errors.New("not found") +var ErrInvalidObjectId = errors.New("invalid objectId") diff --git a/doc/template/1.3.5/mongo/model.tpl b/doc/template/1.3.5/mongo/model.tpl new file mode 100644 index 0000000..bf807d0 --- /dev/null +++ b/doc/template/1.3.5/mongo/model.tpl @@ -0,0 +1,98 @@ +package model + +import ( + "context" + + "github.com/globalsign/mgo/bson" + {{if .Cache}}cachec "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/mongoc"{{else}}"github.com/zeromicro/go-zero/core/stores/mongo"{{end}} +) + +{{if .Cache}}var prefix{{.Type}}CacheKey = "cache:{{.Type}}:"{{end}} + +type {{.Type}}Model interface{ + Insert(ctx context.Context,data *{{.Type}}) error + FindOne(ctx context.Context,id string) (*{{.Type}}, error) + Update(ctx context.Context,data *{{.Type}}) error + Delete(ctx context.Context,id string) error +} + +type default{{.Type}}Model struct { + {{if .Cache}}*mongoc.Model{{else}}*mongo.Model{{end}} +} + +func New{{.Type}}Model(url, collection string{{if .Cache}}, c cachec.CacheConf{{end}}) {{.Type}}Model { + return &default{{.Type}}Model{ + Model: {{if .Cache}}mongoc.MustNewModel(url, collection, c){{else}}mongo.MustNewModel(url, collection){{end}}, + } +} + + +func (m *default{{.Type}}Model) Insert(ctx context.Context, data *{{.Type}}) error { + if !data.ID.Valid() { + data.ID = bson.NewObjectId() + } + + session, err := m.TakeSession() + if err != nil { + return err + } + + defer m.PutSession(session) + return m.GetCollection(session).Insert(data) +} + +func (m *default{{.Type}}Model) FindOne(ctx context.Context, id string) (*{{.Type}}, error) { + if !bson.IsObjectIdHex(id) { + return nil, ErrInvalidObjectId + } + + session, err := m.TakeSession() + if err != nil { + return nil, err + } + + defer m.PutSession(session) + var data {{.Type}} + {{if .Cache}}key := prefix{{.Type}}CacheKey + id + err = m.GetCollection(session).FindOneId(&data, key, bson.ObjectIdHex(id)) + {{- else}} + err = m.GetCollection(session).FindId(bson.ObjectIdHex(id)).One(&data) + {{- end}} + switch err { + case nil: + return &data,nil + case {{if .Cache}}mongoc.ErrNotFound{{else}}mongo.ErrNotFound{{end}}: + return nil,ErrNotFound + default: + return nil,err + } +} + +func (m *default{{.Type}}Model) Update(ctx context.Context, data *{{.Type}}) error { + session, err := m.TakeSession() + if err != nil { + return err + } + + defer m.PutSession(session) + {{if .Cache}}key := prefix{{.Type}}CacheKey + data.ID.Hex() + return m.GetCollection(session).UpdateId(data.ID, data, key) + {{- else}} + return m.GetCollection(session).UpdateId(data.ID, data) + {{- end}} +} + +func (m *default{{.Type}}Model) Delete(ctx context.Context, id string) error { + session, err := m.TakeSession() + if err != nil { + return err + } + + defer m.PutSession(session) + {{if .Cache}}key := prefix{{.Type}}CacheKey + id + return m.GetCollection(session).RemoveId(bson.ObjectIdHex(id), key) + {{- else}} + return m.GetCollection(session).RemoveId(bson.ObjectIdHex(id)) + {{- end}} +} diff --git a/doc/template/1.3.5/newapi/newtemplate.tpl b/doc/template/1.3.5/newapi/newtemplate.tpl new file mode 100644 index 0000000..28be510 --- /dev/null +++ b/doc/template/1.3.5/newapi/newtemplate.tpl @@ -0,0 +1,12 @@ +type Request { + Name string `path:"name,options=you|me"` +} + +type Response { + Message string `json:"message"` +} + +service {{.name}}-api { + @handler {{.handler}}Handler + get /from/:name(Request) returns (Response) +} diff --git a/doc/template/1.3.5/rpc/call-func.tpl b/doc/template/1.3.5/rpc/call-func.tpl new file mode 100644 index 0000000..cdaf8c1 --- /dev/null +++ b/doc/template/1.3.5/rpc/call-func.tpl @@ -0,0 +1,6 @@ + +{{if .hasComment}}{{.comment}}{{end}} +func (m *default{{.serviceName}}) {{.method}}(ctx context.Context{{if .hasReq}}, in *{{.pbRequest}}{{end}}, opts ...grpc.CallOption) ({{if .notStream}}*{{.pbResponse}}, {{else}}{{.streamBody}},{{end}} error) { + client := {{if .isCallPkgSameToGrpcPkg}}{{else}}{{.package}}.{{end}}New{{.rpcServiceName}}Client(m.cli.Conn()) + return client.{{.method}}(ctx{{if .hasReq}}, in{{end}}, opts...) +} diff --git a/doc/template/1.3.5/rpc/call-interface-func.tpl b/doc/template/1.3.5/rpc/call-interface-func.tpl new file mode 100644 index 0000000..c2539f0 --- /dev/null +++ b/doc/template/1.3.5/rpc/call-interface-func.tpl @@ -0,0 +1,2 @@ +{{if .hasComment}}{{.comment}} +{{end}}{{.method}}(ctx context.Context{{if .hasReq}}, in *{{.pbRequest}}{{end}}, opts ...grpc.CallOption) ({{if .notStream}}*{{.pbResponse}}, {{else}}{{.streamBody}},{{end}} error) \ No newline at end of file diff --git a/doc/template/1.3.5/rpc/call.tpl b/doc/template/1.3.5/rpc/call.tpl new file mode 100644 index 0000000..27b4879 --- /dev/null +++ b/doc/template/1.3.5/rpc/call.tpl @@ -0,0 +1,33 @@ +{{.head}} + +package {{.filePackage}} + +import ( + "context" + + {{.pbPackage}} + {{if ne .pbPackage .protoGoPackage}}{{.protoGoPackage}}{{end}} + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + {{.alias}} + + {{.serviceName}} interface { + {{.interface}} + } + + default{{.serviceName}} struct { + cli zrpc.Client + } +) + +func New{{.serviceName}}(cli zrpc.Client) {{.serviceName}} { + return &default{{.serviceName}}{ + cli: cli, + } +} + +{{.functions}} diff --git a/doc/template/1.3.5/rpc/config.tpl b/doc/template/1.3.5/rpc/config.tpl new file mode 100644 index 0000000..c1f85b9 --- /dev/null +++ b/doc/template/1.3.5/rpc/config.tpl @@ -0,0 +1,7 @@ +package config + +import "github.com/zeromicro/go-zero/zrpc" + +type Config struct { + zrpc.RpcServerConf +} diff --git a/doc/template/1.3.5/rpc/etc.tpl b/doc/template/1.3.5/rpc/etc.tpl new file mode 100644 index 0000000..cea664b --- /dev/null +++ b/doc/template/1.3.5/rpc/etc.tpl @@ -0,0 +1,6 @@ +Name: {{.serviceName}}.rpc +ListenOn: 127.0.0.1:8080 +Etcd: + Hosts: + - 127.0.0.1:2379 + Key: {{.serviceName}}.rpc diff --git a/doc/template/1.3.5/rpc/logic-func.tpl b/doc/template/1.3.5/rpc/logic-func.tpl new file mode 100644 index 0000000..e9410d4 --- /dev/null +++ b/doc/template/1.3.5/rpc/logic-func.tpl @@ -0,0 +1,6 @@ +{{if .hasComment}}{{.comment}}{{end}} +func (l *{{.logicName}}) {{.method}} ({{if .hasReq}}in {{.request}}{{if .stream}},stream {{.streamBody}}{{end}}{{else}}stream {{.streamBody}}{{end}}) ({{if .hasReply}}{{.response}},{{end}} error) { + // todo: add your logic here and delete this line + + return {{if .hasReply}}&{{.responseType}}{},{{end}} nil +} diff --git a/doc/template/1.3.5/rpc/logic.tpl b/doc/template/1.3.5/rpc/logic.tpl new file mode 100644 index 0000000..b4ca2a1 --- /dev/null +++ b/doc/template/1.3.5/rpc/logic.tpl @@ -0,0 +1,24 @@ +package logic + +import ( + "context" + + {{.imports}} + + "github.com/zeromicro/go-zero/core/logx" +) + +type {{.logicName}} struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func New{{.logicName}}(ctx context.Context,svcCtx *svc.ServiceContext) *{{.logicName}} { + return &{{.logicName}}{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} +{{.functions}} diff --git a/doc/template/1.3.5/rpc/main.tpl b/doc/template/1.3.5/rpc/main.tpl new file mode 100644 index 0000000..2e2f047 --- /dev/null +++ b/doc/template/1.3.5/rpc/main.tpl @@ -0,0 +1,39 @@ +package main + +import ( + "flag" + "fmt" + + {{.imports}} + "live-service/common/interceptor/rpcserver" + + "github.com/zeromicro/go-zero/core/conf" + "github.com/zeromicro/go-zero/core/service" + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +var configFile = flag.String("f", "etc/{{.serviceName}}.yaml", "the config file") + +func main() { + flag.Parse() + + var c config.Config + conf.MustLoad(*configFile, &c) + ctx := svc.NewServiceContext(c) + svr := server.New{{.serviceNew}}Server(ctx) + + s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { + {{.pkg}}.Register{{.service}}Server(grpcServer, svr) + + if c.Mode == service.DevMode || c.Mode == service.TestMode { + reflection.Register(grpcServer) + } + }) + s.AddUnaryInterceptors(rpcserver.LoggerInterceptor) + defer s.Stop() + + fmt.Printf("Starting rpc server at %s...\n", c.ListenOn) + s.Start() +} diff --git a/doc/template/1.3.5/rpc/server-func.tpl b/doc/template/1.3.5/rpc/server-func.tpl new file mode 100644 index 0000000..581122c --- /dev/null +++ b/doc/template/1.3.5/rpc/server-func.tpl @@ -0,0 +1,6 @@ + +{{if .hasComment}}{{.comment}}{{end}} +func (s *{{.server}}Server) {{.method}} ({{if .notStream}}ctx context.Context,{{if .hasReq}} in {{.request}}{{end}}{{else}}{{if .hasReq}} in {{.request}},{{end}}stream {{.streamBody}}{{end}}) ({{if .notStream}}{{.response}},{{end}}error) { + l := logic.New{{.logicName}}({{if .notStream}}ctx,{{else}}stream.Context(),{{end}}s.svcCtx) + return l.{{.method}}({{if .hasReq}}in{{if .stream}} ,stream{{end}}{{else}}{{if .stream}}stream{{end}}{{end}}) +} diff --git a/doc/template/1.3.5/rpc/server.tpl b/doc/template/1.3.5/rpc/server.tpl new file mode 100644 index 0000000..84a2f9c --- /dev/null +++ b/doc/template/1.3.5/rpc/server.tpl @@ -0,0 +1,22 @@ +{{.head}} + +package server + +import ( + {{if .notStream}}"context"{{end}} + + {{.imports}} +) + +type {{.server}}Server struct { + svcCtx *svc.ServiceContext + {{.unimplementedServer}} +} + +func New{{.server}}Server(svcCtx *svc.ServiceContext) *{{.server}}Server { + return &{{.server}}Server{ + svcCtx: svcCtx, + } +} + +{{.funcs}} diff --git a/doc/template/1.3.5/rpc/svc.tpl b/doc/template/1.3.5/rpc/svc.tpl new file mode 100644 index 0000000..cf2b47a --- /dev/null +++ b/doc/template/1.3.5/rpc/svc.tpl @@ -0,0 +1,13 @@ +package svc + +import {{.imports}} + +type ServiceContext struct { + Config config.Config +} + +func NewServiceContext(c config.Config) *ServiceContext { + return &ServiceContext{ + Config:c, + } +} diff --git a/doc/template/1.3.5/rpc/template.tpl b/doc/template/1.3.5/rpc/template.tpl new file mode 100644 index 0000000..76daa94 --- /dev/null +++ b/doc/template/1.3.5/rpc/template.tpl @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package {{.package}}; +option go_package="./{{.package}}"; + +message Request { + string ping = 1; +} + +message Response { + string pong = 1; +} + +service {{.serviceName}} { + rpc Ping(Request) returns(Response); +} diff --git a/go.mod b/go.mod index 2df7e22..79e370f 100644 --- a/go.mod +++ b/go.mod @@ -3,21 +3,25 @@ module live-service go 1.18 require ( - git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.1 + git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.4 git.noahlan.cn/northlan/ntools-go/kafka v1.0.1 git.noahlan.cn/northlan/ntools-go/uuid v1.0.0 + github.com/Shopify/sarama v1.33.0 + github.com/hashicorp/golang-lru v0.5.1 + github.com/jinzhu/now v1.1.5 + github.com/longzhiri/gozset v0.0.0-20210113140059-91f2d281daf1 github.com/pkg/errors v0.9.1 github.com/robfig/cron/v3 v3.0.0 - github.com/zeromicro/go-zero v1.3.2 - google.golang.org/grpc v1.45.0 - google.golang.org/protobuf v1.27.1 + github.com/shopspring/decimal v1.3.1 + github.com/zeromicro/go-zero v1.3.3 + google.golang.org/grpc v1.46.0 + google.golang.org/protobuf v1.28.0 gorm.io/driver/mysql v1.3.3 gorm.io/gorm v1.23.5 + gorm.io/plugin/optimisticlock v1.0.7 ) require ( - github.com/Shopify/sarama v1.33.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 @@ -41,17 +45,14 @@ require ( github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/golang-lru v0.5.1 // indirect github.com/jcmturner/aescts/v2 v2.0.0 // indirect github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect github.com/jcmturner/gofork v1.0.0 // indirect github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect github.com/jcmturner/rpc/v2 v2.0.3 // indirect github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.15.4 // indirect - github.com/longzhiri/gozset v0.0.0-20210113140059-91f2d281daf1 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -62,7 +63,6 @@ require ( github.com/prometheus/common v0.30.0 // indirect github.com/prometheus/procfs v0.7.3 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/shopspring/decimal v1.3.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect go.etcd.io/etcd/api/v3 v3.5.2 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.2 // indirect @@ -84,10 +84,9 @@ require ( golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20220228195345-15d65a4533f7 // indirect + google.golang.org/genproto v0.0.0-20220422154200-b37d22cd5731 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gorm.io/plugin/optimisticlock v1.0.7 // indirect k8s.io/api v0.20.12 // indirect k8s.io/apimachinery v0.20.12 // indirect k8s.io/client-go v0.20.12 // indirect diff --git a/go.sum b/go.sum index 72007f8..cf8e2a8 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.1 h1:c/vZx96FPV4xyZEsSvWAXzQH+S3QZ9ixMBv3faQzXSY= -git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.1/go.mod h1:fDeW2GCJEU5OEPMisWH9wyA/BiPZg6tK5FegDIaMURg= +git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.4 h1:r9jH+tJ1YoeX0gtt26lWeW2hxJGbKH1DksnIrjrLaMk= +git.noahlan.cn/northlan/ntools-go/gorm-zero v1.0.4/go.mod h1:ExV9s96axCdMcaXqsezoUxnbTptkMqwvNWvON05uzjE= git.noahlan.cn/northlan/ntools-go/kafka v1.0.1 h1:SDUwYRzksZ3Vcu7PTZxk+TEMF2f3gBiQEboKOhi1yfI= git.noahlan.cn/northlan/ntools-go/kafka v1.0.1/go.mod h1:RxX9JSUIr3Gbk+cvUwE5k+i08AgIK3TA9ayDJCMn2n8= git.noahlan.cn/northlan/ntools-go/uuid v1.0.0 h1:C0PazSzG3+e/Hfh2C6Qf8R46sNZmZKTOcWS990yUmrE= @@ -54,15 +54,11 @@ github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb0 github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.30.0/go.mod h1:zujlQQx1kzHsh4jfV1USnptCQrHAEZ2Hk8fTKCulPVs= -github.com/Shopify/sarama v1.32.0 h1:P+RUjEaRU0GMMbYexGMDyrMkLhbbBVUVISDywi+IlFU= -github.com/Shopify/sarama v1.32.0/go.mod h1:+EmJJKZWVT/faR9RcOxJerP+LId4iWdQPBGLy1Y1Njs= github.com/Shopify/sarama v1.33.0 h1:2K4mB9M4fo46sAM7t6QTsmSO8dLX1OqznLM7vn3OjZ8= github.com/Shopify/sarama v1.33.0/go.mod h1:lYO7LwEBkE0iAeTl94UfPSrDaavFzSFlmn+5isARATQ= 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= @@ -95,6 +91,7 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -125,6 +122,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= @@ -210,6 +208,7 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -271,6 +270,14 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= +github.com/jackc/pgconn v1.10.1 h1:DzdIHIjG1AxGwoEEqS+mGsURyjt4enSmqzACXvVzOT8= +github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgproto3/v2 v2.2.0 h1:r7JypeP2D3onoQTCxWdTpCtJ4D+qpKr0TxvoyMhZ5ns= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= +github.com/jackc/pgtype v1.9.1 h1:MJc2s0MFS8C3ok1wQTdQxWuXQcB6+HwAm5x1CzW7mf0= +github.com/jackc/pgx/v4 v4.14.1 h1:71oo1KAGI6mXhLiTMn6iDFcp3e7+zon/capWjl2OEFU= github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo= @@ -303,10 +310,7 @@ github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNE github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.14.4/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= -github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.4 h1:1kn4/7MepF/CHmYub99/nNX8az0IJjfSOU/jbnTVfqQ= github.com/klauspost/compress v1.15.4/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -333,6 +337,7 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -344,6 +349,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -419,8 +425,6 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sniperHW/rank v0.0.0-20210526024650-8d7b0052d89e h1:Ex3Pju8BLLoYUU3cVRRmkg9PiBor7deKJZT1IqjTzH8= -github.com/sniperHW/rank v0.0.0-20210526024650-8d7b0052d89e/go.mod h1:WdhKwu4WacRJmjPwKlRKXGrRDcH6teZqpa7QtRPirsw= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -439,13 +443,14 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/scram v1.1.0/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -453,14 +458,15 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg= github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA= -github.com/zeromicro/go-zero v1.3.2 h1:2HcmceZDEGwZWvofCG+0GXyh+Gtz/wKCW4Fq8Mb7KIg= -github.com/zeromicro/go-zero v1.3.2/go.mod h1:DEj3Fwj1Ui1ltsgf6YqwTL9nD4+tYzIRX0c1pWtQo1E= +github.com/zeromicro/go-zero v1.3.3 h1:6qv9PcfqfB1tMgp1FJlP1LfWSZ4XD+FwojvA2h5LL2k= +github.com/zeromicro/go-zero v1.3.3/go.mod h1:LwuYc2V04ZHhWPWGJYQ+kJ5DT4QSkeaZGqXiQcpkfks= go.etcd.io/etcd/api/v3 v3.5.2 h1:tXok5yLlKyuQ/SXSjtqHc4uzNaMqZi2XsoSPr/LlJXI= go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.2 h1:4hzqQ6hIb3blLyQ8usCU4h3NghkqcsohEQ3o3VetYxE= go.etcd.io/etcd/client/pkg/v3 v3.5.2/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v3 v3.5.2 h1:WdnejrUtQC4nCxK0/dLTMqKOB+U5TP/2Ya0BJL+1otA= go.etcd.io/etcd/client/v3 v3.5.2/go.mod h1:kOOaWFFgHygyT0WlSmL8TJiXmMysO/nNUlEsSsN6W4o= +go.mongodb.org/mongo-driver v1.9.0/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -503,10 +509,9 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 h1:O8uGbHCqlTp2P6QJSLmCojM4mN6UemYv8K+dCnmHmu0= golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -580,9 +585,7 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220421235706-1d1ef9303861 h1:yssD99+7tqHWO5Gwh81phT+67hg+KttniBr6UnEXOY8= golang.org/x/net v0.0.0-20220421235706-1d1ef9303861/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220516155154-20f960328961 h1:+W/iTMPG0EL7aW+/atntZwZrvSRIj3m3yX414dSULUU= golang.org/x/net v0.0.0-20220516155154-20f960328961/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -648,6 +651,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -657,9 +661,9 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -687,6 +691,7 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -785,8 +790,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20220228195345-15d65a4533f7 h1:ntPPoHzFW6Xp09ueznmahONZufyoSakK/piXnr2BU3I= -google.golang.org/genproto v0.0.0-20220228195345-15d65a4533f7/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220422154200-b37d22cd5731 h1:nquqdM9+ps0JZcIiI70+tqoaIFS5Ql4ZuK8UXnz3HfE= +google.golang.org/genproto v0.0.0-20220422154200-b37d22cd5731/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -803,9 +808,9 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -818,8 +823,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -849,9 +855,9 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v1.3.3 h1:jXG9ANrwBc4+bMvBcSl8zCfPBaVoPyBEBshA8dA93X8= gorm.io/driver/mysql v1.3.3/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= +gorm.io/driver/postgres v1.3.1 h1:Pyv+gg1Gq1IgsLYytj/S2k7ebII3CzEdpqQkPOdH24g= +gorm.io/driver/sqlite v1.2.6 h1:SStaH/b+280M7C8vXeZLz/zo9cLQmIGwwj3cSj7p6l4= gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= -gorm.io/gorm v1.23.4 h1:1BKWM67O6CflSLcwGQR7ccfmC4ebOxQrTfOQGRE9wjg= -gorm.io/gorm v1.23.4/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.5 h1:TnlF26wScKSvknUC/Rn8t0NLLM22fypYBlvj1+aH6dM= gorm.io/gorm v1.23.5/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/plugin/optimisticlock v1.0.7 h1:H+UltfbM3twsgMj4WrRLB2YYVdAcVFegj6DdmIuiA7M=