order.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package model
  2. import (
  3. "time"
  4. "go.mongodb.org/mongo-driver/bson/primitive"
  5. )
  6. // 订单管理
  7. type Order struct {
  8. Id primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
  9. UserId primitive.ObjectID `bson:"userId,omitempty" json:"userId"`
  10. SupplyId primitive.ObjectID `bson:"supplyId,omitempty" json:"supplyId"`
  11. Address *Address `bson:"address,omitempty" json:"address"`
  12. Product *OrderProduct `bson:"product,omitempty" json:"product"`
  13. DeliveryMethod string `bson:"deliveryMethod,omitempty" json:"deliveryMethod"`
  14. Remark string `bson:"remark,omitempty" json:"remark"`
  15. ExpressNo string `bson:"expressNo,omitempty" json:"expressNo"` // 快递单号,商家发货时需要输入
  16. Status int `bson:"status,omitempty" json:"status"` // 0:待发货 1:已发货 2:已收货 3:已完成
  17. CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
  18. UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
  19. }
  20. type OrderProduct struct {
  21. Id primitive.ObjectID `bson:"id,omitempty" json:"id"` // 对应产品id
  22. SupplyId primitive.ObjectID `bson:"supplyId,omitempty" json:"supplyId"` // 供应链id
  23. Name string `bson:"name,omitempty" json:"name"`
  24. Size int `bson:"size,omitempty" json:"size"` // 下单选定的尺寸
  25. Color string `bson:"color,omitempty" json:"color"` // 下单选定的颜色
  26. Unit string `bson:"unit,omitempty" json:"unit"` // 型号
  27. Cover string `bson:"cover,omitempty" json:"cover"` // 封面图
  28. }
  29. // 可能一次性提交多个产品
  30. type OrederAddReq struct {
  31. Id primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
  32. UserId primitive.ObjectID `bson:"userId,omitempty" json:"userId"`
  33. Address *Address `bson:"address,omitempty" json:"address"`
  34. Products []*OrderProduct `bson:"product,omitempty" json:"product"`
  35. DeliveryMethod string `bson:"deliveryMethod,omitempty" json:"deliveryMethod"`
  36. Remark string `bson:"remark,omitempty" json:"remark"`
  37. ExpressNo string `bson:"expressNo,omitempty" json:"expressNo"` // 快递单号,商家发货时需要输入
  38. Status int `bson:"status,omitempty" json:"status"` // 0:代发货 1:已发货
  39. CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
  40. UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
  41. }