{"id":23919437,"url":"https://github.com/srcrs/tobeg","last_synced_at":"2025-09-09T08:47:30.189Z","repository":{"id":48009801,"uuid":"515939566","full_name":"srcrs/tobeg","owner":"srcrs","description":"叫花子要饭新姿势，简洁优雅，使用 gin 做为后端框架，前端使用 vue + element-ui 构建。","archived":false,"fork":false,"pushed_at":"2022-09-05T16:57:40.000Z","size":388,"stargazers_count":42,"open_issues_count":4,"forks_count":19,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T21:07:49.538Z","etag":null,"topics":["beg","go","vue"],"latest_commit_sha":null,"homepage":"https://tobeg.asksowhat.cn","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/srcrs.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}},"created_at":"2022-07-20T10:40:29.000Z","updated_at":"2025-03-27T21:06:38.000Z","dependencies_parsed_at":"2022-08-14T06:30:22.748Z","dependency_job_id":null,"html_url":"https://github.com/srcrs/tobeg","commit_stats":null,"previous_names":["asksowhat/tobeg"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/srcrs/tobeg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srcrs%2Ftobeg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srcrs%2Ftobeg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srcrs%2Ftobeg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srcrs%2Ftobeg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srcrs","download_url":"https://codeload.github.com/srcrs/tobeg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srcrs%2Ftobeg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274268373,"owners_count":25253390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["beg","go","vue"],"created_at":"2025-01-05T14:52:21.332Z","updated_at":"2025-09-09T08:47:30.160Z","avatar_url":"https://github.com/srcrs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003etobeg\u003c/h1\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://tobeg.asksowhat.cn\"\u003e\n    \u003cimg alt=\"asksowhat\" src=\"https://bl6pap003files.storage.live.com/y4m3oxa18JTyLQHRtExGB4yqCUrzwydU7vfXLXbid-k7b708X8MzTgKSqisBAlceRISxF6ebyllOvN2xs2w3X3C81PqUw9VyidgzRMIpB4BGgfp-sPKVOAQ9oos4l9b_-OyYDztnibR4qcqWVyNCr2PAKNNWhLzXMdBt53mFmTf3Xl85jrJuHcwQTU5AzXireol?width=128\u0026height=128\u0026cropmode=none\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  叫花子要饭新姿势，简洁优雅，使用 gin 做为后端框架，前端使用 vue + element-ui 构建。\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/github/issues/asksowhat/tobeg?color=green\"\u003e\n\u003cimg src=\"https://img.shields.io/github/stars/asksowhat/tobeg?color=yellow\"\u003e\n\u003cimg src=\"https://img.shields.io/github/forks/asksowhat/tobeg?color=orange\"\u003e\n\u003cimg src=\"https://img.shields.io/github/license/asksowhat/tobeg?color=ff69b4\"\u003e\n\u003cimg src=\"https://img.shields.io/github/search/asksowhat/tobeg/main?color=blue\"\u003e\n\u003cimg src=\"https://img.shields.io/github/v/release/asksowhat/tobeg?color=blueviolet\"\u003e\n\u003cimg src=\"https://img.shields.io/github/languages/code-size/asksowhat/tobeg?color=critical\"\u003e\n\u003c/p\u003e\n\n![tobeg](https://bl6pap003files.storage.live.com/y4mBREf1EIU0h9IW47iLsjHx1r-fkuj8cF3mx5D76bwZA7CF-xNtkKTBhjeJfOzNjiTty3ZLU9bhcYGjHJyQZRS2h1FjSVVCVEyMFqiER1Lv4IFJrxkRJRpXRyfRd-BiGs-ErCFKRA6iaa_lTOsR66HHqfA5teq4mKUF0A44lbc3kmlBYPfBxZymB8LXHldlpDi?width=1069\u0026height=663\u0026cropmode=none)\n\n\n# 项目说明\n\n目前，该项目仅仅完成了基本功能，还存在着许多不足和 bug ，这些我都会继续完善。下一阶段，准备引入数据库，保存“赏钱”信息。\n\n# 项目结构\n\n```bash\n.\n├── api #api接口\n│   ├── alipay.go\n│   ├── flow.go\n│   └── tmpl.go\n├── cert #证书实体\n│   └── cert.go\n├── config #配置项实体\n│   └── config.go\n├── config.yml #配置文件\n├── db #db数据库操作\n│   └── sqlite3.go\n├── docker-compose.yml\n├── Dockerfile\n├── flow.db #sqlite存储\n├── forms\n│   └── alipay.go\n├── global #全局变量配置\n│   └── global.go\n├── go.mod\n├── go.sum\n├── initialize #初始化\n│   ├── cert.go\n│   ├── config.go\n│   ├── logger.go\n│   ├── router.go\n│   └── sqlite3.go\n├── LICENSE\n├── main.go\n├── middlerwares #中间件\n│   └── cors.go\n├── model #数据库表实体\n│   └── flow.go\n├── public #静态文件\n│   ├── css\n│   │   ├── elementui.index.css\n│   │   └── fonts\n│   │       ├── element-icons.ttf\n│   │       └── element-icons.woff\n│   ├── images\n│   │   └── favicon.png\n│   └── js\n│       ├── elementui.index.js\n│       ├── jquery.min.js\n│       ├── qrcode.min.js\n│       └── vue.min.js\n├── README.md\n├── router #路由配置\n│   ├── alipay.go\n│   ├── flow.go\n│   └── tmpl.go\n├── templates #模版引擎\n│   └── index.html\n└── utils #工具模块\n    └── db.go\n```\n\n# 准备\n\n目前，该项目仅仅对接了支付宝当面支付（支付扫码付款场景理论都支持）,需要完成以下几件事\n\n- 申请开通支付宝当面付功能\n\n- appId(应用ID)\n\n- private_key(支付宝私钥)\n\n- public_content_rsa2(支付宝公钥)\n\n- app_public_content(应用公钥)\n\n## 支付宝开通当面付\n\n开通当面付，可参考官方说明进行申请。[当面付介绍及准入条件](https://opendocs.alipay.com/open/194/105072?ref=api)\n\n## 进入应用管理\n\n当开通完当面付功能之后，进入[应用管理](https://open.alipay.com/develop/manage)页面，点击网页/移动应用，可以看到已经有一个应用，点击进入详情。\n\n红色箭头所指便是 **appId(应用ID)**\n\n![](https://bl6pap003files.storage.live.com/y4mdzsosELSOl9LbdDywpWivb77IhvP4XEMiP1n2uk5TOTo-36oj6Qe7shzabb8wxi8t_k19aa7qen3D5OyuyHSRcqkYiKnosweL_5nvtWB14MR52pvMTP_2Be1VTocZF8ggvJJZU5ALqC94TnpB9dWAENpDdc25boVtQrQGXLsz2l_gjOhcJkPTcqW5xDwBPEt?width=794\u0026height=273\u0026cropmode=none)\n\n## 生成密钥\n\n参考支付宝官方文档 [生成并配置密钥](https://opendocs.alipay.com/common/02kdnc)，这里需要注意的是，生成密钥的流程相同，配置密钥不同的应用界面可能存在差异。\n\n密钥生成之后，会得到两个文件 \n\n- 应用公钥2048.txt\n\n- 应用私钥2048.txt\n\n应用私钥2048.txt 中的内容便是 **private_key(支付宝私钥)**\n\n## 配置密钥\n\n![](https://bl6pap003files.storage.live.com/y4myGbHKhhql36n05KBUBYsGUHqGc_bDvuAezGzKNXJnp217nddmNwaSsLn9RH4CKN_uVcyHstWetYNdi17tfrP8EDzAO-8fFAASHU5OSbALd_R7obcHrezRvPABQWXHzJZtYnSMHyqHxcfyvB8Y2CIoA6p1k-VwLnZCFh5jSdOgEJVDQA1uP1JzZd4HYXRAjdW?width=1589\u0026height=473\u0026cropmode=none)\n\n将 应用公钥2048.txt 中的公钥填写在 圈2 位置，填写好之后你就得到了 **public_content_rsa2(支付宝公钥)** 和 **app_public_content(应用公钥)**。\n\n如果上述表示有不明确之处，可参考支付宝官方文档 [当面付接入准备](https://opendocs.alipay.com/open/01csp3?ref=api)\n\n至此，准备完毕。\n\n# 配置\n\ntobeg 支持用户在 config.yml 填写自定义配置，配置文件说明\n\nbase 模块下主要包含网站一些基础配置如网站图标，标题等等\n\n字段 | 示例 | 说明\n-|-|-\ntitle | \"tobeg\" | 网站的title\nurl | \"http://baidu.com\" | 网站对外访问地址，关乎到支付回调判断，如站点访问地址是 https://google.com ，那么这个字段就要填写为 https://google.com 。\nfavicon | \"favicon.png\" | 站点图标，存储位置在/public/images/favicon.png，新图片可覆盖也可代替，但要注意这里要与实际图片文件名相同。\ntoSells | 字符串列表 | 在走马灯处显示\nthank | \"谢谢你, 好人\" | 支付成功后的提示\n\nalipay 主要是配置支付宝相关的信息\n\n字段 | 示例 | 说明\n-|-|-\nappid | \"2032423423\" | 支付宝应用Id\nprivate_key | \"MIIEpAIBAAKCAQEAsw6yoLZ\" | 支付宝密钥\npublic_content_rsa2 | \"MIIBIjANBgdqhkiG9w\" | 支付宝公钥\napp_public_content | \"MIIBIjANBgkqhkiG9wfBAQEFA\" | 应用公钥\n\nserver 主要主要配置后端服务的相关信息\n\n字段 | 示例 | 说明\n-|-|-\nport | 10020 | 配置后端服务的启动端口\n\n完整示例\n\n```yml\nbase:\n  title: \"tobeg\"\n  url: \"http://baidu.com\"\n  favicon: \"favicon.png\"\n  thank: \"谢谢你, 好人\"\n  toSells:\n    - \"瞧一瞧、看一看、这里来个穷要饭哎\"\n    - \"大娘好，大爷善，可怜可怜俺这个穷光蛋\"\n    - \"给个摸，给口汤，祝恁长命又健康\"\n    - \"行行好，行行秒，施舍的人呱呱叫\"\n\nalipay:\n  appid: \"2032423423\"\n  private_key: \"MIIEpAIBAAKCAQEAsw6yoLZ\"\n  public_content_rsa2: \"MIIBIjANBgdqhkiG9w\"\n  app_public_content: \"MIIBIjANBgkqhkiG9wfBAQEFA\"\n\nserver:\n  port: 10020\n```\n\n需要注意的是，在 config.yml 配置文件中，你至少要两个地方 base.url 和 alipay 相关的证书信息，至此配置结束。\n\n# 部署\n\n该项目支持使用Docker-Compose进行部署，推荐自己构建最新镜像，也可以使用我构建的镜像，但可能不是最新的。\n\n## 自己构建镜像\n\n- 下载项目\n\n```bash\ngit clone https://github.com/asksowhat/tobeg.git \u0026\u0026 cd tobeg\n```\n\n- 运行\n\n相关配置完成之后\n\n```bash\ndocker-compose up -d\n```\n\n这里会产生一个无用镜像，使用下面命令，便可删除\n\n```bash\ndocker rmi $(docker images -f \"dangling=true\" -q)\n```\n\n## 使用我的镜像\n\n将下面内容，覆盖 docker-compose.yml\n\n```yml\nversion: \"3\"\n\nservices:\n  tobeg:\n    image: asksowhat/tobeg:latest\n    container_name: tobeg\n    restart: always\n    ports:\n      - 10020:10020\n    volumes:\n      - $PWD/config.yml:/config.yml\n      - $PWD/flow.db:/flow.db\n```\n\n- 运行\n\n```bash\ndocker-compose up -d\n```\n\n这里有一点要注意的是，如果你在 config.yml 更改了端口配置，需要将 docker-compose.yml 的ports配置，也要做相应的调整。\n\n# 致谢（不分先后）\n\n- [gin](https://github.com/gin-gonic/gin)\n\n- [gopay](https://github.com/go-pay/gopay)\n\n- [element-ui](https://github.com/ElemeFE/element)\n\n- [qrcodejs](https://github.com/davidshimjs/qrcodejs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrcrs%2Ftobeg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrcrs%2Ftobeg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrcrs%2Ftobeg/lists"}