``feat(item): 新增物品出售价格属性(SellPrice)并实现物品出售功能,优化宠物面板计算和时区判断逻辑``
This commit is contained in:
51
logic/controller/user_talk.go
Normal file
51
logic/controller/user_talk.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/logic/service/item"
|
||||
"blazing/logic/service/player"
|
||||
"blazing/modules/blazing/service"
|
||||
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
)
|
||||
|
||||
func (h Controller) Talk(data *item.TalkCountInboundInfo, c *player.Player) (result *item.TalkCountOutboundInfo, err errorcode.ErrorCode) {
|
||||
result = &item.TalkCountOutboundInfo{}
|
||||
cid, ok := c.Service.Talk.Cheak(c.Info.MapID, int(data.ID))
|
||||
if !ok {
|
||||
return result, 0
|
||||
}
|
||||
result.GiftCount = uint32(cid)
|
||||
|
||||
return result, 0
|
||||
}
|
||||
|
||||
//var talkcacche = make(map[string]uint32)
|
||||
|
||||
func (h Controller) TalkCate(data *item.TalkCateInboundInfo, c *player.Player) (result *item.DayTalkInfo, err errorcode.ErrorCode) {
|
||||
result = &item.DayTalkInfo{}
|
||||
result.OutList = make([]item.CateInfo, 0)
|
||||
|
||||
_, ok := c.Service.Talk.Cheak(c.Info.MapID, int(data.ID))
|
||||
if !ok {
|
||||
return result, errorcode.ErrorCodes.ErrResourceUnavailable
|
||||
}
|
||||
//更新次数
|
||||
config := service.TalkConfigServiceS.GetCache(int(data.ID))
|
||||
|
||||
for _, v := range config {
|
||||
count := grand.N(int(v.ItemMinCount), int(v.ItemMaxCount))
|
||||
|
||||
// r := dict.DictInfoServiceS.DataID("fusion")
|
||||
// trueitemid := gconv.Uint32(r[gconv.Uint32(v.ItemID)].Remark)
|
||||
ret := c.ItemAdd(uint32(v.ItemID), uint32(count))
|
||||
if ret {
|
||||
result.OutList = append(result.OutList, item.CateInfo{ID: v.ItemID, Count: uint32(count)})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
c.Service.Talk.Update(int(data.ID))
|
||||
|
||||
return result, 0
|
||||
}
|
||||
Reference in New Issue
Block a user