MCPcopy Create free account

hub / github.com/TGlimmer/TG_walletbot / functions

Functions2,200 in github.com/TGlimmer/TG_walletbot

↓ 866 callersMethodError
Error 实现 error 接口
pkg/errors/errors.go:17
↓ 173 callersMethodSet
Set 设置缓存值
internal/domain/port/cache.go:13
↓ 151 callersMethodRow
Row 添加一行按钮
pkg/telegram/keyboard.go:16
↓ 144 callersMethodGet
Get 获取缓存值
internal/domain/port/cache.go:11
↓ 101 callersFunctionsetupTestRouter
--- 测试辅助 ---
internal/adapter/handler/admin_auth_test.go:24
↓ 92 callersFunctiontestLogger
()
internal/adapter/handler/admin_auth_test.go:29
↓ 87 callersMethodBuild
Build 构建内联键盘
pkg/telegram/keyboard.go:22
↓ 67 callersFunctionnewMockAdminUseCase
newMockAdminUseCase 创建默认空实现的 mock
internal/adapter/handler/mock_test.go:61
↓ 67 callersMethodtoAdminUseCase
toAdminUseCase 构建真实 *app.AdminUseCase,底层 repo 委托给 mock 函数
internal/adapter/handler/mock_test.go:66
↓ 63 callersMethodClear
Clear 清除用户会话
pkg/telegram/session.go:126
↓ 62 callersMethodCreate
Create 创建用户
internal/domain/port/repository.go:16
↓ 55 callersMethodGetDataString
GetDataString 获取临时数据为字符串
pkg/telegram/session.go:95
↓ 49 callersFunctionnewTestRedPacketService
newTestRedPacketService 创建测试用的 RedPacketService 及其 mock 依赖 注意: db 传 nil,只测试不依赖事务的方法
internal/domain/service/redpacket_service_test.go:20
↓ 41 callersMethodUpdate
Update 更新用户信息
internal/domain/port/repository.go:24
↓ 41 callersFunctionnewTestAdminUseCase
newTestAdminUseCase 创建测试用的 AdminUseCase (仅测试非 gorm.DB 直接操作的方法)
internal/app/admin_usecase_test.go:22
↓ 40 callersMethodFindByID
FindByID 根据 ID 查询用户
internal/domain/port/repository.go:18
↓ 38 callersFunctionInternalError
InternalError 返回 500 错误
pkg/response/response.go:97
↓ 36 callersFunctionnewTestMerchantService
newTestMerchantService 创建测试用的 MerchantService 及其 mock 依赖
internal/domain/service/merchant_service_test.go:17
↓ 36 callersFunctionnewTestWithdrawalService
newTestWithdrawalService 创建测试用的 WithdrawalService 及其所有 mock 依赖
internal/domain/service/withdrawal_service_test.go:17
↓ 31 callersFunctionNewDepositMonitor
NewDepositMonitor 创建充值监控服务
internal/infrastructure/tron/monitor.go:59
↓ 29 callersMethodDisplayName
DisplayName 获取显示名称 (优先 FullName, 其次 Username)
internal/domain/entity/user.go:49
↓ 29 callersFunctionnewTestUserService
newTestUserService 创建测试用的 UserService 及其所有 mock 依赖
internal/domain/service/user_service_test.go:19
↓ 28 callersFunctionNewCryptoService
NewCryptoService 创建加密服务
internal/infrastructure/tron/crypto.go:33
↓ 28 callersFunctionSuccess
Success 返回成功响应
pkg/response/response.go:27
↓ 27 callersFunctionNewKeyGenerator
NewKeyGenerator 创建地址生成器
internal/infrastructure/tron/keygen.go:20
↓ 27 callersFunctionnewMockCacheRepo
()
internal/infrastructure/tron/monitor_test.go:163
↓ 27 callersFunctionnewTestFinanceService
newTestFinanceService 创建测试用的 FinanceService 及其 mock 依赖 注意: db 传 nil,只测试不依赖事务的方法
internal/domain/service/finance_service_test.go:18
↓ 26 callersMethodClose
Close 关闭连接释放资源
internal/domain/port/blockchain.go:63
↓ 26 callersMethodGenerateAddress
GenerateAddress 生成新的 TRON 地址 流程: 生成私钥 -> 推导公钥 -> Keccak256 哈希 -> 取后 20 字节 -> 加 0x41 前缀 -> Base58Check 编码
internal/infrastructure/tron/keygen.go:26
↓ 26 callersMethodSetStepWithData
SetStepWithData 设置步骤同时写入数据
pkg/telegram/session.go:64
↓ 25 callersFunctionnewTestTransferUseCase
newTestTransferUseCase 创建测试用的 TransferUseCase 及其 mock 依赖
internal/app/transfer_usecase_test.go:19
↓ 25 callersFunctionparseJSONResponse
parseJSONResponse 解析 JSON 响应体
internal/adapter/handler/admin_auth_test.go:35
↓ 24 callersFunctionBadRequest
BadRequest 返回 400 错误
pkg/response/response.go:77
↓ 24 callersFunctionnewTestDepositService
newTestDepositService 创建测试用的 DepositService 及其所有 mock 依赖
internal/domain/service/deposit_service_test.go:17
↓ 23 callersFunctionGenerateToken
GenerateToken 生成 JWT Token
internal/adapter/middleware/jwt.go:23
↓ 23 callersMethodOffset
Offset 计算数据库查询偏移量
pkg/pagination/pagination.go:26
↓ 22 callersFunctionformatAmount
( amount: string | number, currency?: string, )
web/src/utils/format.ts:9
↓ 22 callersFunctionnewTestProfileService
newTestProfileService 创建测试用的 ProfileService 及其所有 mock 依赖
internal/domain/service/profile_service_test.go:18
↓ 21 callersFunctionNewAdminUserHandler
NewAdminUserHandler 创建用户管理处理器
internal/adapter/handler/admin_user.go:24
↓ 19 callersMethodAddAddress
AddAddress 动态添加监控地址 (新用户注册时调用,避免等待缓存刷新)
internal/infrastructure/tron/monitor.go:533
↓ 19 callersFunctionNewGrpcBlockClient
NewGrpcBlockClient 创建 gRPC 区块扫描客户端 endpoint: gRPC 端点地址,空值使用默认 grpc.trongrid.io:50051 apiKey: TronGrid API Key timeout: 单次 gRPC 调用超时,传 0 使用默认 10s batch
internal/infrastructure/tron/grpc_client.go:49
↓ 19 callersFunctionformatTime
( time: string | null | undefined, format: string = 'YYYY-MM-DD HH:mm:ss', )
web/src/utils/format.ts:48
↓ 19 callersMethodisMonitoredAddress
--- 地址缓存管理 --- isMonitoredAddress 检查地址是否在监控列表中 (读操作,使用 RLock)
internal/infrastructure/tron/monitor.go:454
↓ 18 callersFunctionButton
Button 创建普通回调按钮
pkg/telegram/keyboard.go:29
↓ 18 callersMethodUpdateBalance
UpdateBalance 更新余额 (需在事务中使用)
internal/domain/port/repository.go:44
↓ 18 callersFunctionnewTestMonitor
newTestMonitor 创建用于测试的 DepositMonitor (使用 NewDepositMonitor 确保 addrCache 被初始化)
internal/infrastructure/tron/monitor_test.go:205
↓ 17 callersMethodDecryptPrivateKey
DecryptPrivateKey 解密私钥 (自动兼容新旧格式) encrypted: 密文字符串 (新格式 "scrypt:base64..." 或旧格式 "base64...") encryptionKey: 加密密钥 返回: 原始私钥 hex 字符串
internal/infrastructure/tron/crypto.go:90
↓ 17 callersMethodEncryptPrivateKey
EncryptPrivateKey 使用 scrypt KDF + AES-256-GCM 加密私钥 privateKeyHex: 原始私钥 hex 字符串 encryptionKey: 加密密钥 (任意长度,通过 scrypt 派生为 32 字节) 返回: "scrypt:" + base64(s
internal/infrastructure/tron/crypto.go:41
↓ 16 callersFunctionNewAuthHandler
NewAuthHandler 创建认证处理器
internal/adapter/handler/admin_auth.go:22
↓ 16 callersFunctiongetAdminID
getAdminID 从 context 获取管理员 ID
internal/adapter/handler/admin_auth.go:132
↓ 16 callersFunctionnewTestWalletService
newTestWalletService 创建测试用的 WalletService 及其 mock 依赖
internal/domain/service/wallet_service_test.go:16
↓ 15 callersMethodProcessDeposit
ProcessDeposit 处理充值到账 1. 检查交易是否已存在 (防重复) 2. 创建充值记录 3. 等待确认后更新余额 + 创建交易流水 返回: 充值记录, 是否为新记录, 错误
internal/domain/service/deposit_service.go:55
↓ 15 callersMethodRegisterModule
RegisterModule 注册模块处理器 module: 模块前缀 (如 "Wallet", "Transfer", "Exchange") handler: 该模块的回调处理函数
internal/adapter/telegram/router.go:34
↓ 15 callersMethodSetData
SetData 存储临时数据
pkg/telegram/session.go:81
↓ 15 callersFunctioncreateTestContext
辅助函数:创建 gin 测试上下文并返回 recorder
pkg/response/response_test.go:20
↓ 15 callersFunctionhashPIN
hashPIN 辅助函数:生成 bcrypt hash
internal/domain/service/user_service_test.go:29
↓ 14 callersMethodGetStep
GetStep 获取当前步骤
pkg/telegram/session.go:75
↓ 14 callersFunctionNewAdminMerchantHandler
NewAdminMerchantHandler 创建商户管理处理器
internal/adapter/handler/admin_merchant.go:28
↓ 14 callersMethodaddressCount
addressCount 返回当前缓存的地址数量
internal/infrastructure/tron/monitor.go:547
↓ 14 callersFunctionparsePagination
--- 通用辅助函数 --- parsePagination 解析分页参数
internal/adapter/handler/admin_user.go:217
↓ 13 callersMethodGetWalletOverview
GetWalletOverview 获取钱包主页概览数据
internal/app/user_usecase.go:171
↓ 13 callersFunctionnewTestExchangeServiceDeps
注意: ExchangeService.ExecuteExchange 使用了 gorm.DB 事务,无法直接通过 mock port 接口测试。 这里测试非事务方法: GetAllRatesDisplay, GetExchangePair, CalculateExchange newTestExc
internal/domain/service/exchange_service_test.go:23
↓ 13 callersFunctionnewTestUserUseCase
newTestUserUseCase 创建测试用的 UserUseCase 及其依赖的 mock
internal/app/user_usecase_test.go:19
↓ 13 callersFunctionnewTestWithdrawalUseCase
newTestWithdrawalUseCase 创建测试用的 WithdrawalUseCase 及其 mock 依赖
internal/app/withdrawal_usecase_test.go:19
↓ 13 callersFunctionparseIDParam
parseIDParam 解析 URL 路径中的 ID 参数
internal/adapter/handler/admin_user.go:232
↓ 13 callersFunctionparseResponse
辅助函数:从 recorder 解析 JSON 响应
pkg/response/response_test.go:28
↓ 12 callersFunctionBuildPINKeyboard
--- 键盘和显示构建 --- BuildPINKeyboard 构建 4x3 数字键盘
internal/adapter/telegram/handler/pin.go:513
↓ 12 callersFunctionNewWalletService
NewWalletService 创建钱包领域服务
internal/domain/service/wallet_service.go:19
↓ 12 callersFunctionbuildPINDisplay
buildPINDisplay 构建 PIN 输入状态显示文本 entered: 已输入的数字字符串 (如 "12") mode: "set" / "confirm" / "verify" / "change_old" / "change_new" / "change_confirm"
internal/adapter/telegram/handler/pin.go:545
↓ 12 callersFunctionnewTestAdminService
newTestAdminService 创建测试用的 AdminService 及其 mock 依赖
internal/domain/service/admin_service_test.go:19
↓ 12 callersFunctionnewTestExchangeUseCase
newTestExchangeUseCase 创建测试用的 ExchangeUseCase 及其 mock 依赖
internal/app/exchange_usecase_test.go:19
↓ 12 callersFunctionnewTestTransferServiceDeps
注意: TransferService.ExecuteTransfer 使用了 gorm.DB 事务和内部 txWalletRepo/txTransferRepo/txTransactionRepo, 无法直接通过 mock port 接口测试事务方法。 这里测试非事务方法: CreateRecei
internal/domain/service/transfer_service_test.go:23
↓ 11 callersMethodCreateAuditLog
--- 审计日志 --- CreateAuditLog 创建审计日志 (委托给 AdminService)
internal/app/admin_usecase.go:656
↓ 11 callersMethodFindByUserIDAndCurrencyForUpdate
FindByUserIDAndCurrencyForUpdate 带行锁查询钱包
internal/domain/service/transfer_service.go:254
↓ 11 callersMethodListByUserID
ListByUserID 获取用户充值列表 (分页)
internal/domain/port/repository.go:95
↓ 11 callersFunctionNewAdminExchangeRateHandler
NewAdminExchangeRateHandler 创建汇率管理处理器
internal/adapter/handler/admin_exchange_rate.go:20
↓ 11 callersFunctionNewWithdrawalSender
NewWithdrawalSender 创建提币发送器 configRepo 用于动态读取 withdraw_usdt_auto_threshold 等运营参数
internal/infrastructure/tron/sender.go:32
↓ 11 callersFunctionSuccessWithPagination
SuccessWithPagination 返回带分页的成功响应
pkg/response/response.go:45
↓ 11 callersMethodVerifyPIN
VerifyPIN 验证支付密码 返回: 验证是否通过, 剩余重试次数, 错误
internal/domain/service/user_service.go:121
↓ 10 callersMethodAdjustUserBalance
AdjustUserBalance 管理员调整用户余额 amount 为正数表示增加,负数表示扣减
internal/app/admin_usecase.go:361
↓ 10 callersFunctionErrorFromAppError
ErrorFromAppError 从 AppError 返回错误响应
pkg/response/response.go:68
↓ 10 callersMethodFindByUserIDAndCurrency
FindByUserIDAndCurrency 根据用户 ID 和币种查询钱包
internal/domain/port/repository.go:38
↓ 10 callersMethodGetBalance
GetBalance 获取用户余额
internal/app/exchange_usecase.go:136
↓ 10 callersMethodHandleTextMessage
HandleTextMessage 处理文本消息中的 PIN 输入 PIN 已改为内联键盘输入,文本输入不再处理 PIN 返回 false 表示不是 PIN 流程
internal/adapter/telegram/handler/pin.go:83
↓ 10 callersFunctionL
L 获取全局 Logger 实例
pkg/logger/logger.go:23
↓ 10 callersFunctionNewUserService
NewUserService 创建用户领域服务
internal/domain/service/user_service.go:28
↓ 10 callersMethodSendWithdrawal
SendWithdrawal 执行提币发送 返回: (txHash, isManual, error) amount <= threshold: 自动签名广播,返回 txHash amount > threshold: 返回 ("", true, nil) 表示需人工处理 阈值从 system_co
internal/infrastructure/tron/sender.go:59
↓ 10 callersFunctionnewMockConfigRepo
(data map[string]string)
internal/infrastructure/tron/sender_test.go:25
↓ 10 callersFunctionpinButton
pinButton 创建数字按钮
internal/adapter/telegram/handler/pin.go:535
↓ 10 callersFunctionsetupJWTRouter
========== JWTAuth 中间件测试 ========== setupRouter 创建带有 JWTAuth 中间件的测试路由
internal/adapter/middleware/jwt_test.go:117
↓ 10 callersFunctionsetupUSDTConfig
setupUSDTConfig 设置 USDT 提币配置
internal/app/withdrawal_usecase_test.go:36
↓ 9 callersFunctionAdminOnly
AdminOnly 管理员权限检查 (排除 viewer)
internal/adapter/middleware/jwt.go:86
↓ 9 callersFunctionBuildWalletHomeText
BuildWalletHomeText 构建钱包主页消息文本 每行使用不同的自定义 emoji (tg-emoji HTML 标签),需要 Bot 主人有 Telegram Premium
internal/adapter/telegram/handler/menu.go:34
↓ 9 callersMethodClaimRedPacket
ClaimRedPacket 领取红包 (Redis 分布式锁保护)
internal/domain/service/redpacket_service.go:185
↓ 9 callersMethodCompleteWithdrawal
CompleteWithdrawal 完成提币 (链上发送成功后调用) 1. 扣减余额 (解冻 + 扣款) 2. 更新提币记录 3. 创建交易流水
internal/domain/service/withdrawal_service.go:180
↓ 9 callersMethodFindByUserID
FindByUserID 获取用户所有钱包
internal/domain/port/repository.go:40
↓ 9 callersMethodGetByID
GetByID 根据 ID 获取商户详情
internal/app/merchant_usecase.go:37
↓ 9 callersMethodGetWallet
GetWallet 获取用户指定币种钱包
internal/domain/service/wallet_service.go:33
↓ 9 callersMethodGetWithdrawConfig
GetWithdrawConfig 获取指定币种的提币配置
internal/domain/service/withdrawal_service.go:47
↓ 9 callersMethodHasPIN
HasPIN 判断是否已设置支付密码
internal/domain/entity/user.go:71
next →1–100 of 2,200, ranked by callers