Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c1d08db044 | ||
![]() |
9edec35425 | ||
![]() |
7c6e1ba3a8 | ||
![]() |
91324cd225 | ||
![]() |
92e71475d3 | ||
![]() |
48b3206053 | ||
![]() |
981dd3b98d | ||
88dd6fbdf5 | |||
![]() |
e0f73fc058 | ||
![]() |
88ff5825ea | ||
![]() |
7b557072f3 | ||
![]() |
8d6f2b31f2 | ||
![]() |
777f826a32 | ||
![]() |
3d8b82f0fd | ||
![]() |
de3277c085 | ||
![]() |
bf2a135f00 | ||
![]() |
4ec702af0b | ||
![]() |
bd2af34fb8 | ||
![]() |
6eb2bb09bf |
2
go.mod
2
go.mod
@@ -1,3 +1,3 @@
|
||||
module gitee.com/shenzhen-jinhuatai-network/rabbitmq_common_structure
|
||||
module git.ssgfgtfy.com/backend/common_structure
|
||||
|
||||
go 1.18.0
|
||||
|
21
log.go
Normal file
21
log.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package common_structure
|
||||
|
||||
import "time"
|
||||
|
||||
type LogInfoType = string
|
||||
|
||||
const (
|
||||
LogInfoTypeOrder LogInfoType = "order"
|
||||
LogInfoTypeProduct LogInfoType = "product"
|
||||
)
|
||||
|
||||
type LogInfo struct {
|
||||
InfoType LogInfoType `json:"info_type"` // 类型
|
||||
ID int `json:"id"` // ID,订单ID,商品ID,商品SKUID之类的id
|
||||
Operator interface{} `json:"operator"` // 操作人,商家用户对象,admin对象或者是系统,关闭订单消费队列等
|
||||
Title string `json:"title"` // 标题,做什么事情
|
||||
Param interface{} `json:"param"` // 参数,请求参数,函数、方法就是参数
|
||||
Result interface{} `json:"result"` // 结果,返回值
|
||||
ErrStr string `json:"err_str"` // 错误信息,json转义error没有自动存储,需要手动转义
|
||||
At time.Time `json:"at"` // 记录时间
|
||||
}
|
49
order.go
49
order.go
@@ -1,49 +0,0 @@
|
||||
package rabbitmq_common_structure
|
||||
|
||||
type OrderCreate struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderClose struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderPay struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderSent struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type CloseRefund struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderFinished struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderReconciliationPrecheck struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderReconciliation struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderConsumptionAward struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderConsumptionAwardRedPacketQualification struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderConsumptionAwardRedPacketMoney struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderVoucher struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
30
product.go
30
product.go
@@ -1,30 +0,0 @@
|
||||
package rabbitmq_common_structure
|
||||
|
||||
type ProductsIncreaseSold struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
ProductID uint `json:"product_id"` // 商品ID
|
||||
}
|
||||
|
||||
// StockState 库存增减标识
|
||||
type StockState = string
|
||||
|
||||
const (
|
||||
StockStateIncrease StockState = "increase_inventory" //增加库存
|
||||
StockStateDecrease StockState = "reduce_inventory" //减少库存
|
||||
)
|
||||
|
||||
type ProductsChange struct {
|
||||
OrderId uint `json:"order_id"`
|
||||
State StockState `json:"state"`
|
||||
SkuItems []*SkuItem
|
||||
}
|
||||
|
||||
type SkuItem struct {
|
||||
SkuID uint `json:"sku_id"`
|
||||
Num int `json:"num"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
type ProductsStockWarn struct {
|
||||
ID uint `json:"id"` // skuID
|
||||
}
|
85
rabbitmq_order.go
Normal file
85
rabbitmq_order.go
Normal file
@@ -0,0 +1,85 @@
|
||||
package common_structure
|
||||
|
||||
type OrderCreate struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderCloseType = int
|
||||
|
||||
const (
|
||||
OrderCloseTypePayTimeout OrderCloseType = 10 // 支付超时
|
||||
OrderCloseTypeRefundClose OrderCloseType = 20 // 售后完成关闭
|
||||
OrderCloseTypeMerchantClose OrderCloseType = 30 // 商家关闭
|
||||
OrderCloseTypeThirdOrderFailedClose OrderCloseType = 40 // 第三方订单下单失败关闭
|
||||
OrderCloseTypeUser OrderCloseType = 50 // 用户主动关闭
|
||||
OrderCloseTypeMerchantCancel OrderCloseType = 60 //商家取消订单关闭
|
||||
OrderCloseTypeDeliveryTimeout OrderCloseType = 70 //发货超时关闭
|
||||
|
||||
)
|
||||
|
||||
type OrderClose struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
CloseType OrderCloseType `json:"close_type"` // 关闭类型
|
||||
}
|
||||
|
||||
type OrderPay struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderSent struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
OrderProductsID uint `json:"order_products_id"` // 订单商品ID
|
||||
}
|
||||
|
||||
type OrderCloseRefund struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderFinished struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderReconciliationPrecheck struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderReconciliation struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderConsumptionAward struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderConsumptionAwardRedPacketQualification struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderConsumptionAwardRedPacketMoney struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderVoucher struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderFinishedAfter struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type OrderUpdateSuccess struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type ThirdOrderRefund struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
||||
|
||||
type RedPacketRefund struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
OrderProductsID uint `json:"order_products_id"` // 订单商品ID
|
||||
}
|
||||
|
||||
type OrderSentOvertime struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
}
|
48
rabbitmq_product.go
Normal file
48
rabbitmq_product.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package common_structure
|
||||
|
||||
type ProductsIncreaseSoldType = int
|
||||
|
||||
const (
|
||||
ProductsIncreaseSoldTypePaied ProductsIncreaseSoldType = 10 // 已支付
|
||||
ProductsIncreaseSoldTypeSent ProductsIncreaseSoldType = 20 // 已发货
|
||||
)
|
||||
|
||||
type ProductsIncreaseSold struct {
|
||||
ID uint `json:"id"` // 订单ID
|
||||
ProductID uint `json:"product_id"` // 商品ID
|
||||
IncreaseSoldType ProductsIncreaseSoldType `json:"increase_sold_type"` // 增加销量类型
|
||||
}
|
||||
|
||||
// StockState 库存增减标识
|
||||
type StockState = string
|
||||
|
||||
const (
|
||||
StockStateIncrease StockState = "increase_inventory" //增加库存
|
||||
StockStateDecrease StockState = "reduce_inventory" //减少库存
|
||||
)
|
||||
|
||||
type ProductsChangeStockType = int
|
||||
|
||||
const (
|
||||
ProductsChangeStockTypePlaced ProductsChangeStockType = 10 // 下单时
|
||||
ProductsChangeStockTypeSent ProductsChangeStockType = 20 // 已发货
|
||||
)
|
||||
|
||||
type ProductsChangeStock struct {
|
||||
OrderId uint `json:"order_id"`
|
||||
State StockState `json:"state"`
|
||||
DecreaseChangeStockType ProductsChangeStockType `json:"decrease_change_stock_type"`
|
||||
OrderProductsIDs []uint `json:"order_products_ids"` // 对应的订单商品ID集合加减库存,如果为0,整个订单商品加减库存
|
||||
|
||||
SkuItems []*SkuItem `json:"sku_items"` // 商家修改商品数量使用,旧逻辑兼容
|
||||
}
|
||||
|
||||
type SkuItem struct {
|
||||
SkuID uint `json:"sku_id"`
|
||||
Num int `json:"num"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
type ProductsStockWarn struct {
|
||||
ID uint `json:"id"` // skuID
|
||||
}
|
Reference in New Issue
Block a user