Files
kami_backend/internal/dao/internal/v_1_camel_oil_token.go
danial 3588bf9af6 feat(camel_oil): 支持Token管理与卡密绑定功能
- 新增CamelOilToken和CamelOilCardBinding数据库表,实现Token及卡密绑定记录管理
- 在service层增加Token的创建、查询、更新、删除及分页功能
- 实现卡密与Token绑定的业务逻辑,支持基于Token的卡密管理
- 在API层新增Token和卡密绑定相关接口:创建Token、获取Token详情、删除Token、列出Token及根据Token查询绑定卡密
- camel_oil_api新增绑卡接口,支持绑卡状态分类及错误处理
- 在定时任务中增加卡密绑定任务,实现自动处理已支付订单的卡密绑定
- 优化订单提交及支付流程,包含日志调整和请求参数随机扰动
- 统一调整camel_oil模块多控制器实现,完成账号状态查询及订单相关接口实现
- 注册更多camel_oil定时任务,包括订单支付检查、账号日重置和待回调订单处理任务
2025-11-23 00:08:35 +08:00

104 lines
3.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// V1CamelOilTokenDao is the data access object for the table camel_oil_token.
type V1CamelOilTokenDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns V1CamelOilTokenColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
}
// V1CamelOilTokenColumns defines and stores column names for the table camel_oil_token.
type V1CamelOilTokenColumns struct {
Id string // 主键ID
TokenName string // Token名称/标识
TokenValue string // Token具体值
Phone string // 绑定的手机号
Status string // 状态1可用 2已禁用 3已过期
BindCount string // 已绑定卡密数量
TotalBindAmount string // 累计绑定金额
LastBindAt string // 最后绑定时间
LastUsedAt string // 最后使用时间
Remark string // 备注
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 删除时间(软删除)
}
// v1CamelOilTokenColumns holds the columns for the table camel_oil_token.
var v1CamelOilTokenColumns = V1CamelOilTokenColumns{
Id: "id",
TokenName: "token_name",
TokenValue: "token_value",
Phone: "phone",
Status: "status",
BindCount: "bind_count",
TotalBindAmount: "total_bind_amount",
LastBindAt: "last_bind_at",
LastUsedAt: "last_used_at",
Remark: "remark",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewV1CamelOilTokenDao creates and returns a new DAO object for table data access.
func NewV1CamelOilTokenDao(handlers ...gdb.ModelHandler) *V1CamelOilTokenDao {
return &V1CamelOilTokenDao{
group: "default",
table: "camel_oil_token",
columns: v1CamelOilTokenColumns,
handlers: handlers,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *V1CamelOilTokenDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *V1CamelOilTokenDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *V1CamelOilTokenDao) Columns() V1CamelOilTokenColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *V1CamelOilTokenDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *V1CamelOilTokenDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *V1CamelOilTokenDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}