fix 推币机桌面数据同步
This commit is contained in:
parent
21993b08da
commit
9bedfc1dfe
|
|
@ -71,10 +71,6 @@ func (r *RedPacket) GetAll() (res []*modelpkg.RedPacket, err error) {
|
||||||
func (r *RedPacket) UpdateAll(list []*modelpkg.RedPacket) error {
|
func (r *RedPacket) UpdateAll(list []*modelpkg.RedPacket) error {
|
||||||
var operations []mongo.WriteModel
|
var operations []mongo.WriteModel
|
||||||
for _, v := range list {
|
for _, v := range list {
|
||||||
updateDataMap := bson.M{
|
|
||||||
"$set": v,
|
|
||||||
}
|
|
||||||
delete(updateDataMap["$set"].(bson.M), "_id") // 删除 _id 字段
|
|
||||||
operations = append(operations, mongo.NewUpdateOneModel().SetFilter(bson.M{"_id": v.ID}).SetUpdate(bson.M{"$set": v}).SetUpsert(true))
|
operations = append(operations, mongo.NewUpdateOneModel().SetFilter(bson.M{"_id": v.ID}).SetUpdate(bson.M{"$set": v}).SetUpsert(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -393,6 +393,7 @@ func Draw(p *Player) {
|
||||||
for k, v := range d.GetGain() {
|
for k, v := range d.GetGain() {
|
||||||
pack.ItemId = int32(k)
|
pack.ItemId = int32(k)
|
||||||
pack.ItemNum = int32(v)
|
pack.ItemNum = int32(v)
|
||||||
|
AddValue(p, map[int32]int64{pack.ItemId: int64(pack.ItemNum)})
|
||||||
}
|
}
|
||||||
if pack.Coin > 0 || pack.ItemId > 0 {
|
if pack.Coin > 0 || pack.ItemId > 0 {
|
||||||
p.SendToClient(int(activity.PushCoinPacketID_PACKET_NotifyDrawInfo), pack)
|
p.SendToClient(int(activity.PushCoinPacketID_PACKET_NotifyDrawInfo), pack)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue