email reward
This commit is contained in:
@@ -3,6 +3,7 @@ package model
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/zeromicro/go-zero/core/stores/cache"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
"nova_task/internal/consts"
|
||||
@@ -18,6 +19,8 @@ type (
|
||||
nhSystemConfigModel
|
||||
GetNftStakeTaskOpenDate(ctx context.Context) (start, end time.Time, err error)
|
||||
GetNftStakeTaskConf(ctx context.Context) (conf NftStakeTaskConf, err error)
|
||||
GetCarvApiKey(ctx context.Context) (apiKey string, err error)
|
||||
GetAdminSecret(ctx context.Context) (secret string, err error)
|
||||
}
|
||||
|
||||
customNhSystemConfigModel struct {
|
||||
@@ -25,6 +28,28 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func (m *customNhSystemConfigModel) GetAdminSecret(ctx context.Context) (secret string, err error) {
|
||||
cf, err := m.FindOneByName(ctx, consts.CarvApiKey)
|
||||
if err != nil {
|
||||
if !errors.Is(err, sqlx.ErrNotFound) {
|
||||
return "", err
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
return cf.Value, nil
|
||||
}
|
||||
|
||||
func (m *customNhSystemConfigModel) GetCarvApiKey(ctx context.Context) (string, error) {
|
||||
cf, err := m.FindOneByName(ctx, consts.CarvApiKey)
|
||||
if err != nil {
|
||||
if !errors.Is(err, sqlx.ErrNotFound) {
|
||||
return "", err
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
return cf.Value, nil
|
||||
}
|
||||
|
||||
// NewNhSystemConfigModel returns a model for the database table.
|
||||
func NewNhSystemConfigModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) NhSystemConfigModel {
|
||||
return &customNhSystemConfigModel{
|
||||
|
||||
Reference in New Issue
Block a user