This commit is contained in:
lzx
2025-11-13 17:08:38 +08:00
parent 8d7da5d345
commit 00389efb75
25 changed files with 2919 additions and 1967 deletions

53
internal/msg/config.go Normal file
View File

@@ -0,0 +1,53 @@
package msg
import "time"
// 配置文件结构
type Config struct {
Net []string `json:"net"`
RmqConfig RmqConfig `json:"rmq_config"`
MsgConfig MsgConfig `json:"msg_config"`
MysqlConfig map[string]MysqlConfig `json:"mysql_config"` // {dbname: MysqlConfig{}, ...}
ETHConfig ETHConfig `json:"eth_config"`
}
type RmqConfig struct {
SubAddr string `json:"sub_addr"`
Pay Queue `json:"pay"`
Topup Queue `json:"topup"`
Withdraw Queue `json:"withdraw"`
Remove Queue `json:"remove"`
PayResp Queue `json:"pay_resp"`
TopupResp Queue `json:"topup_resp"`
WithdrawResp Queue `json:"withdraw_resp"`
RemoveResp Queue `json:"remove_resp"`
}
type Queue struct {
Queue string `json:"queue"`
Exchange string `json:"exchange"`
Routing []string `json:"routing"`
}
type MsgConfig struct {
SqlitePath string `json:"sqlite_path"` // sqlite3数据库文件路径
}
type MysqlConfig struct {
User string `json:"user"`
Password string `json:"password"`
Host string `json:"host"`
Port int `json:"port"`
Database string `json:"database"`
MaxOpenConns int `json:"maxOpenConns"`
MaxIdleConns int `json:"maxIdleConns"`
ConnMaxLife time.Duration `json:"connMaxLife"`
}
type ETHConfig struct {
RpcUrl string `json:"rpc_url"`
WsUrl string `json:"ws_url"`
ConfirmHeight uint64 `json:"confirm_height"`
SqlitePath string `json:"sqlite_path"` // sqlite3数据库文件路径
SupportTokens []string `json:"support_tokens"` // 支持的代币列表,如["USDT", "DAI"]
}