dto-record.go
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package roomrank
import (
"apigame/service-common/svconst"
"apigame/service-common/svmysql"
"apigame/util/util-lx/lxtime"
"fmt"
)
// RecordBase 日志公共
type RecordBase struct {
Id int64 `gorm:"primaryKey;comment:日志ID"`
TopType int `gorm:"comment:排行榜类型"`
Uid int64 `gorm:"comment:玩家唯一ID"`
ActivityId int64 `gorm:"comment:当前活动ID"`
CreateTime int64 `gorm:"comment:创建时间戳"`
UpdateTime int64 `gorm:"comment:修改时间戳"`
}
func NewRecordBase(uid int64, topType int, activityId int64) RecordBase {
secNow := lxtime.NowUninx()
return RecordBase{
CreateTime: secNow,
UpdateTime: secNow,
TopType: topType,
Uid: uid,
ActivityId: activityId,
}
}
// RecordGetSettleAward 领取上期结算奖励
type RecordGetSettleAward struct {
RecordBase
Award string `gorm:"type:varchar(255);comment:奖励内容"`
}
func (d *RecordGetSettleAward) MysqlInfo(suffix string) *svmysql.MysqlInfo {
tableName := svconst.MYSQL_TABLE_S_ROOMRANK_RECORD_SETTLEAWARD
return &svmysql.MysqlInfo{
DbMysql: svconst.DbCommon,
TableName: fmt.Sprintf("%s_%s_%d", tableName, suffix, d.TopType),
}
}
func NewRecordGetSettleAward(recordBase RecordBase,
award string) *RecordGetSettleAward {
return &RecordGetSettleAward{
RecordBase: recordBase,
Award: award,
}
}
// RecordAddScore 房间排行增加积分
type RecordAddScore struct {
RecordBase
AddScore int64 `gorm:"comment:增加积分"`
OldScore int64 `gorm:"comment:旧积分"`
NewScore int64 `gorm:"comment:新积分"`
}
func (d *RecordAddScore) MysqlInfo(suffix string) *svmysql.MysqlInfo {
tableName := svconst.MYSQL_TABLE_S_ROOMRANK_RECORD_ADDSCORE
return &svmysql.MysqlInfo{
DbMysql: svconst.DbCommon,
TableName: fmt.Sprintf("%s_%s_%d", tableName, suffix, d.TopType),
}
}
func NewRecordAddScore(recordBase RecordBase,
addScore, oldScore, newScore int64) *RecordAddScore {
return &RecordAddScore{
RecordBase: recordBase,
AddScore: addScore,
OldScore: oldScore,
NewScore: newScore,
}
}