下架白名单补充支付回调删除数据以及后台运维补充删除

This commit is contained in:
2026-03-16 14:37:35 +08:00
parent a63e4a9dbb
commit 0b87a39c41
10 changed files with 142 additions and 21 deletions

View File

@@ -66,6 +66,7 @@ type (
Version int64 `db:"version"` // 版本号(乐观锁)
OrderNo string `db:"order_no"` // 订单号(唯一)
UserId string `db:"user_id"` // 用户ID代理的user_id
OrderId sql.NullString `db:"order_id"` // 关联的查询订单IDQuery 表对应的订单ID一般为 order.id
IdCard string `db:"id_card"` // 身份证号(查询对象标识)
TotalAmount float64 `db:"total_amount"` // 总金额(单位:元)
Status int64 `db:"status"` // 订单状态1=待支付2=已支付3=已取消
@@ -89,11 +90,11 @@ func (m *defaultWhitelistOrderModel) Insert(ctx context.Context, session sqlx.Se
yccWhitelistOrderIdKey := fmt.Sprintf("%s%v", cacheYccWhitelistOrderIdPrefix, data.Id)
yccWhitelistOrderOrderNoKey := fmt.Sprintf("%s%v", cacheYccWhitelistOrderOrderNoPrefix, data.OrderNo)
return m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, whitelistOrderRowsExpectAutoSet)
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, whitelistOrderRowsExpectAutoSet)
if session != nil {
return session.ExecCtx(ctx, query, data.Id, data.DeleteTime, data.DelState, data.Version, data.OrderNo, data.UserId, data.IdCard, data.TotalAmount, data.Status, data.PaymentMethod, data.PaymentPlatform, data.PlatformOrderId, data.PayTime)
return session.ExecCtx(ctx, query, data.Id, data.DeleteTime, data.DelState, data.Version, data.OrderNo, data.UserId, data.OrderId, data.IdCard, data.TotalAmount, data.Status, data.PaymentMethod, data.PaymentPlatform, data.PlatformOrderId, data.PayTime)
}
return conn.ExecCtx(ctx, query, data.Id, data.DeleteTime, data.DelState, data.Version, data.OrderNo, data.UserId, data.IdCard, data.TotalAmount, data.Status, data.PaymentMethod, data.PaymentPlatform, data.PlatformOrderId, data.PayTime)
return conn.ExecCtx(ctx, query, data.Id, data.DeleteTime, data.DelState, data.Version, data.OrderNo, data.UserId, data.OrderId, data.IdCard, data.TotalAmount, data.Status, data.PaymentMethod, data.PaymentPlatform, data.PlatformOrderId, data.PayTime)
}, yccWhitelistOrderIdKey, yccWhitelistOrderOrderNoKey)
}
func (m *defaultWhitelistOrderModel) insertUUID(data *WhitelistOrder) {
@@ -160,9 +161,9 @@ func (m *defaultWhitelistOrderModel) Update(ctx context.Context, session sqlx.Se
return m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, whitelistOrderRowsWithPlaceHolder)
if session != nil {
return session.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.OrderNo, newData.UserId, newData.IdCard, newData.TotalAmount, newData.Status, newData.PaymentMethod, newData.PaymentPlatform, newData.PlatformOrderId, newData.PayTime, newData.Id)
return session.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.OrderNo, newData.UserId, newData.OrderId, newData.IdCard, newData.TotalAmount, newData.Status, newData.PaymentMethod, newData.PaymentPlatform, newData.PlatformOrderId, newData.PayTime, newData.Id)
}
return conn.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.OrderNo, newData.UserId, newData.IdCard, newData.TotalAmount, newData.Status, newData.PaymentMethod, newData.PaymentPlatform, newData.PlatformOrderId, newData.PayTime, newData.Id)
return conn.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.OrderNo, newData.UserId, newData.OrderId, newData.IdCard, newData.TotalAmount, newData.Status, newData.PaymentMethod, newData.PaymentPlatform, newData.PlatformOrderId, newData.PayTime, newData.Id)
}, yccWhitelistOrderIdKey, yccWhitelistOrderOrderNoKey)
}
@@ -183,9 +184,9 @@ func (m *defaultWhitelistOrderModel) UpdateWithVersion(ctx context.Context, sess
sqlResult, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
query := fmt.Sprintf("update %s set %s where `id` = ? and version = ? ", m.table, whitelistOrderRowsWithPlaceHolder)
if session != nil {
return session.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.OrderNo, newData.UserId, newData.IdCard, newData.TotalAmount, newData.Status, newData.PaymentMethod, newData.PaymentPlatform, newData.PlatformOrderId, newData.PayTime, newData.Id, oldVersion)
return session.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.OrderNo, newData.UserId, newData.OrderId, newData.IdCard, newData.TotalAmount, newData.Status, newData.PaymentMethod, newData.PaymentPlatform, newData.PlatformOrderId, newData.PayTime, newData.Id, oldVersion)
}
return conn.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.OrderNo, newData.UserId, newData.IdCard, newData.TotalAmount, newData.Status, newData.PaymentMethod, newData.PaymentPlatform, newData.PlatformOrderId, newData.PayTime, newData.Id, oldVersion)
return conn.ExecCtx(ctx, query, newData.DeleteTime, newData.DelState, newData.Version, newData.OrderNo, newData.UserId, newData.OrderId, newData.IdCard, newData.TotalAmount, newData.Status, newData.PaymentMethod, newData.PaymentPlatform, newData.PlatformOrderId, newData.PayTime, newData.Id, oldVersion)
}, yccWhitelistOrderIdKey, yccWhitelistOrderOrderNoKey)
if err != nil {
return err