diff --git a/QMPlusServer/config/config.go b/QMPlusServer/config/config.go index 331af5ff4e894eca380909f97beb8dfb6358d2c9..60d116fa55ee44ea26c96717369279f9e20e18a2 100644 --- a/QMPlusServer/config/config.go +++ b/QMPlusServer/config/config.go @@ -13,6 +13,7 @@ type Config struct { RedisAdmin RedisAdmin `json:"redisAdmin"` System System `json:"system"` JWT JWT `json:"jwt"` + Captcha Captcha `json:"captcha"` } type System struct { // 系统配置 @@ -47,6 +48,12 @@ type Qiniu struct { // 七牛 密钥配置 SecretKey string `json:"secretKey"` } +type Captcha struct { // 验证码配置 + KeyLong int `json:"keyLong"` + ImgWidth int `json:"imgWidth"` + ImgHeight int `json:"imgHeight"` +} + var GinVueAdminconfig Config var VTool *viper.Viper diff --git a/QMPlusServer/controller/api/exa_breakpoint_continue.go b/QMPlusServer/controller/api/exa_breakpoint_continue.go index 4b39ae6f537330abd4bcac90e6e4ec9dbd5b060f..5aa095058d1843ec6f31e60702066e62c1b26777 100644 --- a/QMPlusServer/controller/api/exa_breakpoint_continue.go +++ b/QMPlusServer/controller/api/exa_breakpoint_continue.go @@ -17,7 +17,6 @@ import ( // @Param file formData file true "断点续传示例" // @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}" // @Router /fileUploadAndDownload/breakpointContinue [post] - func BreakpointContinue(c *gin.Context) { fileMd5 := c.Request.FormValue("fileMd5") fileName := c.Request.FormValue("fileName") @@ -62,7 +61,7 @@ func BreakpointContinue(c *gin.Context) { // @Security ApiKeyAuth // @accept multipart/form-data // @Produce application/json -// @Param file params file true "查找文件" +// @Param file formData file true "查找文件" // @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}" // @Router /fileUploadAndDownload/findFile [post] func FindFile(c *gin.Context) { @@ -82,7 +81,7 @@ func FindFile(c *gin.Context) { // @Security ApiKeyAuth // @accept multipart/form-data // @Produce application/json -// @Param file params file true "查找文件" +// @Param file formData file true "查找文件" // @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}" // @Router /fileUploadAndDownload/findFile [post] func BreakpointContinueFinish(c *gin.Context) { @@ -101,7 +100,7 @@ func BreakpointContinueFinish(c *gin.Context) { // @Security ApiKeyAuth // @accept multipart/form-data // @Produce application/json -// @Param file params file true "查找文件" +// @Param file formData file true "查找文件" // @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}" // @Router /fileUploadAndDownload/removeChunk [post] func RemoveChunk(c *gin.Context) { diff --git a/QMPlusServer/controller/api/sys_captcha.go b/QMPlusServer/controller/api/sys_captcha.go new file mode 100644 index 0000000000000000000000000000000000000000..42068a0d2c4c2f1c23d21a75c52fac9ab1aa37e6 --- /dev/null +++ b/QMPlusServer/controller/api/sys_captcha.go @@ -0,0 +1,35 @@ +package api + +import ( + "gin-vue-admin/config" + "gin-vue-admin/controller/servers" + "github.com/dchest/captcha" + "github.com/gin-gonic/gin" +) + +// 获取图片验证码id +// @Tags base +// @Summary 生成验证码 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Router /base/captcha [post] +func Captcha(c *gin.Context) { + captchaId := captcha.NewLen(config.GinVueAdminconfig.Captcha.KeyLong) + servers.ReportFormat(c, true, "验证码获取成功", gin.H{ + "captchaId": captchaId, + "picPath": "/base/captcha/" + captchaId + ".png", + }) +} + +// @Tags base +// @Summary 生成验证码图片路径 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Router /base/captcha/:captchaId [get] +func CaptchaImg(c *gin.Context) { + servers.GinCapthcaServeHTTP(c.Writer, c.Request) +} diff --git a/QMPlusServer/controller/api/sys_system.go b/QMPlusServer/controller/api/sys_system.go index a34ac51f3e9c6a305c0327cd49e8a7f85d8890f8..5a8bf8456320b50068622291f0a67164c96f8fcb 100644 --- a/QMPlusServer/controller/api/sys_system.go +++ b/QMPlusServer/controller/api/sys_system.go @@ -26,7 +26,7 @@ func GetSystemConfig(c *gin.Context) { // @Summary 设置配置文件内容 // @Security ApiKeyAuth // @Produce application/json -// @Param data body sysModel.System true +// @Param data body sysModel.System true "设置配置文件内容" // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /system/setSystemConfig [post] func SetSystemConfig(c *gin.Context) { @@ -40,11 +40,13 @@ func SetSystemConfig(c *gin.Context) { } } + +//本方法开发中 开发者windows系统 缺少linux系统所需的包 因此搁置 // @Tags system // @Summary 设置配置文件内容 // @Security ApiKeyAuth // @Produce application/json -// @Param data body sysModel.System true +// @Param data body sysModel.System true "设置配置文件内容" // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /system/ReloadSystem [post] func ReloadSystem(c *gin.Context) { diff --git a/QMPlusServer/controller/api/sys_user.go b/QMPlusServer/controller/api/sys_user.go index 768063f38914070c663da4c72929164f64422204..8982fb28aa1ac19291461cb9dfc2444130f7a0c2 100644 --- a/QMPlusServer/controller/api/sys_user.go +++ b/QMPlusServer/controller/api/sys_user.go @@ -7,6 +7,7 @@ import ( "gin-vue-admin/middleware" "gin-vue-admin/model/modelInterface" "gin-vue-admin/model/sysModel" + "github.com/dchest/captcha" "github.com/dgrijalva/jwt-go" "github.com/gin-gonic/gin" "github.com/go-redis/redis" @@ -23,6 +24,8 @@ var ( type RegistAndLoginStuct struct { Username string `json:"username"` Password string `json:"password"` + Captcha string `json:"captcha"` + CaptchaId string `json:"captchaId"` } type RegestStuct struct { @@ -64,12 +67,17 @@ func Regist(c *gin.Context) { func Login(c *gin.Context) { var L RegistAndLoginStuct _ = c.BindJSON(&L) - U := &sysModel.SysUser{Username: L.Username, Password: L.Password} - if err, user := U.Login(); err != nil { - servers.ReportFormat(c, false, fmt.Sprintf("用户名密码错误或%v", err), gin.H{}) - } else { - tokenNext(c, *user) + if captcha.VerifyString(L.CaptchaId,L.Captcha) { + U := &sysModel.SysUser{Username: L.Username, Password: L.Password} + if err, user := U.Login(); err != nil { + servers.ReportFormat(c, false, fmt.Sprintf("用户名密码错误或%v", err), gin.H{}) + } else { + tokenNext(c, *user) + } + }else{ + servers.ReportFormat(c, false, "验证码错误", gin.H{}) } + } //登录以后签发jwt diff --git a/QMPlusServer/controller/servers/captcha.go b/QMPlusServer/controller/servers/captcha.go new file mode 100644 index 0000000000000000000000000000000000000000..e92b84015a4a9f75766904362525fe724aaf292e --- /dev/null +++ b/QMPlusServer/controller/servers/captcha.go @@ -0,0 +1,55 @@ +package servers + +import ( + "bytes" + "fmt" + "gin-vue-admin/config" + "github.com/dchest/captcha" + "net/http" + "path" + "strings" + "time" +) + +// 这里需要自行实现captcha 的gin模式 +func GinCapthcaServeHTTP(w http.ResponseWriter, r *http.Request) { + dir, file := path.Split(r.URL.Path) + ext := path.Ext(file) + id := file[:len(file)-len(ext)] + if ext == "" || id == "" { + http.NotFound(w, r) + return + } + fmt.Println("reload : " + r.FormValue("reload")) + if r.FormValue("reload") != "" { + captcha.Reload(id) + } + lang := strings.ToLower(r.FormValue("lang")) + download := path.Base(dir) == "download" + if Serve(w, r, id, ext, lang, download, config.GinVueAdminconfig.Captcha.ImgWidth, config.GinVueAdminconfig.Captcha.ImgHeight) == captcha.ErrNotFound { + http.NotFound(w, r) + } +} + +func Serve(w http.ResponseWriter, r *http.Request, id, ext, lang string, download bool, width, height int) error { + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") + var content bytes.Buffer + switch ext { + case ".png": + w.Header().Set("Content-Type", "image/png") + captcha.WriteImage(&content, id, width, height) + case ".wav": + w.Header().Set("Content-Type", "audio/x-wav") + captcha.WriteAudio(&content, id, lang) + default: + return captcha.ErrNotFound + } + + if download { + w.Header().Set("Content-Type", "application/octet-stream") + } + http.ServeContent(w, r, id+ext, time.Time{}, bytes.NewReader(content.Bytes())) + return nil +} diff --git a/QMPlusServer/docs/docs.go b/QMPlusServer/docs/docs.go index 1203b8f3a8807b318d95771f28f4c5826e825acb..9537f99cd68671ed2a2e9dff4a4d352c15bfb854 100644 --- a/QMPlusServer/docs/docs.go +++ b/QMPlusServer/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2020-01-06 17:53:22.2207663 +0800 CST m=+0.069844001 +// 2020-03-17 15:18:08.5115326 +0800 CST m=+0.098737601 package docs @@ -404,6 +404,60 @@ var doc = `{ } } }, + "/base/captcha": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "base" + ], + "summary": "生成验证码", + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/base/captcha/": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "base" + ], + "summary": "生成验证码图片路径", + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/base/login": { "post": { "produces": [ @@ -466,6 +520,45 @@ var doc = `{ } } }, + "/casbin/CasbinTest": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "casbin" + ], + "summary": "casb RBAC RESTFUL测试路由", + "parameters": [ + { + "description": "获取权限列表", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/api.CreateAuthorityParams" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/casbin/casbinPUpdata": { "post": { "security": [ @@ -491,13 +584,319 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" + "$ref": "#/definitions/sysModel.CasbinInReceive" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/casbin/getPolicyPathByAuthorityId": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "casbin" + ], + "summary": "获取权限列表", + "parameters": [ + { + "description": "获取权限列表", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/api.CreateAuthorityParams" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/createExaCustomer": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "创建客户", + "parameters": [ + { + "description": "创建客户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/deleteExaCustomer": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "删除客户", + "parameters": [ + { + "description": "删除客户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/getExaCustomer": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "获取单一客户信息", + "parameters": [ + { + "description": "获取单一客户信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/getExaCustomerList": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "获取权限客户列表", + "parameters": [ + { + "description": "获取权限客户列表", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/modelInterface.PageInfo" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/updataExaCustomer": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "更新客户信息", + "parameters": [ + { + "description": "创建客户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/fileUploadAndDownload/breakpointContinue": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "ExaFileUploadAndDownload" + ], + "summary": "断点续传到服务器", + "parameters": [ + { + "type": "file", + "description": "断点续传示例", + "name": "file", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"上传成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/fileUploadAndDownload/deleteFile": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "ExaFileUploadAndDownload" + ], + "summary": "删除文件", + "parameters": [ + { + "description": "传入文件里面id即可", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaFileUploadAndDownload" } } ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", "schema": { "type": "string" } @@ -505,7 +904,7 @@ var doc = `{ } } }, - "/casbin/getPolicyPathByAuthorityId": { + "/fileUploadAndDownload/findFile": { "post": { "security": [ { @@ -513,30 +912,27 @@ var doc = `{ } ], "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ - "casbin" + "ExaFileUploadAndDownload" ], - "summary": "获取权限列表", + "summary": "查找文件", "parameters": [ { - "description": "获取权限列表", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" - } + "type": "file", + "description": "查找文件", + "name": "file", + "in": "formData", + "required": true } ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"查找成功\"}", "schema": { "type": "string" } @@ -544,35 +940,38 @@ var doc = `{ } } }, - "/fileUploadAndDownload/deleteFile": { + "/fileUploadAndDownload/getFileList": { "post": { "security": [ { "ApiKeyAuth": [] } ], + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ "ExaFileUploadAndDownload" ], - "summary": "删除文件", + "summary": "分页文件列表", "parameters": [ { - "description": "传入文件里面id即可", + "description": "分页获取文件户列表", "name": "data", "in": "body", "required": true, "schema": { "type": "object", - "$ref": "#/definitions/dbModel.ExaFileUploadAndDownload" + "$ref": "#/definitions/modelInterface.PageInfo" } } ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", "schema": { "type": "string" } @@ -580,7 +979,7 @@ var doc = `{ } } }, - "/fileUploadAndDownload/getFileList": { + "/fileUploadAndDownload/removeChunk": { "post": { "security": [ { @@ -588,7 +987,7 @@ var doc = `{ } ], "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" @@ -596,22 +995,19 @@ var doc = `{ "tags": [ "ExaFileUploadAndDownload" ], - "summary": "分页文件列表", + "summary": "删除切片", "parameters": [ { - "description": "分页获取文件户列表", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/modelInterface.PageInfo" - } + "type": "file", + "description": "查找文件", + "name": "file", + "in": "formData", + "required": true } ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"查找成功\"}", "schema": { "type": "string" } @@ -988,6 +1384,102 @@ var doc = `{ } } }, + "/system/ReloadSystem": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "system" + ], + "summary": "设置配置文件内容", + "parameters": [ + { + "description": "设置配置文件内容", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/sysModel.System" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/system/getSystemConfig": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "system" + ], + "summary": "获取配置文件内容", + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/system/setSystemConfig": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "system" + ], + "summary": "设置配置文件内容", + "parameters": [ + { + "description": "设置配置文件内容", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/sysModel.System" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/user/changePassword": { "post": { "security": [ @@ -1263,6 +1755,12 @@ var doc = `{ "api.RegistAndLoginStuct": { "type": "object", "properties": { + "captcha": { + "type": "string" + }, + "captchaId": { + "type": "string" + }, "password": { "type": "string" }, @@ -1282,6 +1780,132 @@ var doc = `{ } } }, + "config.CasbinConfig": { + "type": "object", + "properties": { + "modelPath": { + "description": "casbin model地址配置", + "type": "string" + } + } + }, + "config.Config": { + "type": "object", + "properties": { + "casbinConfig": { + "type": "object", + "$ref": "#/definitions/config.CasbinConfig" + }, + "jwt": { + "type": "object", + "$ref": "#/definitions/config.JWT" + }, + "mysqlAdmin": { + "type": "object", + "$ref": "#/definitions/config.MysqlAdmin" + }, + "qiniu": { + "type": "object", + "$ref": "#/definitions/config.Qiniu" + }, + "redisAdmin": { + "type": "object", + "$ref": "#/definitions/config.RedisAdmin" + }, + "system": { + "type": "object", + "$ref": "#/definitions/config.System" + } + } + }, + "config.JWT": { + "type": "object", + "properties": { + "signingKey": { + "type": "string" + } + } + }, + "config.MysqlAdmin": { + "type": "object", + "properties": { + "config": { + "type": "string" + }, + "dbname": { + "type": "string" + }, + "password": { + "type": "string" + }, + "path": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "config.Qiniu": { + "type": "object", + "properties": { + "accessKey": { + "type": "string" + }, + "secretKey": { + "type": "string" + } + } + }, + "config.RedisAdmin": { + "type": "object", + "properties": { + "addr": { + "type": "string" + }, + "db": { + "type": "integer" + }, + "password": { + "type": "string" + } + } + }, + "config.System": { + "type": "object", + "properties": { + "addr": { + "type": "integer" + }, + "env": { + "type": "string" + }, + "useMultipoint": { + "type": "boolean" + } + } + }, + "dbModel.ExaCustomer": { + "type": "object", + "properties": { + "customerName": { + "type": "string" + }, + "customerPhoneData": { + "type": "string" + }, + "sysUser": { + "type": "object", + "$ref": "#/definitions/sysModel.SysUser" + }, + "sysUserAuthorityID": { + "type": "string" + }, + "sysUserId": { + "type": "integer" + } + } + }, "dbModel.ExaFileUploadAndDownload": { "type": "object", "properties": { @@ -1310,6 +1934,31 @@ var doc = `{ } } }, + "sysModel.CasbinInReceive": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + }, + "casbinInfos": { + "type": "array", + "items": { + "$ref": "#/definitions/sysModel.CasbinInfo" + } + } + } + }, + "sysModel.CasbinInfo": { + "type": "object", + "properties": { + "method": { + "type": "string" + }, + "path": { + "type": "string" + } + } + }, "sysModel.SysApi": { "type": "object", "properties": { @@ -1319,6 +1968,9 @@ var doc = `{ "group": { "type": "string" }, + "method": { + "type": "string" + }, "path": { "type": "string" } @@ -1464,6 +2116,15 @@ var doc = `{ "type": "integer" } } + }, + "sysModel.System": { + "type": "object", + "properties": { + "config": { + "type": "object", + "$ref": "#/definitions/config.Config" + } + } } }, "securityDefinitions": { diff --git a/QMPlusServer/docs/swagger.json b/QMPlusServer/docs/swagger.json index fd84f14bc6af05a34595d04d82820a2e348474c9..622be52ff6a0171ec59e93aec8f9971eb0ae7aa1 100644 --- a/QMPlusServer/docs/swagger.json +++ b/QMPlusServer/docs/swagger.json @@ -387,6 +387,60 @@ } } }, + "/base/captcha": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "base" + ], + "summary": "生成验证码", + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/base/captcha/": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "base" + ], + "summary": "生成验证码图片路径", + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/base/login": { "post": { "produces": [ @@ -449,6 +503,45 @@ } } }, + "/casbin/CasbinTest": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "casbin" + ], + "summary": "casb RBAC RESTFUL测试路由", + "parameters": [ + { + "description": "获取权限列表", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/api.CreateAuthorityParams" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/casbin/casbinPUpdata": { "post": { "security": [ @@ -474,13 +567,319 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" + "$ref": "#/definitions/sysModel.CasbinInReceive" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/casbin/getPolicyPathByAuthorityId": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "casbin" + ], + "summary": "获取权限列表", + "parameters": [ + { + "description": "获取权限列表", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/api.CreateAuthorityParams" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/createExaCustomer": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "创建客户", + "parameters": [ + { + "description": "创建客户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/deleteExaCustomer": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "删除客户", + "parameters": [ + { + "description": "删除客户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/getExaCustomer": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "获取单一客户信息", + "parameters": [ + { + "description": "获取单一客户信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/getExaCustomerList": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "获取权限客户列表", + "parameters": [ + { + "description": "获取权限客户列表", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/modelInterface.PageInfo" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/customer/updataExaCustomer": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "更新客户信息", + "parameters": [ + { + "description": "创建客户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/fileUploadAndDownload/breakpointContinue": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "multipart/form-data" + ], + "produces": [ + "application/json" + ], + "tags": [ + "ExaFileUploadAndDownload" + ], + "summary": "断点续传到服务器", + "parameters": [ + { + "type": "file", + "description": "断点续传示例", + "name": "file", + "in": "formData", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"上传成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/fileUploadAndDownload/deleteFile": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "ExaFileUploadAndDownload" + ], + "summary": "删除文件", + "parameters": [ + { + "description": "传入文件里面id即可", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/dbModel.ExaFileUploadAndDownload" } } ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", "schema": { "type": "string" } @@ -488,7 +887,7 @@ } } }, - "/casbin/getPolicyPathByAuthorityId": { + "/fileUploadAndDownload/findFile": { "post": { "security": [ { @@ -496,30 +895,27 @@ } ], "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ - "casbin" + "ExaFileUploadAndDownload" ], - "summary": "获取权限列表", + "summary": "查找文件", "parameters": [ { - "description": "获取权限列表", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" - } + "type": "file", + "description": "查找文件", + "name": "file", + "in": "formData", + "required": true } ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"查找成功\"}", "schema": { "type": "string" } @@ -527,35 +923,38 @@ } } }, - "/fileUploadAndDownload/deleteFile": { + "/fileUploadAndDownload/getFileList": { "post": { "security": [ { "ApiKeyAuth": [] } ], + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ "ExaFileUploadAndDownload" ], - "summary": "删除文件", + "summary": "分页文件列表", "parameters": [ { - "description": "传入文件里面id即可", + "description": "分页获取文件户列表", "name": "data", "in": "body", "required": true, "schema": { "type": "object", - "$ref": "#/definitions/dbModel.ExaFileUploadAndDownload" + "$ref": "#/definitions/modelInterface.PageInfo" } } ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", "schema": { "type": "string" } @@ -563,7 +962,7 @@ } } }, - "/fileUploadAndDownload/getFileList": { + "/fileUploadAndDownload/removeChunk": { "post": { "security": [ { @@ -571,7 +970,7 @@ } ], "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" @@ -579,22 +978,19 @@ "tags": [ "ExaFileUploadAndDownload" ], - "summary": "分页文件列表", + "summary": "删除切片", "parameters": [ { - "description": "分页获取文件户列表", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/modelInterface.PageInfo" - } + "type": "file", + "description": "查找文件", + "name": "file", + "in": "formData", + "required": true } ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"查找成功\"}", "schema": { "type": "string" } @@ -971,6 +1367,102 @@ } } }, + "/system/ReloadSystem": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "system" + ], + "summary": "设置配置文件内容", + "parameters": [ + { + "description": "设置配置文件内容", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/sysModel.System" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/system/getSystemConfig": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "system" + ], + "summary": "获取配置文件内容", + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/system/setSystemConfig": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "system" + ], + "summary": "设置配置文件内容", + "parameters": [ + { + "description": "设置配置文件内容", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/sysModel.System" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"返回成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/user/changePassword": { "post": { "security": [ @@ -1246,6 +1738,12 @@ "api.RegistAndLoginStuct": { "type": "object", "properties": { + "captcha": { + "type": "string" + }, + "captchaId": { + "type": "string" + }, "password": { "type": "string" }, @@ -1265,6 +1763,132 @@ } } }, + "config.CasbinConfig": { + "type": "object", + "properties": { + "modelPath": { + "description": "casbin model地址配置", + "type": "string" + } + } + }, + "config.Config": { + "type": "object", + "properties": { + "casbinConfig": { + "type": "object", + "$ref": "#/definitions/config.CasbinConfig" + }, + "jwt": { + "type": "object", + "$ref": "#/definitions/config.JWT" + }, + "mysqlAdmin": { + "type": "object", + "$ref": "#/definitions/config.MysqlAdmin" + }, + "qiniu": { + "type": "object", + "$ref": "#/definitions/config.Qiniu" + }, + "redisAdmin": { + "type": "object", + "$ref": "#/definitions/config.RedisAdmin" + }, + "system": { + "type": "object", + "$ref": "#/definitions/config.System" + } + } + }, + "config.JWT": { + "type": "object", + "properties": { + "signingKey": { + "type": "string" + } + } + }, + "config.MysqlAdmin": { + "type": "object", + "properties": { + "config": { + "type": "string" + }, + "dbname": { + "type": "string" + }, + "password": { + "type": "string" + }, + "path": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "config.Qiniu": { + "type": "object", + "properties": { + "accessKey": { + "type": "string" + }, + "secretKey": { + "type": "string" + } + } + }, + "config.RedisAdmin": { + "type": "object", + "properties": { + "addr": { + "type": "string" + }, + "db": { + "type": "integer" + }, + "password": { + "type": "string" + } + } + }, + "config.System": { + "type": "object", + "properties": { + "addr": { + "type": "integer" + }, + "env": { + "type": "string" + }, + "useMultipoint": { + "type": "boolean" + } + } + }, + "dbModel.ExaCustomer": { + "type": "object", + "properties": { + "customerName": { + "type": "string" + }, + "customerPhoneData": { + "type": "string" + }, + "sysUser": { + "type": "object", + "$ref": "#/definitions/sysModel.SysUser" + }, + "sysUserAuthorityID": { + "type": "string" + }, + "sysUserId": { + "type": "integer" + } + } + }, "dbModel.ExaFileUploadAndDownload": { "type": "object", "properties": { @@ -1293,6 +1917,31 @@ } } }, + "sysModel.CasbinInReceive": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + }, + "casbinInfos": { + "type": "array", + "items": { + "$ref": "#/definitions/sysModel.CasbinInfo" + } + } + } + }, + "sysModel.CasbinInfo": { + "type": "object", + "properties": { + "method": { + "type": "string" + }, + "path": { + "type": "string" + } + } + }, "sysModel.SysApi": { "type": "object", "properties": { @@ -1302,6 +1951,9 @@ "group": { "type": "string" }, + "method": { + "type": "string" + }, "path": { "type": "string" } @@ -1447,6 +2099,15 @@ "type": "integer" } } + }, + "sysModel.System": { + "type": "object", + "properties": { + "config": { + "type": "object", + "$ref": "#/definitions/config.Config" + } + } } }, "securityDefinitions": { diff --git a/QMPlusServer/docs/swagger.yaml b/QMPlusServer/docs/swagger.yaml index cbde0d449d30946befbd88de367a83b4d35a64ac..78c28848050d697a51a6208f41d436fdf747ccd5 100644 --- a/QMPlusServer/docs/swagger.yaml +++ b/QMPlusServer/docs/swagger.yaml @@ -54,6 +54,10 @@ definitions: type: object api.RegistAndLoginStuct: properties: + captcha: + type: string + captchaId: + type: string password: type: string username: @@ -66,6 +70,90 @@ definitions: uuid: type: string type: object + config.CasbinConfig: + properties: + modelPath: + description: casbin model地址配置 + type: string + type: object + config.Config: + properties: + casbinConfig: + $ref: '#/definitions/config.CasbinConfig' + type: object + jwt: + $ref: '#/definitions/config.JWT' + type: object + mysqlAdmin: + $ref: '#/definitions/config.MysqlAdmin' + type: object + qiniu: + $ref: '#/definitions/config.Qiniu' + type: object + redisAdmin: + $ref: '#/definitions/config.RedisAdmin' + type: object + system: + $ref: '#/definitions/config.System' + type: object + type: object + config.JWT: + properties: + signingKey: + type: string + type: object + config.MysqlAdmin: + properties: + config: + type: string + dbname: + type: string + password: + type: string + path: + type: string + username: + type: string + type: object + config.Qiniu: + properties: + accessKey: + type: string + secretKey: + type: string + type: object + config.RedisAdmin: + properties: + addr: + type: string + db: + type: integer + password: + type: string + type: object + config.System: + properties: + addr: + type: integer + env: + type: string + useMultipoint: + type: boolean + type: object + dbModel.ExaCustomer: + properties: + customerName: + type: string + customerPhoneData: + type: string + sysUser: + $ref: '#/definitions/sysModel.SysUser' + type: object + sysUserAuthorityID: + type: string + sysUserId: + type: integer + type: object dbModel.ExaFileUploadAndDownload: properties: key: @@ -84,12 +172,30 @@ definitions: pageSize: type: integer type: object + sysModel.CasbinInReceive: + properties: + authorityId: + type: string + casbinInfos: + items: + $ref: '#/definitions/sysModel.CasbinInfo' + type: array + type: object + sysModel.CasbinInfo: + properties: + method: + type: string + path: + type: string + type: object sysModel.SysApi: properties: description: type: string group: type: string + method: + type: string path: type: string type: object @@ -189,6 +295,12 @@ definitions: description: 所属工作流ID type: integer type: object + sysModel.System: + properties: + config: + $ref: '#/definitions/config.Config' + type: object + type: object info: contact: {} description: This is a sample Server pets @@ -428,6 +540,38 @@ paths: summary: 设置角色资源权限 tags: - authority + /base/captcha: + post: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 生成验证码 + tags: + - base + /base/captcha/: + get: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 生成验证码图片路径 + tags: + - base /base/login: post: parameters: @@ -468,6 +612,30 @@ paths: summary: 用户注册账号 tags: - Base + /casbin/CasbinTest: + get: + consumes: + - application/json + parameters: + - description: 获取权限列表 + in: body + name: data + required: true + schema: + $ref: '#/definitions/api.CreateAuthorityParams' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: casb RBAC RESTFUL测试路由 + tags: + - casbin /casbin/casbinPUpdata: post: consumes: @@ -478,7 +646,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.CreateAuthorityParams' + $ref: '#/definitions/sysModel.CasbinInReceive' type: object produces: - application/json @@ -516,6 +684,148 @@ paths: summary: 获取权限列表 tags: - casbin + /customer/createExaCustomer: + post: + consumes: + - application/json + parameters: + - description: 创建客户 + in: body + name: data + required: true + schema: + $ref: '#/definitions/dbModel.ExaCustomer' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 创建客户 + tags: + - SysApi + /customer/deleteExaCustomer: + post: + consumes: + - application/json + parameters: + - description: 删除客户 + in: body + name: data + required: true + schema: + $ref: '#/definitions/dbModel.ExaCustomer' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 删除客户 + tags: + - SysApi + /customer/getExaCustomer: + post: + consumes: + - application/json + parameters: + - description: 获取单一客户信息 + in: body + name: data + required: true + schema: + $ref: '#/definitions/dbModel.ExaCustomer' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 获取单一客户信息 + tags: + - SysApi + /customer/getExaCustomerList: + post: + consumes: + - application/json + parameters: + - description: 获取权限客户列表 + in: body + name: data + required: true + schema: + $ref: '#/definitions/modelInterface.PageInfo' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 获取权限客户列表 + tags: + - SysApi + /customer/updataExaCustomer: + post: + consumes: + - application/json + parameters: + - description: 创建客户 + in: body + name: data + required: true + schema: + $ref: '#/definitions/dbModel.ExaCustomer' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 更新客户信息 + tags: + - SysApi + /fileUploadAndDownload/breakpointContinue: + post: + consumes: + - multipart/form-data + parameters: + - description: 断点续传示例 + in: formData + name: file + required: true + type: file + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"上传成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 断点续传到服务器 + tags: + - ExaFileUploadAndDownload /fileUploadAndDownload/deleteFile: post: parameters: @@ -538,6 +848,28 @@ paths: summary: 删除文件 tags: - ExaFileUploadAndDownload + /fileUploadAndDownload/findFile: + post: + consumes: + - multipart/form-data + parameters: + - description: 查找文件 + in: formData + name: file + required: true + type: file + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"查找成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 查找文件 + tags: + - ExaFileUploadAndDownload /fileUploadAndDownload/getFileList: post: consumes: @@ -562,6 +894,28 @@ paths: summary: 分页文件列表 tags: - ExaFileUploadAndDownload + /fileUploadAndDownload/removeChunk: + post: + consumes: + - multipart/form-data + parameters: + - description: 查找文件 + in: formData + name: file + required: true + type: file + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"查找成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 删除切片 + tags: + - ExaFileUploadAndDownload /fileUploadAndDownload/upload: post: consumes: @@ -788,6 +1142,64 @@ paths: summary: 更新菜单 tags: - menu + /system/ReloadSystem: + post: + parameters: + - description: 设置配置文件内容 + in: body + name: data + required: true + schema: + $ref: '#/definitions/sysModel.System' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"返回成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 设置配置文件内容 + tags: + - system + /system/getSystemConfig: + post: + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"返回成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 获取配置文件内容 + tags: + - system + /system/setSystemConfig: + post: + parameters: + - description: 设置配置文件内容 + in: body + name: data + required: true + schema: + $ref: '#/definitions/sysModel.System' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"返回成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 设置配置文件内容 + tags: + - system /user/changePassword: post: parameters: diff --git a/QMPlusServer/go.mod b/QMPlusServer/go.mod index 380387bc7678e51b927adf4c359e8ef3c3a00368..2e6f8f9b5d6370e15f8398c15dc02357389abe52 100644 --- a/QMPlusServer/go.mod +++ b/QMPlusServer/go.mod @@ -6,10 +6,10 @@ require ( github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc github.com/casbin/casbin v1.9.1 github.com/casbin/gorm-adapter v1.0.0 + github.com/dchest/captcha v0.0.0-20170622155422-6a29415a8364 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect github.com/fsnotify/fsnotify v1.4.7 - github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 github.com/gin-gonic/gin v1.4.0 github.com/go-redis/redis v6.15.6+incompatible github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect diff --git a/QMPlusServer/router/sys_base.go b/QMPlusServer/router/sys_base.go index 3ebf01cd00a35fb3222d0ed6bbbaf930b5f41a1b..5c25ee7a22a683de9d630830076677c226a971d6 100644 --- a/QMPlusServer/router/sys_base.go +++ b/QMPlusServer/router/sys_base.go @@ -10,6 +10,8 @@ func InitBaseRouter(Router *gin.RouterGroup) (R gin.IRoutes) { { BaseRouter.POST("regist", api.Regist) BaseRouter.POST("login", api.Login) + BaseRouter.POST("captcha",api.Captcha) + BaseRouter.GET("captcha/:captchaId",api.CaptchaImg) } return BaseRouter } diff --git a/QMPlusServer/static/config/config.json b/QMPlusServer/static/config/config.json index 78acfd3b63e4332d9a48212206d21559efcf039d..ccdec3c722ec5fd54575268d5506277907c95717 100644 --- a/QMPlusServer/static/config/config.json +++ b/QMPlusServer/static/config/config.json @@ -25,5 +25,10 @@ "useMultipoint": false, "env": "develop", "addr": 8888 + }, + "captcha": { + "keyLong": 6, + "imgWidth": 120, + "imgHeight": 40 } } \ No newline at end of file diff --git a/QMPlusVuePage/src/api/user.js b/QMPlusVuePage/src/api/user.js index 375e3c7763ecc43fdd99aa908b17ee127037156f..d503d993573edecd9c21de7142f6a2a349b64ae1 100644 --- a/QMPlusVuePage/src/api/user.js +++ b/QMPlusVuePage/src/api/user.js @@ -12,36 +12,48 @@ export const login = (data) => { }) } -// @Summary 用户注册 +// @Summary 获取验证码 // @Produce application/json // @Param data body {username:"string",password:"string"} -// @Router /base/resige [post] -export const regist = (data) => { +// @Router /base/captcha [post] +export const captcha = (data) => { return service({ - url: "/base/regist", + url: "/base/captcha", method: 'post', data: data }) } -// @Summary 修改密码 + +// @Summary 用户注册 // @Produce application/json -// @Param data body {username:"string",password:"string",newPassword:"string"} -// @Router /user/changePassword [post] +// @Param data body {username:"string",password:"string"} +// @Router /base/resige [post] +export const regist = (data) => { + return service({ + url: "/base/regist", + method: 'post', + data: data + }) + } + // @Summary 修改密码 + // @Produce application/json + // @Param data body {username:"string",password:"string",newPassword:"string"} + // @Router /user/changePassword [post] export const changePassword = (data) => { - return service({ - url: "/user/changePassword", - method: 'post', - data: data - }) -} -// @Tags User -// @Summary 分页获取用户列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body modelInterface.PageInfo true "分页获取用户列表" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" -// @Router /user/getUserList [post] + return service({ + url: "/user/changePassword", + method: 'post', + data: data + }) + } + // @Tags User + // @Summary 分页获取用户列表 + // @Security ApiKeyAuth + // @accept application/json + // @Produce application/json + // @Param data body modelInterface.PageInfo true "分页获取用户列表" + // @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" + // @Router /user/getUserList [post] export const getUserList = (data) => { return service({ url: "/user/getUserList", @@ -65,20 +77,4 @@ export const setUserAuthority = (data) => { method: 'post', data: data }) -} - -// @Tags User -// @Summary 验证码 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body api.SetUserAuth true "设置用户权限" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"修改成功"}" -// @Router /user/setUserAuthority [post] -export const captcha = (data) => { - return service({ - url: "/base/captcha", - method: 'post', - data: data - }) -} +} \ No newline at end of file diff --git a/QMPlusVuePage/src/view/login/login.vue b/QMPlusVuePage/src/view/login/login.vue index 0b7d168bd9263a00e39de03dfb9ea34693e82d31..ac98838527bf4993c7b33a6b146ef10d61cafc75 100644 --- a/QMPlusVuePage/src/view/login/login.vue +++ b/QMPlusVuePage/src/view/login/login.vue @@ -16,10 +16,11 @@ - + 请输入验证码 @@ -98,7 +99,6 @@ export default { this.lock === 'lock' ? (this.lock = 'unlock') : (this.lock = 'lock') }, loginVefify() { - console.log(this.logVerify) captcha({}).then(ele=>{ this.picPath = ele.data.picPath this.loginForm.captchaId = ele.data.captchaId @@ -122,6 +122,7 @@ export default { .vPic{ position: absolute; right: 10px; + bottom: 0px; // 适配ie } } diff --git a/QMPlusVuePage/src/view/superAdmin/api/api.vue b/QMPlusVuePage/src/view/superAdmin/api/api.vue index e2829ef43a859cd5a62e605526c495cf8c44f842..0c2e269e540eecc2a16a5e496fbc8a4d66739656 100644 --- a/QMPlusVuePage/src/view/superAdmin/api/api.vue +++ b/QMPlusVuePage/src/view/superAdmin/api/api.vue @@ -25,14 +25,15 @@ {{scope.row.method|methodFiletr}} + size="mini" + effect="dark"> + {{scope.row.method|methodFiletr}} + - +