二测质押用户奖励

This commit is contained in:
lianghuanjie
2025-01-10 11:34:52 +08:00
parent 84d23a295d
commit a6efc2236a
8 changed files with 100 additions and 20 deletions

View File

@@ -18,10 +18,16 @@ Log:
Auth: # js-sdk鉴权相关配置 Auth: # js-sdk鉴权相关配置
AccessSecret: "Mj2G%szYe&$MP@ytNv8JktQN1n5^cPq%" # 鉴权token密钥 AccessSecret: "Mj2G%szYe&$MP@ytNv8JktQN1n5^cPq%" # 鉴权token密钥
#MySql: # mysql相关配置
# Addr: "192.168.20.101:3306" # mysql地址
# User: "huangjie" # mysql用户
# Password: "jMDqPQM^a6hsAR" # mysql密码
# Database: "nova_home" # 数据库名
MySql: # mysql相关配置 MySql: # mysql相关配置
Addr: "192.168.20.101:3306" # mysql地址 Addr: "127.0.0.1:3306" # mysql地址
User: "huangjie" # mysql用户 User: "root" # mysql用户
Password: "jMDqPQM^a6hsAR" # mysql密码 Password: "123456" # mysql密码
Database: "nova_home" # 数据库名 Database: "nova_home" # 数据库名
Redis: Redis:

View File

