github.com/kotovmak/go-admin@v1.1.1/README_CN.md (about) 1 <p align="center"> 2 <a href="https://github.com/GoAdminGroup/go-admin"> 3 <img width="48%" alt="go-admin" src="http://quick.go-admin.cn/official/assets/imgs/github_logo.png"> 4 </a> 5 </p> 6 <p align="center"> 7 遗失的Golang编写的数据可视化与管理平台构建框架 8 </p> 9 <p align="center"> 10 <a href="http://drone.go-admin.com/GoAdminGroup/go-admin"><img alt="Build Status" src="http://drone.go-admin.com/api/badges/GoAdminGroup/go-admin/status.svg?ref=refs/heads/master"></a> 11 <a href="https://goreportcard.com/report/github.com/GoAdminGroup/go-admin"><img alt="Go Report Card" src="https://camo.githubusercontent.com/59eed852617e19c272a4a4764fd09c669957fe75/68747470733a2f2f676f7265706f7274636172642e636f6d2f62616467652f6769746875622e636f6d2f6368656e6867352f676f2d61646d696e"></a> 12 <a href="https://goreportcard.com/report/github.com/GoAdminGroup/go-admin"><img alt="golang" src="https://img.shields.io/badge/awesome-golang-blue.svg"></a> 13 <a href="https://t.me/joinchat/NlyH6Bch2QARZkArithKvg" rel="nofollow"><img alt="telegram" src="https://img.shields.io/badge/chat%20on-telegram-blue" style="max-width:100%;"></a> 14 <a href="https://shang.qq.com/wpa/qunwpa?idkey=ab18729bba609c220f31516a4eb9fce27f582458bd9a865b46523adb5632b873"><img alt="qq群" src="https://img.shields.io/badge/QQ-874825430-yellow.svg"></a> 15 <a href="https://godoc.org/github.com/GoAdminGroup/go-admin" rel="nofollow"><img src="https://camo.githubusercontent.com/a9a286d43bdfff9fb41b88b25b35ea8edd2634fc/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f646572656b7061726b65722f64656c76653f7374617475732e737667" alt="GoDoc" data-canonical-src="https://godoc.org/github.com/derekparker/delve?status.svg" style="max-width:100%;"></a> 16 <a href="https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/LICENSE" rel="nofollow"><img src="https://img.shields.io/badge/license-Apache2.0-blue.svg" alt="license" data-canonical-src="https://img.shields.io/badge/license-Apache2.0-blue.svg" style="max-width:100%;"></a> 17 </p> 18 <p align="center"> 19 由<a href="https://github.com/z-song/laravel-admin" target="_blank">laravel-admin</a>启发 20 </p> 21 22 ## 前言 23 24 GoAdmin 可以帮助你的golang应用快速实现数据可视化,搭建一个数据管理平台。 25 26 [文档](http://doc.go-admin.cn/zh) | [论坛](http://discuss.go-admin.com) | [Demo](https://demo.go-admin.cn) | [上手例子](https://github.com/GoAdminGroup/example/blob/master/README_CN.md) | [GoAdmin+vue 例子](https://github.com/GoAdminGroup/goadmin-vue-example) 27 28 29  30 31 ## 特征 32 33 - 🚀 **高生产效率**: 10分钟内做一个好看的管理后台 34 - 🎨 **主题**: 默认为adminlte,更多好看的主题正在制作中,欢迎给我们留言 35 - 🔢 **插件化**: 提供插件使用,真正实现一个插件解决不了问题,那就两个 36 - ✅ **认证**: 开箱即用的rbac认证系统 37 - ⚙️ **框架支持**: 支持大部分框架接入,让你更容易去上手和扩展 38 39 ## 翻译 40 我们需要您的帮忙: [https://github.com/GoAdminGroup/docs/issues/1](https://github.com/GoAdminGroup/docs/issues/1) 41 42 ## 谁在使用GoAdmin 43 44 [评论这个issue告诉我们](https://github.com/kotovmak/go-admin/issues/71). 45 46 ## 使用 47 48 提示:现在你也可以这样做。 49 50 ```shell 51 $ go install github.com/GoAdminGroup/adm@latest 52 $ mkdir new_project && cd new_project 53 $ adm init -l cn 54 ``` 55 56 或者:(使用v1.2.16以上的adm) 57 58 ```shell 59 $ go install github.com/GoAdminGroup/adm@latest 60 $ mkdir new_project && cd new_project 61 $ adm init web -l cn 62 ``` 63 64 65 通过以下三步运行: 66 67 ### 第一步:导入 sql 68 69 - [mysql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.sql) 70 - [mssql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.mssql) 71 - [postgresql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.pgsql) 72 - [sqlite](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.db) 73 74 ### 第二步:创建 main.go 75 76 <details><summary>main.go</summary> 77 <p> 78 79 ```go 80 package main 81 82 import ( 83 "github.com/gin-gonic/gin" 84 _ "github.com/kotovmak/go-admin/adapter/gin" 85 _ "github.com/kotovmak/go-admin/modules/db/drivers/mysql" 86 "github.com/kotovmak/go-admin/engine" 87 "github.com/kotovmak/go-admin/plugins/admin" 88 "github.com/GoAdminGroup/themes/adminlte" 89 "github.com/kotovmak/go-admin/modules/config" 90 "github.com/kotovmak/go-admin/template" 91 "github.com/kotovmak/go-admin/template/chartjs" 92 "github.com/kotovmak/go-admin/template/types" 93 "github.com/kotovmak/go-admin/examples/datamodel" 94 "github.com/kotovmak/go-admin/modules/language" 95 ) 96 97 func main() { 98 r := gin.Default() 99 100 eng := engine.Default() 101 102 // global config 103 cfg := config.Config{ 104 Databases: config.DatabaseList{ 105 "default": { 106 Host: "127.0.0.1", 107 Port: "3306", 108 User: "root", 109 Pwd: "root", 110 Name: "goadmin", 111 MaxIdleConns: 50, 112 MaxOpenConns: 150, 113 ConnMaxLifetime: time.Hour, 114 Driver: "mysql", 115 }, 116 }, 117 UrlPrefix: "admin", 118 // STORE 必须设置且保证有写权限,否则增加不了新的管理员用户 119 Store: config.Store{ 120 Path: "./uploads", 121 Prefix: "uploads", 122 }, 123 Language: language.CN, 124 // 开发模式 125 Debug: true, 126 // 日志文件位置,需为绝对路径 127 InfoLogPath: "/var/logs/info.log", 128 AccessLogPath: "/var/logs/access.log", 129 ErrorLogPath: "/var/logs/error.log", 130 ColorScheme: adminlte.ColorschemeSkinBlack, 131 } 132 133 // 增加 chartjs 组件 134 template.AddComp(chartjs.NewChart()) 135 136 _ = eng.AddConfig(&cfg). 137 AddGenerators(datamodel.Generators). 138 // 增加 generator, 第一个参数是对应的访问路由前缀 139 // 例子: 140 // 141 // "user" => http://localhost:9033/admin/info/user 142 // 143 AddGenerator("user", datamodel.GetUserTable). 144 Use(r) 145 146 // 自定义首页 147 eng.HTML("GET", "/admin", datamodel.GetContent) 148 149 _ = r.Run(":9033") 150 } 151 ``` 152 153 </p> 154 </details> 155 156 更多框架的例子: [https://github.com/kotovmak/go-admin/tree/master/examples](https://github.com/kotovmak/go-admin/tree/master/examples) 157 158 ### 第三步:运行 159 160 ```shell 161 GO111MODULE=on go run main.go 162 ``` 163 164 访问:[http://localhost:9033/admin](http://localhost:9033/admin) 165 166 账号: admin 密码: admin 167 168 更多细节详见 [文档说明](http://doc.go-admin.cn/zh) 169 170 [这里一个超级简单上手的例子](https://github.com/GoAdminGroup/example) 171 172 ## 贡献 173 174 [这里有一份贡献指南](CONTRIBUTING_CN.md) 175 176 非常欢迎提pr,<strong>这里可以加入开发小组</strong> 177 178 <strong>QQ群</strong>:[641768714](https://jq.qq.com/?_wv=1027&k=qn8oXyGC),记得备注加群来意 179 180 这里是[开发计划](https://github.com/kotovmak/go-admin/projects) 181 182 <strong>[点击这里申请加微信群(记得备注加群)](http://quick.go-admin.cn/resource/wechat_qrcode_02.jpg)</strong> 183 184 <strong>注:在社区中如有问题提问,请务必清晰描述,包括但不限于问题详叙/问题代码/复现方法/已经尝试过的方法,时间生命可贵,请珍惜自己和别人的时间!</strong> 185 186 ## 十分感谢 187 188 inspired by [laravel-admin](https://github.com/z-song/laravel-admin) 189 190 ## 打赏 191 192 留下您的github/gitee用户名,我们将会展示在[捐赠名单](DONATION.md)中。 193 194 > 恰饭所需,作者精力时间有限,目前GoAdmin项目捐赠达666元,联系[作者](http://quick.go-admin.cn/resource/wechat_qrcode.jpg)可进vip用户群,vip群中您的问题将得到优先解答,同时也会根据您的需求进行分析和优先安排,vip群也会提供其他关于golang的福利。🙏 195 > 196 > 同时您也可以联系我,雇佣我的时间帮助您干活。 197 198 <img src="http://quick.go-admin.cn/official/assets/imgs/shoukuan.jpg" width="650" />