update stuff
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m52s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m52s
This commit is contained in:
@@ -43,10 +43,10 @@ type CartGrain struct {
|
||||
lastItemId int
|
||||
lastDeliveryId int
|
||||
storageMessages []Message
|
||||
Id CartId `json:"id"`
|
||||
Items []CartItem `json:"items"`
|
||||
TotalPrice int64 `json:"totalPrice"`
|
||||
Deliveries []string `json:"deliveries,omitempty"`
|
||||
Id CartId `json:"id"`
|
||||
Items []*CartItem `json:"items"`
|
||||
TotalPrice int64 `json:"totalPrice"`
|
||||
Deliveries []string `json:"deliveries,omitempty"`
|
||||
}
|
||||
|
||||
type Grain interface {
|
||||
@@ -152,16 +152,17 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) ([]byte, erro
|
||||
}
|
||||
if !found {
|
||||
c.lastItemId++
|
||||
c.Items = append(c.Items, CartItem{
|
||||
Id: c.lastItemId,
|
||||
|
||||
Sku: msg.Sku,
|
||||
Name: msg.Name,
|
||||
Price: msg.Price,
|
||||
Image: msg.Image,
|
||||
c.Items = append(c.Items, &CartItem{
|
||||
Id: c.lastItemId,
|
||||
Quantity: int(msg.Quantity),
|
||||
Sku: msg.Sku,
|
||||
Name: msg.Name,
|
||||
Price: msg.Price,
|
||||
Image: msg.Image,
|
||||
})
|
||||
c.TotalPrice += msg.Price * int64(msg.Quantity)
|
||||
}
|
||||
c.TotalPrice += msg.Price * int64(msg.Quantity)
|
||||
|
||||
}
|
||||
case RemoveItemType:
|
||||
//msg, ok := message.Content.(*messages.RemoveItem)
|
||||
|
||||
Reference in New Issue
Block a user