@@ -2,6 +2,9 @@ package consts
const ( const (
EarnAllianceInviterId = "earn_alliance_inviter_id" EarnAllianceInviterId = "earn_alliance_inviter_id"
CarvIoInviterId = "carv_io_inviter_id"
KgenIoInviterId = "kgen_io_inviter_id"
Game7IoInviterId = "game7_io_inviter_id"
DailyPayConf = "daily_pay_conf" DailyPayConf = "daily_pay_conf"
NftStakeTaskDate = "nft_stake_task_date" NftStakeTaskDate = "nft_stake_task_date"
NftStakeTaskConf = "nft_stake_task_conf" NftStakeTaskConf = "nft_stake_task_conf"

View File

@@ -33,7 +33,7 @@ func (l *BindWalletLogic) BindWallet(req *types.EmailKey) *types.CarvResult {
return errResult return errResult
} }
_, err := l.svcCtx.WalletModel.FindAddressByUid(l.ctx, uid) pb, err := l.svcCtx.PromoteBindModel.FindOneByInvitedUid(l.ctx, uid)
if err != nil { if err != nil {
if !errors.Is(err, model.ErrNotFound) { if !errors.Is(err, model.ErrNotFound) {
return &types.CarvResult{ return &types.CarvResult{
@@ -47,6 +47,15 @@ func (l *BindWalletLogic) BindWallet(req *types.EmailKey) *types.CarvResult {
Result: &types.Result{IsValid: false}, Result: &types.Result{IsValid: false},
} }
} }
shareId := l.svcCtx.ConfigModel.GetCarvIoInviterId(l.ctx)
if pb.ShareUid != shareId || pb.IsBindWallet == 0 {
return &types.CarvResult{
Result: &types.Result{IsValid: false},
}
}
return &types.CarvResult{ return &types.CarvResult{
Result: &types.Result{IsValid: true}, Result: &types.Result{IsValid: true},
} }

View File

@@ -45,10 +45,11 @@ func (l *DownloadAndBindRoleLogic) DownloadAndBindRole(req *types.EmailKey) *typ
}} }}
} }
if pb.IsCreateRole == 0 { shareId := l.svcCtx.ConfigModel.GetCarvIoInviterId(l.ctx)
return &types.CarvResult{Result: &types.Result{ if pb.ShareUid != shareId || pb.IsCreateRole == 0 {
IsValid: false, return &types.CarvResult{
}} Result: &types.Result{IsValid: false},
}
} }
return &types.CarvResult{ return &types.CarvResult{

View File

@@ -32,6 +32,30 @@ func (l *UnlockChapterLogic) UnlockChapter(req *types.UnlockChapterReq) *types.C
if errResult != nil { if errResult != nil {
return errResult return errResult
} }
pb, err := l.svcCtx.PromoteBindModel.FindOneByInvitedUid(l.ctx, uid)
if err != nil {
if !errors.Is(err, model.ErrNotFound) {
return &types.CarvResult{
Error: &types.Error{
Code: int(errs.ErrDatabaseOperate),
Message: "system error",
},
}
}
return &types.CarvResult{
Result: &types.Result{IsValid: false},
}
}
shareId := l.svcCtx.ConfigModel.GetCarvIoInviterId(l.ctx)
if pb.ShareUid != shareId {
return &types.CarvResult{
Result: &types.Result{IsValid: false},
}
}
gp, err := l.svcCtx.GameReportModel.FindOneByUid(l.ctx, uid) gp, err := l.svcCtx.GameReportModel.FindOneByUid(l.ctx, uid)
if err != nil { if err != nil {
if !errors.Is(err, model.ErrNotFound) { if !errors.Is(err, model.ErrNotFound) {

View File

@@ -35,6 +35,29 @@ func (l *WalletCheckInLogic) WalletCheckIn(req *types.EmailKey) *types.CarvResul
return errResult return errResult
} }
pb, err := l.svcCtx.PromoteBindModel.FindOneByInvitedUid(l.ctx, uid)
if err != nil {
if !errors.Is(err, model.ErrNotFound) {
return &types.CarvResult{
Error: &types.Error{
Code: int(errs.ErrDatabaseOperate),
Message: "system error",
},
}
}
return &types.CarvResult{
Result: &types.Result{IsValid: false},
}
}
shareId := l.svcCtx.ConfigModel.GetCarvIoInviterId(l.ctx)
if pb.ShareUid != shareId {
return &types.CarvResult{
Result: &types.Result{IsValid: false},
}
}
task, err := l.svcCtx.TaskModel.FindDailyPayTask(l.ctx) task, err := l.svcCtx.TaskModel.FindDailyPayTask(l.ctx)
if err != nil { if err != nil {
if !errors.Is(err, model.ErrNotFound) { if !errors.Is(err, model.ErrNotFound) {

View File

@@ -79,18 +79,18 @@ func (l *StakeSettleLogic) StakeSettle() {
} }
// 二测质押未提取的用户 // 二测质押未提取的用户
//oldStakeNfts, err := l.svcCtx.OldStakeNftModel.AllStakeNft(l.ctx) oldStakeNfts, err := l.svcCtx.OldStakeNftModel.AllStakeNft(l.ctx)
//if err != nil { if err != nil {
// logx.Errorw("get all stake nft failed", logx.Field("err", err)) logx.Errorw("get all stake nft failed", logx.Field("err", err))
//} else { } else {
// for _, s := range oldStakeNfts { for _, s := range oldStakeNfts {
// if utils.IsBigTarot(cast.ToString(s.TokenId)) { if utils.IsBigTarot(cast.ToString(s.TokenId)) {
// uid2tokens[s.UserId] += float64(taskConf.GreatTarot) uid2tokens[s.UserId] += float64(taskConf.GreatTarot)
// } else { } else {
// uid2tokens[s.UserId] += float64(taskConf.LittleTarot) uid2tokens[s.UserId] += float64(taskConf.LittleTarot)
// } }
// } }
//} }
awardSeq := cast.ToInt(time.Now().AddDate(0, 0, -1).Format("20060102")) awardSeq := cast.ToInt(time.Now().AddDate(0, 0, -1).Format("20060102"))
for uid, tokens := range uid2tokens { for uid, tokens := range uid2tokens {

View File

@@ -4,6 +4,8 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"errors" "errors"
"github.com/spf13/cast"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/core/stores/cache" "github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/core/stores/sqlx" "github.com/zeromicro/go-zero/core/stores/sqlx"
"nova_task/internal/consts" "nova_task/internal/consts"
@@ -21,6 +23,7 @@ type (
GetNftStakeTaskConf(ctx context.Context) (conf NftStakeTaskConf, err error) GetNftStakeTaskConf(ctx context.Context) (conf NftStakeTaskConf, err error)
GetCarvApiKey(ctx context.Context) (apiKey string, err error) GetCarvApiKey(ctx context.Context) (apiKey string, err error)
GetAdminSecret(ctx context.Context) (secret string, err error) GetAdminSecret(ctx context.Context) (secret string, err error)
GetCarvIoInviterId(ctx context.Context) uint
} }
customNhSystemConfigModel struct { customNhSystemConfigModel struct {
@@ -28,6 +31,17 @@ type (
} }
) )
func (m *customNhSystemConfigModel) GetCarvIoInviterId(ctx context.Context) uint {
cf, err := m.FindOneByName(ctx, consts.AdminSecret)
if err != nil {
if !errors.Is(err, sqlx.ErrNotFound) {
logx.Errorw("GetCarvIoInviterId error", logx.Field("err", err))
}
return 0
}
return cast.ToUint(cf.Value)
}
func (m *customNhSystemConfigModel) GetAdminSecret(ctx context.Context) (secret string, err error) { func (m *customNhSystemConfigModel) GetAdminSecret(ctx context.Context) (secret string, err error) {
cf, err := m.FindOneByName(ctx, consts.AdminSecret) cf, err := m.FindOneByName(ctx, consts.AdminSecret)
if err != nil { if err != nil {