diff --git a/logic/controller/item_use.go b/logic/controller/item_use.go index 5771b64de..0f8d1b9d2 100644 --- a/logic/controller/item_use.go +++ b/logic/controller/item_use.go @@ -102,7 +102,7 @@ func (h Controller) handlexuancaiItem(currentPet *model.PetInfo, c *player.Playe return errorcode.ErrorCodes.ErrItemUnusable } items := c.Service.Item.CheakItem(uint32(xmlres.PetMAP[int(currentPet.ID)].Type) + 400686) - if items <= 0 { + if items < 100 { return errorcode.ErrorCodes.ErrInsufficientItems } c.Service.Item.UPDATE(uint32(items), -100) diff --git a/logic/service/fight/action.go b/logic/service/fight/action.go index e2ce408b8..0c49f5592 100644 --- a/logic/service/fight/action.go +++ b/logic/service/fight/action.go @@ -7,6 +7,7 @@ import ( "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "context" + "time" "github.com/jinzhu/copier" ) @@ -77,7 +78,7 @@ func (f *FightC) ChangePet(c common.PlayerI, id uint32) { case f.actionChan <- ret: // 发送成功,可选记录日志 // log.Printf("send skill success, userID: %d, skillID: %d", c.GetInfo().UserID, id) - default: + case <-time.After(time.Second * 10): // 通道满时的降级处理 cool.Logger.Printf(context.Background(), "actionChan is full, failed to send skill, userID: %d, skillID: %d", c.GetInfo().UserID, id) @@ -119,7 +120,7 @@ func (f *FightC) UseSkill(c common.PlayerI, id uint32) { case f.actionChan <- ret: // 发送成功,可选记录日志 // log.Printf("send skill success, userID: %d, skillID: %d", c.GetInfo().UserID, id) - default: + case <-time.After(time.Second * 10): // 通道满时的降级处理 cool.Logger.Printf(context.Background(), "actionChan is full, failed to send skill, userID: %d, skillID: %d", c.GetInfo().UserID, id) @@ -136,7 +137,7 @@ func (f *FightC) Capture(c common.PlayerI, id uint32) { case f.actionChan <- &action.UseItemAction{BaseAction: action.NewBaseAction(c.GetInfo().UserID), ItemID: id}: // 发送成功,可选记录日志 // log.Printf("send skill success, userID: %d, skillID: %d", c.GetInfo().UserID, id) - default: + case <-time.After(time.Second * 10): // 通道满时的降级处理 cool.Logger.Printf(context.Background(), "actionChan is full, failed to send Capture, userID: %d ", c.GetInfo().UserID) @@ -154,7 +155,7 @@ func (f *FightC) UseItem(c common.PlayerI, cacthid, itemid uint32) { case f.actionChan <- &action.UseItemAction{BaseAction: action.NewBaseAction(c.GetInfo().UserID), ItemID: itemid, CacthTime: cacthid}: // 发送成功,可选记录日志 // log.Printf("send skill success, userID: %d, skillID: %d", c.GetInfo().UserID, id) - default: + case <-time.After(time.Second * 10): // 通道满时的降级处理 cool.Logger.Printf(context.Background(), "actionChan is full, failed to send UseItem, userID: %d, skillID: %d", c.GetInfo().UserID, cacthid) diff --git a/modules/player/service/gold_log.go b/modules/player/service/gold_log.go index 5bc64f091..1fcc7e0f2 100644 --- a/modules/player/service/gold_log.go +++ b/modules/player/service/gold_log.go @@ -3,24 +3,42 @@ 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, // 补充消费时间(月-周-日) } - - return + s.dbm(s.Model).Data(record).Insert() }