35 lines
1.0 KiB
Go
35 lines
1.0 KiB
Go
package controller
|
|
|
|
import (
|
|
"context"
|
|
|
|
v1 "tool-api/api/user/v1"
|
|
"tool-api/internal/logic"
|
|
)
|
|
|
|
// cQuota 工具额度与次数包(需登录)
|
|
type cQuota struct{}
|
|
|
|
// Quota 额度相关控制器,绑定在用户鉴权分组下
|
|
var Quota = &cQuota{}
|
|
|
|
func (c *cQuota) QuotaMy(ctx context.Context, req *v1.QuotaMyReq) (res *v1.QuotaMyRes, err error) {
|
|
return logic.QuotaMy(ctx)
|
|
}
|
|
|
|
func (c *cQuota) QuotaTool(ctx context.Context, req *v1.QuotaToolReq) (res *v1.QuotaToolRes, err error) {
|
|
return logic.QuotaToolOf(ctx, req.ToolKey)
|
|
}
|
|
|
|
func (c *cQuota) QuotaConsume(ctx context.Context, req *v1.QuotaConsumeReq) (res *v1.QuotaConsumeRes, err error) {
|
|
return logic.QuotaConsume(ctx, req.ToolKey)
|
|
}
|
|
|
|
func (c *cQuota) QuotaPacks(ctx context.Context, req *v1.QuotaPacksReq) (res *v1.QuotaPacksRes, err error) {
|
|
return logic.QuotaPacksFor(ctx, req.ToolKey)
|
|
}
|
|
|
|
func (c *cQuota) QuotaOrderCreate(ctx context.Context, req *v1.QuotaOrderCreateReq) (res *v1.QuotaOrderCreateRes, err error) {
|
|
return logic.QuotaOrderCreate(ctx, req.PackKey, req.ToolKey, req.Code)
|
|
}
|