feat: add type field for api key

This commit is contained in:
RockYang
2023-11-24 18:05:59 +08:00
parent d68f2ef12c
commit a2c7a75705
6 changed files with 24 additions and 4 deletions

View File

@@ -63,7 +63,8 @@ func (e *XXLJobExecutor) ClearOrders(cxt context.Context, param *xxl.RunReq) (ms
}
timeout := time.Now().Unix() - int64(config.OrderPayTimeout)
start := utils.Stamp2str(timeout)
res = e.db.Where("status != ? AND created_at < ?", types.OrderPaidSuccess, start).Delete(&model.Order{})
// 这里不是用软删除,而是永久删除订单
res = e.db.Unscoped().Where("status != ? AND created_at < ?", types.OrderPaidSuccess, start).Delete(&model.Order{})
return fmt.Sprintf("Clear order successfully, affect rows: %d", res.RowsAffected)
}

View File

@@ -4,6 +4,7 @@ package model
type ApiKey struct {
BaseModel
Platform string
Type string // 用途 chat => 聊天img => 绘图
Value string // API Key 的值
LastUsedAt int64 // 最后使用时间
}

View File

@@ -4,6 +4,7 @@ package vo
type ApiKey struct {
BaseVo
Platform string `json:"platform"`
Type string `json:"type"`
Value string `json:"value"` // API Key 的值
LastUsedAt int64 `json:"last_used_at"` // 最后使用时间
}