diff --git a/database/wheeldb.sql b/database/wheeldb.sql index 76c8485c..7edad2a3 100644 --- a/database/wheeldb.sql +++ b/database/wheeldb.sql @@ -82,6 +82,7 @@ CREATE TABLE `t_chip` ( `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id', `item_num` int(11) NOT NULL DEFAULT '0' COMMENT '道具数量', `expiretime` int(11) NOT NULL DEFAULT '0' COMMENT '过期时间', + `calc_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次计算分数时间', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', KEY `idx_account_id` (`account_id`), diff --git a/server/wheelserver/service/chip.go b/server/wheelserver/service/chip.go index 9f692940..c26a872f 100644 --- a/server/wheelserver/service/chip.go +++ b/server/wheelserver/service/chip.go @@ -23,3 +23,10 @@ func (this *chip) List(accountId string) (error, []*model.Chip) { "account_id = ? AND expiretime > ?", accountId, nowTime).Find(&chips) return result.Error, chips } + +func (this *chip) CalcScore(accountId string) { + nowTime := f5.GetApp().GetRealSeconds() + chips := []*model.Chip{} + result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(new(model.Chip).TableName()).Where( + "account_id = ? AND expiretime > ?", accountId, nowTime).Find(&chips) +}