diff --git a/QMPlusServer/Dockerfile b/QMPlusServer/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..21f5bd0cd8196a2c0dc933a2bda7941f9c060fc9 --- /dev/null +++ b/QMPlusServer/Dockerfile @@ -0,0 +1,16 @@ +FROM golang:1.12 AS build + +WORKDIR /go/src/gin-vue-admin +COPY . . + +ENV GO111MODULE=on +ENV GOPROXY=https://goproxy.cn +RUN go get ./... \ + && go build -o gin-vue-admin + +FROM golang:1.12 AS serve + +COPY --from=build /go/src/gin-vue-admin /go/src/gin-vue-admin + +EXPOSE 8080 +ENTRYPOINT [ "./gin-vue-admin" ] diff --git a/QMPlusServer/config/config.go b/QMPlusServer/config/config.go index ce19ee982ee99dd8eeb1a174ddd79fc3cf54c72e..b5058d7e1cf1cfd0be0e32b6ee0038b9f76765a8 100644 --- a/QMPlusServer/config/config.go +++ b/QMPlusServer/config/config.go @@ -32,11 +32,14 @@ type CasbinConfig struct { //casbin配置 } type MysqlAdmin struct { // mysql admin 数据库配置 - Username string `json:"username"` - Password string `json:"password"` - Path string `json:"path"` - Dbname string `json:"dbname"` - Config string `json:"config"` + Username string `json:"username"` + Password string `json:"password"` + Path string `json:"path"` + Dbname string `json:"dbname"` + Config string `json:"config"` + MaxIdleConns int `json:"maxIdleConns"` + MaxOpenConns int `json:"maxOpenConns"` + LogMode bool `json:"maxOpenConns"` } type RedisAdmin struct { // Redis admin 数据库配置 diff --git a/QMPlusServer/init/qmsql/initMysql.go b/QMPlusServer/init/qmsql/initMysql.go index a663a5b126e6e6febfceff20c9a470f9c04d1d3d..8499ef66af6aabc51b990b00ae569e4795c8b388 100644 --- a/QMPlusServer/init/qmsql/initMysql.go +++ b/QMPlusServer/init/qmsql/initMysql.go @@ -15,8 +15,9 @@ func InitMysql(admin config.MysqlAdmin) *gorm.DB { log.L.Error("DEFAULTDB数据库启动异常",err) } else { DEFAULTDB = db - DEFAULTDB.DB().SetMaxIdleConns(10) - DEFAULTDB.DB().SetMaxOpenConns(100) + DEFAULTDB.DB().SetMaxIdleConns(admin.MaxIdleConns) + DEFAULTDB.DB().SetMaxOpenConns(admin.MaxOpenConns) + DEFAULTDB.LogMode(admin.LogMode) } return DEFAULTDB } diff --git a/QMPlusServer/main.go b/QMPlusServer/main.go index 7e8cbcbd4ce36d80511e8744f88f2c4684d67555..5bcbf1b214ead7ee133fc9e919462aa567557347 100644 --- a/QMPlusServer/main.go +++ b/QMPlusServer/main.go @@ -1,6 +1,8 @@ package main import ( + "os" + "fmt" "gin-vue-admin/cmd" "gin-vue-admin/config" @@ -20,12 +22,23 @@ import ( // @name x-token // @BasePath / +var ( + mysqlHost = os.Getenv("MYSQLHOST") + mysqlPort = os.Getenv("MYSQLPORT") +) + func main() { if err:= qmlog.NewLogger(); err != nil { fmt.Println(err) } + // 可以通过环境变量来覆盖配置值 + // 未设定有效的环境变量时,使用配置值 + mysqlConfig := config.GinVueAdminconfig.MysqlAdmin + if mysqlHost != "" && mysqlPort != "" { + mysqlConfig.Path = mysqlHost + ":" + mysqlPort + } // 链接初始化数据库 - db := qmsql.InitMysql(config.GinVueAdminconfig.MysqlAdmin) + db := qmsql.InitMysql(mysqlConfig) // 链接初始化数据库 if config.GinVueAdminconfig.System.UseMultipoint { // 初始化redis服务 _ = initRedis.InitRedis() diff --git a/QMPlusServer/model/autoCodeModel/autoCode.go b/QMPlusServer/model/autoCodeModel/autoCode.go new file mode 100644 index 0000000000000000000000000000000000000000..a01bdd5099c483ae24630412557a1fdcdc00b7cb --- /dev/null +++ b/QMPlusServer/model/autoCodeModel/autoCode.go @@ -0,0 +1,23 @@ +package autoCodeModel + +//开发中功能,若您发现这块代码可以研究,可以无视 +type AutoCodeStruct struct { + StructName string `json:"structName"` + StructType []string `json:"structType"` + Components []Component `json:"components"` +} + +type Component struct { + ComponentName string `json:"componentName"` + ComponentType string `json:"componentType"` + Ismultiple bool `json:"isMultiple"` + ComponentShowType string `json:"componentShowType"` + NideDictionary bool `json:"nideDictionary"` + DictionaryName string `json:"dictionaryName"` + ComponentDictionary []Dictionary `json:"dictionary"` +} + +type Dictionary struct { + Label string `json:"label"` + Value string `json:"value"` +} diff --git a/QMPlusServer/static/config/config.json b/QMPlusServer/static/config/config.json index 37f0313e7180c675c56756e36855d8ec92675179..57cbad6f198129f7dd674e1845e547bc10a721dc 100644 --- a/QMPlusServer/static/config/config.json +++ b/QMPlusServer/static/config/config.json @@ -10,7 +10,10 @@ "password": "YINGL19980716.", "path": "127.0.0.1:3306", "dbname": "qmPlus", - "config": "charset=utf8\u0026parseTime=True\u0026loc=Local" + "config": "charset=utf8\u0026parseTime=True\u0026loc=Local", + "maxIdleConns": 10, + "maxOpenConns": 100, + "logMode": true }, "qiniu": { "accessKey": "25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ", diff --git a/QMPlusVuePage/src/view/login/login.vue b/QMPlusVuePage/src/view/login/login.vue index de6e55cdc7830f9c1765e776cdce565e6045c853..ac98838527bf4993c7b33a6b146ef10d61cafc75 100644 --- a/QMPlusVuePage/src/view/login/login.vue +++ b/QMPlusVuePage/src/view/login/login.vue @@ -20,7 +20,7 @@ 请输入验证码 diff --git a/QMPlusVuePage/src/view/superAdmin/autoCode/component/componentDialog.vue b/QMPlusVuePage/src/view/superAdmin/autoCode/component/componentDialog.vue new file mode 100644 index 0000000000000000000000000000000000000000..8c4d1254c8a46d186d50a4a0a9e8c8290db10731 --- /dev/null +++ b/QMPlusVuePage/src/view/superAdmin/autoCode/component/componentDialog.vue @@ -0,0 +1,179 @@ + + + \ No newline at end of file diff --git a/QMPlusVuePage/src/view/superAdmin/autoCode/index.vue b/QMPlusVuePage/src/view/superAdmin/autoCode/index.vue index 5bfdc469dc3d7882818a1f52d8959b48cd702c66..f613084d156ccbf0835d4131b3fc4bc357503746 100644 --- a/QMPlusVuePage/src/view/superAdmin/autoCode/index.vue +++ b/QMPlusVuePage/src/view/superAdmin/autoCode/index.vue @@ -1,5 +1,6 @@