This commit is contained in:
2026-01-19 21:10:35 +08:00
parent c868422a1d
commit a8ec1a5aa1
29 changed files with 247 additions and 282 deletions

View File

@@ -1,17 +1,17 @@
package agent
import (
"bdqr-server/app/main/model"
"bdqr-server/common/ctxdata"
"bdqr-server/common/globalkey"
"bdqr-server/common/xerr"
"bdqr-server/pkg/lzkit/crypto"
"context"
"database/sql"
"fmt"
"os"
"strconv"
"time"
"bdqr-server/app/main/model"
"bdqr-server/common/ctxdata"
"bdqr-server/common/globalkey"
"bdqr-server/common/xerr"
"bdqr-server/pkg/lzkit/crypto"
"github.com/google/uuid"
"github.com/pkg/errors"
@@ -241,12 +241,12 @@ func (l *ApplyForAgentLogic) ApplyForAgent(req *types.AgentApplyReq) (resp *type
// 4.8 更新邀请码状态
// 钻石级别的邀请码只能使用一次,使用后立即失效
// 普通级别的邀请码可以无限使用,不更新状态
// 白银级别的邀请码可以无限使用,不更新状态
if targetLevel == 3 {
// 钻石邀请码:使用后失效
inviteCodeModel.Status = 1 // 已使用(使用后立即失效)
}
// 记录使用信息(用于统计,普通邀请码可以多次使用)
// 记录使用信息(用于统计,白银邀请码可以多次使用)
inviteCodeModel.UsedUserId = sql.NullString{String: userID, Valid: true}
if inviteCodeModel != nil {
inviteCodeModel.UsedAgentId = sql.NullString{String: newAgent.Id, Valid: true}