Compare commits

...

44 Commits

Author SHA1 Message Date
yuguojian
a1b4fe772c Merge branch '增加用户类型' 2025-06-09 09:55:53 +08:00
yuguojian
431fd441a7 更新日志类型 2025-06-09 09:55:50 +08:00
LiHouse
f6a19bd7e9 添加用户注销结构 2025-05-22 17:35:38 +08:00
yuguojian
07ff135eea 更新日志类型 2025-05-22 16:13:29 +08:00
zhongqiang
eeed182985 增加日志类型 2025-05-22 15:43:14 +08:00
yuguojian
d233f3a1a3 更新日志类型 2025-05-19 14:57:31 +08:00
yuguojian
6bf054e1e8 更新日志类型命名 2025-05-16 15:27:20 +08:00
yuguojian
a48afa14b7 调整日志操作人类型命名 2025-05-15 10:52:58 +08:00
yuguojian
3b335785a4 增加日志方法 2025-05-14 09:49:39 +08:00
yuguojian
d311a8368a 增加日志方法 2025-05-13 00:38:39 +08:00
yuguojian
7b077e25b4 更新日志类型 2025-05-12 23:53:31 +08:00
zhongqiang
72127fecd7 add GiveRedPacketTask 2025-05-09 11:51:09 +08:00
lzh
2841d52187 添加生成优惠券消息队列 2025-05-09 10:57:09 +08:00
yuguojian
ffb9dd6112 更新日志 2025-05-08 23:28:24 +08:00
yuguojian
b8bd72806f 更新日志 2025-05-08 23:03:08 +08:00
yuguojian
2b080ef98e 更新日志 2025-05-08 18:07:25 +08:00
yuguojian
52c21d0814 更新日志 2025-05-08 18:07:13 +08:00
yuguojian
1915dc0a2a 更新日志 2025-05-08 16:40:03 +08:00
yuguojian
f8ebbff9d8 更新日志 2025-05-08 14:39:42 +08:00
yuguojian
559e79c5a8 增加日志公共结构体 2025-05-08 00:54:13 +08:00
吕翠丽
88bd5f740d feature/增加关闭类型 2025-05-07 10:07:09 +08:00
吕翠丽
12617dbaf7 feature/合利宝结算状态查询 2025-04-19 17:05:56 +08:00
7d54fbd31d Merge pull request 'feature/增加线下支付创建失败类型' (#2) from feature/增加线下支付创建失败类型 into master
Reviewed-on: #2
2025-03-14 14:29:10 +08:00
吕翠丽
f845aee1de feature/增加线下支付创建失败类型 2025-03-14 14:23:25 +08:00
1412fc67be Merge pull request '添加支付结构体' (#1) from feature/添加支付结构体 into master
Reviewed-on: #1
2025-03-11 16:41:22 +08:00
吕翠丽
c25a65488e 添加支付结构体 2025-03-11 16:39:01 +08:00
yuguojian
dd74c1b5c6 调整包头 2025-01-15 17:41:07 +08:00
yuguojian
959cb87ee2 调整包头 2025-01-15 17:19:18 +08:00
yuguojian
c1d08db044 Merge remote-tracking branch 'origin/fix/添加退款关单类型'
# Conflicts:
#	rabbitmq_order.go
2025-01-15 16:40:25 +08:00
吕翠丽
9edec35425 提交完整订单关闭类型 2025-01-15 16:37:56 +08:00
yuguojian
7c6e1ba3a8 更新日志信息 2025-01-14 15:10:34 +08:00
yuguojian
91324cd225 更换仓库 2025-01-13 17:09:05 +08:00
yuguojian
92e71475d3 增加参数兼容 2025-01-07 15:15:06 +08:00
LiHouse
48b3206053 第三方订单下单失败关单 2025-01-07 15:13:41 +08:00
吕翠丽
981dd3b98d 增加发货超时取消订单结构体 2024-12-26 16:19:05 +08:00
88dd6fbdf5 增加红包回退结构体 2024-12-17 15:16:52 +08:00
yuguojian
e0f73fc058 增加参数兼容 2024-12-12 14:59:13 +08:00
yuguojian
88ff5825ea 增加日志,修改命名 2024-12-11 18:53:32 +08:00
yuguojian
7b557072f3 订单减库存选项,下单时,发货时 2024-12-09 15:54:49 +08:00
yuguojian
8d6f2b31f2 订单发货通知修改商品id为订单商品id 2024-12-09 15:27:41 +08:00
余国健
777f826a32 增加减库存类型 2024-12-08 22:31:37 +08:00
余国健
3d8b82f0fd 增加关闭订单类型,增加增加商品销量类型 2024-12-08 01:51:41 +08:00
余国健
de3277c085 更新订单发送结构体 2024-12-07 21:57:37 +08:00
余国健
bf2a135f00 增加两个订单结构体 2024-12-07 00:00:27 +08:00
13 changed files with 342 additions and 155 deletions

View File

@ -1,36 +0,0 @@
# rabbitMQ公共结构体
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,39 +1,19 @@
# rabbitMQ公共结构体
#### 介绍
{**以下是 Gitee 平台说明,您可以替换此简介**
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
## window开发者执行
```bash
git config --global core.autocrlf true # 提交时转 CRLF 为 LF检出时转 LF 为 CRLF
```
#### 软件架构
软件架构说明
## mac开发者执行
```bash
git config --global core.autocrlf input # 提交时转 CRLF 为 LF检出时不转换
```
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
## 格式化
```bash
gofumpt -l -w .
```
```bash
go install mvdan.cc/gofumpt@latest
```

10
go.mod
View File

@ -1,3 +1,11 @@
module gitee.com/shenzhen-jinhuatai-network/rabbitmq_common_structure
module git.ssgfgtfy.com/public/common_structure
go 1.18.0
require (
github.com/dromara/carbon/v2 v2.6.4
go.uber.org/zap v1.27.0
github.com/gogf/gf/v2 v2.7.2
)
require go.uber.org/multierr v1.10.0 // indirect

12
go.sum Normal file
View File

@ -0,0 +1,12 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/dromara/carbon/v2 v2.6.4 h1:cpIansyiEIEed3OlEIqo1IXj86qu0x6pf/E2keL2wYo=
github.com/dromara/carbon/v2 v2.6.4/go.mod h1:Baj3A1uBBctJmpZWJd6/+WWnmIuY2pobR6IOpB6xigc=
github.com/gogf/gf/v2 v2.7.2/go.mod h1:EBXneAg/wes86rfeh68XC0a2JBNQylmT7Sp6/8Axk88=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

141
log/log.go Normal file
View File

@ -0,0 +1,141 @@
package log
import (
"context"
"fmt"
"github.com/dromara/carbon/v2"
"github.com/gogf/gf/v2/frame/g"
"go.uber.org/zap"
)
type LogType = string
const (
LogTypeOrder LogType = "order" // 订单
LogTypeProduct LogType = "product" // 商品
LogTypeMerchant LogType = "merchant" // 商家
LogTypeMerchantRedPack LogType = "merchant_red_pack" // 商家红包
LogTypePay LogType = "pay" // 支付
LogTypeUser LogType = "user" // 用户
LogTypeUserRedPack LogType = "user_red_pack" // 用户红包
LogTypeGPS LogType = "gps" // gps
LogTypeSMS LogType = "sms" // 短信
LogTypeIP LogType = "ip" // ip信息
LogTypeAdmin LogType = "admin" // 管理员操作,例如登录、退出、修改密码、修改用户信息、修改角色信息、审核等
LogTypeSystem LogType = "system" // 系统、日志、定时任务初始化、定时任务、mq初始化等
LogTypeSystemRedPack LogType = "system_red_pack" // 系统红包
LogTypeActivity LogType = "activity" // 活动
LogTypeJJT LogType = "jjt" // 交易所
)
type LogInfo struct {
LogType LogType `json:"log_type"` // 日志类型,按被操作对象划分
Operator *Operator `json:"operator,omitempty"` // 操作人,系统操作不用填写操作人,写日志类型就可以
ObjectorID int `json:"objector_id,omitempty"` // 被操作对象ID如果是gps短信等服务则为0
Title string `json:"title"` // 必填,标题,做什么事情
Param interface{} `json:"param,omitempty"` // 参数,请求参数,传指针
Result interface{} `json:"result,omitempty"` // 结果返回值传指针如果是报错传err
ErrStr string `json:"err_str,omitempty"` // 错误信息,不用传入,自动记录
At string `json:"at"` // 记录时间,不用传入,自动记录
}
type OperatorType = string
const (
OperatorTypeAdmin OperatorType = "admin" // 管理员
OperatorTypeMerchant OperatorType = "merchant" // 商家
OperatorTypeUser OperatorType = "user" // 用户
)
type Operator struct {
ID int // 系统ID设置0
OperatorType OperatorType
}
func ZapDebug(logger *zap.Logger, log *LogInfo) {
handleLog(log)
logger.Debug("", zap.Any("log", log))
}
func ZapInfo(logger *zap.Logger, log *LogInfo) {
handleLog(log)
logger.Info("", zap.Any("log", log))
}
func ZapWarn(logger *zap.Logger, log *LogInfo) {
handleLog(log)
logger.Warn("", zap.Any("log", log))
}
func ZapError(logger *zap.Logger, log *LogInfo) {
handleLog(log)
logger.Error("", zap.Any("log", log))
}
func ZapPanic(logger *zap.Logger, log *LogInfo) {
handleLog(log)
logger.Panic("", zap.Any("log", log))
}
func ZapFatal(logger *zap.Logger, log *LogInfo) {
handleLog(log)
logger.Fatal("", zap.Any("log", log))
}
func handleLog(log *LogInfo) {
log.At = carbon.Now().ToDateTimeString()
if _, ok := log.Result.(error); ok {
log.ErrStr = fmt.Sprintf("%+v", log.Result)
log.Result = nil
}
}
func GFInfo(ctx context.Context, log *LogInfo) {
handleLog(log)
g.Log().Info(ctx, log)
}
func GFWarning(ctx context.Context, log *LogInfo) {
handleLog(log)
g.Log().Warning(ctx, log)
}
func GFError(ctx context.Context, log *LogInfo) {
handleLog(log)
g.Log().Error(ctx, log)
}
func GFDebug(ctx context.Context, log *LogInfo) {
handleLog(log)
g.Log().Debug(ctx, log)
}
func GFPanic(ctx context.Context, log *LogInfo) {
handleLog(log)
g.Log().Panic(ctx, log)
}
func GFFatal(ctx context.Context, log *LogInfo) {
handleLog(log)
g.Log().Fatal(ctx, log)
}
func (l *LogInfo) GFCommonHandelResult(ctx context.Context, result interface{}, err error) {
if err != nil {
l.Result = err
GFError(ctx, l)
} else {
l.Result = result
GFInfo(ctx, l)
}
}
func (l *LogInfo) ZapCommonHandelResult(logger *zap.Logger, result interface{}, err error) {
if err != nil {
l.Result = err
ZapError(logger, l)
} else {
l.Result = result
ZapInfo(logger, l)
}
}

View File

@ -1,53 +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 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
}

View File

@ -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 ProductsChangeStock 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
}

5
rabbitmq_coupon.go Normal file
View File

@ -0,0 +1,5 @@
package common_structure
type CouponCode struct {
ID uint `json:"id"` // 优惠券ID
}

87
rabbitmq_order.go Normal file
View File

@ -0,0 +1,87 @@
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 // 发货超时关闭
OrderCloseTypePaymentFailed OrderCloseType = 80 // 创建支付失败
OrderCloseTypeAbandonPayment OrderCloseType = 90 // 放弃支付
)
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
}

15
rabbitmq_pay.go Normal file
View File

@ -0,0 +1,15 @@
package common_structure
type PayNotify struct {
PayID uint `json:"pay_id"` // 支付ID
PayNo string `json:"pay_no"` // 支付单号
RemainExecNum int `json:"num"` // 剩余执行次数
RemainRepeatNum int `json:"repeat_num"` // 剩余重复执行次数
}
type HelibaoSettlementQuery struct {
ID uint `json:"id"` // 提现ID
WithdrawNo string `json:"withdraw_no"` // 提现单号
RemainExecNum int `json:"num"` // 剩余执行次数
RemainRepeatNum int `json:"repeat_num"` // 剩余重复执行次数
}

48
rabbitmq_product.go Normal file
View 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
}

5
rabbitmq_red_packet.go Normal file
View File

@ -0,0 +1,5 @@
package common_structure
type GiveRedPacketTask struct {
TaskID uint `json:"task_id"` // 任务ID
}

5
rabbitmq_user.go Normal file
View File

@ -0,0 +1,5 @@
package common_structure
type UserLogout struct {
UserID uint `json:"user_id"`
}