All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat(item): 调整玄彩道具使用数量限制 玄彩道具检查逻辑从 items <= 0 修改为 items < 100, 确保玩家拥有至少100个道具才能使用。 fix(fight): 修复战斗操作通道阻塞问题 添加10秒超时机制到战斗操作通道发送逻辑中, 避免通道满载时的
55 lines
1.1 KiB
Go
55 lines
1.1 KiB
Go
package service
|
||
|
||
import (
|
||
"blazing/cool"
|
||
"blazing/modules/player/model"
|
||
"time"
|
||
)
|
||
|
||
type GoldService struct {
|
||
BaseService
|
||
}
|
||
|
||
func (s *GoldService) Cheak(pid, count uint32) {
|
||
|
||
}
|
||
func (s *GoldService) Log(pid, count uint32) {
|
||
if cool.Config.ServerInfo.IsVip != 0 {
|
||
return
|
||
}
|
||
|
||
// 获取当前时间
|
||
now := time.Now()
|
||
// 提取年份
|
||
year := uint32(now.Year())
|
||
// 构造消费时间数组 [月, 周, 日]
|
||
// ISOWeek返回(年,周数),这里只取周数;Day()返回当月的第几天
|
||
_, week := now.ISOWeek()
|
||
consumeTime := []uint32{
|
||
uint32(now.Month()), // 月份
|
||
uint32(week), // 周数
|
||
uint32(now.Day()), // 日期
|
||
}
|
||
|
||
record := &model.GoldBeanConsume{
|
||
PlayerID: uint64(s.userid),
|
||
ConsumeNum: count,
|
||
BizID: pid,
|
||
Year: year, // 补充年份
|
||
Consume: consumeTime, // 补充消费时间(月-周-日)
|
||
}
|
||
s.dbm(s.Model).Data(record).Insert()
|
||
|
||
}
|
||
|
||
func NewGoldService(id uint32) *GoldService {
|
||
return &GoldService{
|
||
|
||
BaseService: BaseService{userid: id,
|
||
|
||
Service: &cool.Service{Model: model.NewGoldBeanConsume()},
|
||
},
|
||
}
|
||
|
||
}
|