Browse Source

Merge branch 'develop' into feature/docker-support

main
rikugun 5 years ago
committed by GitHub
parent
commit
fc7eeb0d71
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README-zh_CN.md
  2. 2
      README.md
  3. 36
      server/initialize/sqlite.go
  4. 4
      server/main.go

2
README-zh_CN.md

@ -180,7 +180,7 @@ go run main.go;
- 配置管理:配置文件可前台修改(测试环境不开放此功能)。
- 富文本编辑器:MarkDown编辑器功能嵌入。
- 条件搜索:增加条件搜索示例。
- restful示例:参考客户管理功能,customer组api
- restful示例:可以参考用户管理模块中的示例API
```
前端文件参考: src\view\superAdmin\api\api.vue
后台文件参考: model\dnModel\api.go

2
README.md

@ -177,7 +177,7 @@ go run main.go;
- Configuration management: The configuration file can be modified in the web page (the test environment does not provide this function).
- Rich text editor: Embed MarkDown editor function.
- Conditional search: Add an example of conditional search.
- Restful example: refer to customer management function and apidcustomer group.
- Restful example: You can see sample APIs in user management module.
```
fontend code file: src\view\superAdmin\api\api.vue

36
server/initialize/sqlite.go

@ -1,19 +1,23 @@
package initialize
import (
"fmt"
"gin-vue-admin/global"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
// sqlite需要gcc支持 windows用户需要自行安装gcc 如需使用打开注释即可
//初始化数据库并产生数据库全局变量
func Sqlite() {
admin := global.GVA_CONFIG.Sqlite
if db, err := gorm.Open("sqlite3", fmt.Sprintf("%s?%s", admin.Path,admin.Config)); err != nil {
global.GVA_LOG.Error("DEFAULT DB数据库启动异常", err)
} else {
global.GVA_DB = db
global.GVA_DB.LogMode(admin.LogMode)
}
}
// 感谢 sqlitet提供者 [rikugun] 作者github: https://github.com/rikugun
//import (
// "fmt"
// "gin-vue-admin/global"
// "github.com/jinzhu/gorm"
// _ "github.com/jinzhu/gorm/dialects/sqlite"
//)
//
////初始化数据库并产生数据库全局变量
//func Sqlite() {
// admin := global.GVA_CONFIG.Sqlite
// if db, err := gorm.Open("sqlite3", fmt.Sprintf("%s?%s", admin.Path,admin.Config)); err != nil {
// global.GVA_LOG.Error("DEFAULTDB数据库启动异常", err)
// } else {
// global.GVA_DB = db
// global.GVA_DB.LogMode(admin.LogMode)
// }
//}

4
server/main.go

@ -11,8 +11,8 @@ func main() {
switch global.GVA_CONFIG.System.DbType {
case "mysql":
initialize.Mysql()
case "sqlite":
initialize.Sqlite()
//case "sqlite":
// initialize.Sqlite() // sqlite需要gcc支持 windows用户需要自行安装gcc 如需使用打开注释即可
default:
initialize.Mysql()
}

Loading…
Cancel
Save