{"id":39118390,"url":"https://github.com/liuguangw/billing_go","last_synced_at":"2026-01-17T20:23:42.908Z","repository":{"id":76183882,"uuid":"155402473","full_name":"liuguangw/billing_go","owner":"liuguangw","description":"billing验证","archived":false,"fork":false,"pushed_at":"2025-05-09T04:24:34.000Z","size":196,"stargazers_count":74,"open_issues_count":0,"forks_count":63,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-09T05:26:50.085Z","etag":null,"topics":["billing","linux","tlbb"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liuguangw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-30T14:47:39.000Z","updated_at":"2025-05-09T04:24:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"ce0cdf58-a94f-4731-9305-b98a897e0342","html_url":"https://github.com/liuguangw/billing_go","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/liuguangw/billing_go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuguangw%2Fbilling_go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuguangw%2Fbilling_go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuguangw%2Fbilling_go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuguangw%2Fbilling_go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liuguangw","download_url":"https://codeload.github.com/liuguangw/billing_go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuguangw%2Fbilling_go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28517534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:55:29.170Z","status":"ssl_error","status_checked_at":"2026-01-17T18:55:03.375Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["billing","linux","tlbb"],"created_at":"2026-01-17T20:23:42.244Z","updated_at":"2026-01-17T20:23:42.896Z","avatar_url":"https://github.com/liuguangw.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# billing_go\n\n这是一个用 Go 语言编写的 billing 验证服务器。\n\n## 运行环境要求\n\n支持以下任意一种运行环境\n\n- Linux (Linux 内核版本 2.6.32 或者以上版本)\n\n- Windows 10, Server 2016 或者更高版本\n\n  \u003e 参考 Go 语言程序的系统需求，https://go.dev/wiki/MinimumRequirements\n\n## bug 反馈\n\n如果使用此程序出现问题，可以提交 Issue 说明你所遇到的问题，并附上相关日志文件。\n\n**billing** 的日志在 billing 程序所在的目录，文件名为 billing.log，首次运行时会自动创建此文件。\n\n此外还需要 **Login** 服务器的日志，因为只有 Login 服务器会连接 billing 服务器。\n\n可以修改一下运行脚本 `run.sh`，把 Login 服务器的日志写入某个文件，这样就可以在问题复现时从日志中查询到原因。\n\n```sh\n# 记录Login服务器日志的方法\n\n# 原命令\n./Login \u003e/dev/null 2\u003e\u00261 \u0026\n\n# 修改/dev/null 为 /home/login.log\n# 修改后,日志文件会保存到/home/login.log\n./Login \u003e/home/login.log 2\u003e\u00261 \u0026\n```\n\n## 获取程序包\n\n有以下两种方式获取此程序包。\n\n### 1.使用我编译好的版本\n\n[点击这里](https://github.com/liuguangw/billing_go/releases)查看我编译好的各版本, 可能没有最新的编译版本\n\n### 2.手工编译\n\n如果你想亲自进行编译，需要确保你的操作系统满足以下条件\n\n- 设备已连接网络\n- 已安装 Git\n- 已安装 make(仅 linux 需要)\n- 已安装 Go 1.23 或者更高版本\n\nlinux 使用 make 进行编译\n\n```bash\n# make命令说明\n\n# 构建\nmake\n\n# 清理\nmake clean\n\n# 构建并且打包32位\nmake x32\n\n# 构建并且打包64位\nmake x64\n\n# 构建并且打包所有架构\nmake all\n```\n\nwindows 下直接双击 build.bat 进行编译\n\n## 相关文件说明\n\n```\nbilling       - Linux版本的billing服务器\nbilling.exe   - Windows版本的\nconfig.yaml   - 配置文件\n```\n\n## 配置文件\n\n配置文件和程序必须放在同一个目录下，配置文件支持两种格式`yaml`或者`json`，配置文件名称为`config.yaml`或者`config.json`，如果两个文件都存在，则`yaml`格式优先。\n\n### yaml 格式的配置示例\n\n```yaml\n# #后面的为注释\n# 字符串可以不加引号,除非里面有#字符,所以如果数据库密码有#字符、空格时,就要加上引号\n#\n#billing服务器的ip，默认127.0.0.1即可\nip: 127.0.0.1\n#\n#billing服务器监听的端口(自定义一个未被占用的端口即可)\nport: 12680\n#\n#MySQL服务器的ip或者主机名\ndb_host: localhost\n#\n#MySQL服务器端口\ndb_port: 3306\n#\n#MySQL用户名\ndb_user: root\n#\n#MySQL密码\ndb_password: 'root'\n#\n#账号数据库名(一般为web)\ndb_name: web\n#\n#只有在老版本MySQL报old_password错误时,才需要设置为true\nallow_old_password: false\n#\n#用户登录的账号不存在时,是否引导用户进行注册\nauto_reg: true\n#\n#允许的服务端连接ip,为空时表示允许任何ip,不为空时只允许指定的ip连接,\n#allow_ips:\n#  - 1.1.1.1\n#  - 127.0.0.1\n#\n#点数修正, 在查询点数时,显示的值多1点或者少1点时才需要配置此值, 正常情况设置为0\n#如果显示的点数少1点则配置为1(这是临时方案,一般是lua脚本有问题,lua脚本不应该把返回的数值减一,建议修改客户端查询点数的脚本)\n#如果显示的点数多一点则配置为-1(一般不可能发生)\npoint_fix: 0\n#登录的玩家总数量限制,如果为0则表示无上限\nmax_client_count: 500\n#\n#每台电脑最多可以同时登录的用户数量限制,如果为0则表示无上限\npc_max_client_count: 3\n# billing类型 0经典 1怀旧\nbill_type: 0\n```\n\n### json 格式的配置示例\n\n```json\n{\n  \"ip\": \"127.0.0.1\",\n  \"port\": 12680,\n  \"db_host\": \"localhost\",\n  \"db_port\": 3306,\n  \"db_user\": \"root\",\n  \"db_password\": \"root\",\n  \"db_name\": \"web\",\n  \"allow_old_password\": false,\n  \"auto_reg\": true,\n  \"allow_ips\": [],\n  \"point_fix\": 0,\n  \"max_client_count\": 500,\n  \"pc_max_client_count\": 3,\n  \"bill_type\": 0\n}\n```\n\n\u003e 如果 biiling 和服务端位于同一台服务器的情况下，建议 billing 的 IP 使用 127.0.0.1,这样可以避免绕一圈外网\n\u003e\n\u003e 本项目中附带的配置文件各项值为其默认值,如果你的配置中的字段的值与默认值相同,则可以省略相同的字段配置\n\n将`billing` (Windows 服务器则是`billing.exe`)和配置文件放置于同一目录下\n\n修改游戏服务器的配置文件`....../tlbb/Server/Config/ServerInfo.ini`中 billing 的配置\n\n```ini\n#........\n[Billing]\nNumber=1\n#billing服务器的ip\nIP0=127.0.0.1\n# billing服务器监听的端口\nPort0=12680\n#.........\n```\n\n最后启动游戏服务端、启动 billing 即可\n\n## 启动与停止\n\nLinux 和 Windows 下的操作分别如下\n\n### 启动\n\nLinux 下启动 billing 方法(**前台模式**)\n\n```bash\n#进入billing所在文件夹,比如/home\ncd /home\n#添加执行权限\nchmod +x ./billing\n#启动billing\n./billing\n```\n\nLinux 以守护进程后台运行 billing 的方法(**daemon 模式**)\n\n```bash\n#进入billing所在文件夹,比如/home\ncd /home\n#添加执行权限\nchmod +x ./billing\n#启动billing\n./billing up -d\n```\n\nLinux 以 **systemd** 方式运行 billing 服务的方法:\n参考文件 [billing.service](billing.service)\n\nWindows 下,直接双击`billing.exe`即可\n\n### 停止\n\n停止 billing 命令\n\n```bash\n# 使用stop命令\n./billing stop\n\n# 也可以使用kill命令\nkill -SIGTERM $(pgrep -f billing)\n```\n\n如果是前台模式，可以使用 Ctrl + C 组合键停止服务器\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuguangw%2Fbilling_go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliuguangw%2Fbilling_go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuguangw%2Fbilling_go/lists"}