提交 5d871db8 编写于 作者: R rainyan

correct all comments of functions in service

上级 b61ed477
...@@ -28,7 +28,7 @@ require ( ...@@ -28,7 +28,7 @@ require (
github.com/onsi/gomega v1.4.3 // indirect github.com/onsi/gomega v1.4.3 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/pelletier/go-toml v1.6.0 // indirect github.com/pelletier/go-toml v1.6.0 // indirect
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1 // indirect
github.com/qiniu/api.v7 v7.2.5+incompatible github.com/qiniu/api.v7 v7.2.5+incompatible
github.com/qiniu/x v7.0.8+incompatible // indirect github.com/qiniu/x v7.0.8+incompatible // indirect
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
......
...@@ -8,20 +8,20 @@ import ( ...@@ -8,20 +8,20 @@ import (
// @title FindOrCreateFile // @title FindOrCreateFile
// @description Check your file if it does not exist, or return current slice of the file // @description Check your file if it does not exist, or return current slice of the file
// 上传文件时检测当前文件属性,如果没有文件则创建,有则返回文件的当前切片 // 上传文件时检测当前文件属性,如果没有文件则创建,有则返回文件的当前切片
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param fileMd5 string
// @param FileName string // @param fileName string
// @param ChunkTotal int // @param chunkTotal int
// @return err error // @return err error
// @return file ExaFile // @return file ExaFile
func FindOrCreateFile(FileMd5 string, FileName string, ChunkTotal int) (err error, file model.ExaFile) { func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err error, file model.ExaFile) {
var cfile model.ExaFile var cfile model.ExaFile
cfile.FileMd5 = FileMd5 cfile.FileMd5 = fileMd5
cfile.FileName = FileName cfile.FileName = fileName
cfile.ChunkTotal = ChunkTotal cfile.ChunkTotal = chunkTotal
notHaveSameMd5Finish := global.GVA_DB.Where("file_md5 = ? AND is_finish = ?", FileMd5, true).First(&file).RecordNotFound() notHaveSameMd5Finish := global.GVA_DB.Where("file_md5 = ? AND is_finish = ?", fileMd5, true).First(&file).RecordNotFound()
if notHaveSameMd5Finish { if notHaveSameMd5Finish {
err = global.GVA_DB.Where("file_md5 = ? AND file_name = ?", FileMd5, FileName).Preload("ExaFileChunk").FirstOrCreate(&file, cfile).Error err = global.GVA_DB.Where("file_md5 = ? AND file_name = ?", fileMd5, fileName).Preload("ExaFileChunk").FirstOrCreate(&file, cfile).Error
return err, file return err, file
} else { } else {
cfile.IsFinish = true cfile.IsFinish = true
...@@ -34,38 +34,39 @@ func FindOrCreateFile(FileMd5 string, FileName string, ChunkTotal int) (err err ...@@ -34,38 +34,39 @@ func FindOrCreateFile(FileMd5 string, FileName string, ChunkTotal int) (err err
// @title CreateFileChunk // @title CreateFileChunk
// @description create a chunk of the file, 创建文件切片记录 // @description create a chunk of the file, 创建文件切片记录
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param FileChunkPath string // @param id unit
// @param FileChunkNumber int // @param fileChunkPath string
// @param fileChunkNumber int
// @return error // @return error
func CreateFileChunk(id uint, FileChunkPath string, FileChunkNumber int) error { func CreateFileChunk(id uint, fileChunkPath string, fileChunkNumber int) error {
var chunk model.ExaFileChunk var chunk model.ExaFileChunk
chunk.FileChunkPath = FileChunkPath chunk.FileChunkPath = fileChunkPath
chunk.ExaFileId = id chunk.ExaFileId = id
chunk.FileChunkNumber = FileChunkNumber chunk.FileChunkNumber = fileChunkNumber
err := global.GVA_DB.Create(&chunk).Error err := global.GVA_DB.Create(&chunk).Error
return err return err
} }
// @title FileCreateComplete // @title FileCreateComplete
// @description file creation, 文件合成完成 // @description file creation, 文件合成完成
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param fileMd5 string
// @param FileName string // @param fileName string
// @param FilePath string // @param filePath string
// @return error // @return error
func FileCreateComplete(FileMd5 string, FileName string, FilePath string) error { func FileCreateComplete(fileMd5 string, fileName string, filePath string) error {
var file model.ExaFile var file model.ExaFile
upDateFile := make(map[string]interface{}) upDateFile := make(map[string]interface{})
upDateFile["FilePath"] = FilePath upDateFile["FilePath"] = filePath
upDateFile["IsFinish"] = true upDateFile["IsFinish"] = true
err := global.GVA_DB.Where("file_md5 = ? AND file_name = ?", FileMd5, FileName).First(&file).Updates(upDateFile).Error err := global.GVA_DB.Where("file_md5 = ? AND file_name = ?", fileMd5, fileName).First(&file).Updates(upDateFile).Error
return err return err
} }
// @title DeleteFileChunk // @title DeleteFileChunk
// @description delete a chuck of the file, 删除文件切片记录 // @description delete a chuck of the file, 删除文件切片记录
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param FileMd5 string
// @param FileName string // @param FileName string
// @param FilePath string // @param FilePath string
......
...@@ -8,7 +8,8 @@ import ( ...@@ -8,7 +8,8 @@ import (
// @title CreateExaCustomer // @title CreateExaCustomer
// @description create a customer, 创建用户 // @description create a customer, 创建用户
// @auth (2020/04/05 20:22 ) // @param e model.ExaCustomer
// @auth (2020/04/05 20:22)
// @return err error // @return err error
func CreateExaCustomer(e model.ExaCustomer) (err error) { func CreateExaCustomer(e model.ExaCustomer) (err error) {
err = global.GVA_DB.Create(&e).Error err = global.GVA_DB.Create(&e).Error
...@@ -17,7 +18,8 @@ func CreateExaCustomer(e model.ExaCustomer) (err error) { ...@@ -17,7 +18,8 @@ func CreateExaCustomer(e model.ExaCustomer) (err error) {
// @title DeleteFileChunk // @title DeleteFileChunk
// @description delete a customer, 删除用户 // @description delete a customer, 删除用户
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param e *model.ExaCustomer
// @return error // @return error
func DeleteExaCustomer(e model.ExaCustomer) (err error) { func DeleteExaCustomer(e model.ExaCustomer) (err error) {
err = global.GVA_DB.Delete(e).Error err = global.GVA_DB.Delete(e).Error
...@@ -26,7 +28,8 @@ func DeleteExaCustomer(e model.ExaCustomer) (err error) { ...@@ -26,7 +28,8 @@ func DeleteExaCustomer(e model.ExaCustomer) (err error) {
// @title UpdateExaCustomer // @title UpdateExaCustomer
// @description update a customer, 更新用户 // @description update a customer, 更新用户
// @auth (2020/04/05 20:22 ) // @param e *model.ExaCustomer
// @auth (2020/04/05 20:22)
// @return error // @return error
func UpdateExaCustomer(e *model.ExaCustomer) (err error) { func UpdateExaCustomer(e *model.ExaCustomer) (err error) {
err = global.GVA_DB.Save(e).Error err = global.GVA_DB.Save(e).Error
...@@ -35,7 +38,8 @@ func UpdateExaCustomer(e *model.ExaCustomer) (err error) { ...@@ -35,7 +38,8 @@ func UpdateExaCustomer(e *model.ExaCustomer) (err error) {
// @title GetExaCustomer // @title GetExaCustomer
// @description get the info of a costumer , 获取用户信息 // @description get the info of a costumer , 获取用户信息
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param id uint
// @return error // @return error
// @return customer ExaCustomer // @return customer ExaCustomer
func GetExaCustomer(id uint) (err error, customer model.ExaCustomer) { func GetExaCustomer(id uint) (err error, customer model.ExaCustomer) {
...@@ -45,7 +49,8 @@ func GetExaCustomer(id uint) (err error, customer model.ExaCustomer) { ...@@ -45,7 +49,8 @@ func GetExaCustomer(id uint) (err error, customer model.ExaCustomer) {
// @title GetCustomerInfoList // @title GetCustomerInfoList
// @description get customer list by pagination, 分页获取用户列表 // @description get customer list by pagination, 分页获取用户列表
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param sysUserAuthorityID string
// @param info PageInfo // @param info PageInfo
// @return error // @return error
func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err error, list interface{}, total int) { func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err error, list interface{}, total int) {
......
...@@ -8,16 +8,18 @@ import ( ...@@ -8,16 +8,18 @@ import (
// @title Upload // @title Upload
// @description 创建文件上传记录 // @description 创建文件上传记录
// @auth (2020/04/05 20:22 ) // @param file model.ExaFileUploadAndDownload
// @auth (2020/04/05 20:22)
// @return error // @return error
func Upload(f model.ExaFileUploadAndDownload) error { func Upload(file model.ExaFileUploadAndDownload) error {
err := global.GVA_DB.Create(&f).Error err := global.GVA_DB.Create(&file).Error
return err return err
} }
// @title FindFile // @title FindFile
// @description 删除文件切片记录 // @description 删除文件切片记录
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param id uint
// @return error // @return error
func FindFile(id uint) (error, model.ExaFileUploadAndDownload) { func FindFile(id uint) (error, model.ExaFileUploadAndDownload) {
var file model.ExaFileUploadAndDownload var file model.ExaFileUploadAndDownload
...@@ -27,16 +29,17 @@ func FindFile(id uint) (error, model.ExaFileUploadAndDownload) { ...@@ -27,16 +29,17 @@ func FindFile(id uint) (error, model.ExaFileUploadAndDownload) {
// @title DeleteFile // @title DeleteFile
// @description 删除文件记录 // @description 删除文件记录
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param file model.ExaFileUploadAndDownload
// @return error // @return error
func DeleteFile(f model.ExaFileUploadAndDownload) error { func DeleteFile(file model.ExaFileUploadAndDownload) error {
err := global.GVA_DB.Where("id = ?", f.ID).Unscoped().Delete(f).Error err := global.GVA_DB.Where("id = ?", file.ID).Unscoped().Delete(file).Error
return err return err
} }
// @title GetFileRecordInfoList // @title GetFileRecordInfoList
// @description 分页获取数据 // @description 分页获取数据
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param info PageInfo // @param info PageInfo
// @return err error // @return err error
// @return list error // @return list error
......
...@@ -7,39 +7,43 @@ import ( ...@@ -7,39 +7,43 @@ import (
// @title JsonInBlacklist // @title JsonInBlacklist
// @description create jwt blacklist // @description create jwt blacklist
// @auth (2020/04/05 20:22 ) // @param jwtList model.JwtBlacklist
// @auth (2020/04/05 20:22)
// @return err error // @return err error
func JsonInBlacklist(j model.JwtBlacklist) (err error) { func JsonInBlacklist(jwtList model.JwtBlacklist) (err error) {
err = global.GVA_DB.Create(&j).Error err = global.GVA_DB.Create(&jwtList).Error
return return
} }
// @title IsBlacklist // @title IsBlacklist
// @description check if the Jwt is in the blacklist or not, 判断JWT是否在黑名单内部 // @description check if the Jwt is in the blacklist or not, 判断JWT是否在黑名单内部
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param newPassword string // @param jwt string
// @param jwtList model.JwtBlacklist
// @return err error // @return err error
func IsBlacklist(Jwt string, j model.JwtBlacklist) bool { func IsBlacklist(jwt string, jwtList model.JwtBlacklist) bool {
isNotFound := global.GVA_DB.Where("jwt = ?", Jwt).First(&j).RecordNotFound() isNotFound := global.GVA_DB.Where("jwt = ?", jwt).First(&jwtList).RecordNotFound()
return !isNotFound return !isNotFound
} }
// @title GetRedisJWT // @title GetRedisJWT
// @description Get user info in redis // @description Get user info in redis
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param newPassword string // @param userName string
// @return err error // @return err error
func GetRedisJWT(userName string) (err error, RedisJWT string) { // @return redisJWT string
RedisJWT, err = global.GVA_REDIS.Get(userName).Result() func GetRedisJWT(userName string) (err error, redisJWT string) {
return err, RedisJWT redisJWT, err = global.GVA_REDIS.Get(userName).Result()
return err, redisJWT
} }
// @title SetRedisJWT // @title SetRedisJWT
// @description set jwt into the Redis // @description set jwt into the Redis
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param jwtList model.JwtBlacklist
// @param userName string // @param userName string
// @return err error // @return err error
func SetRedisJWT(j model.JwtBlacklist, userName string) (err error) { func SetRedisJWT(jwtList model.JwtBlacklist, userName string) (err error) {
err = global.GVA_REDIS.Set(userName, j.Jwt, 1000*1000*1000*60*60*24*7).Err() err = global.GVA_REDIS.Set(userName, jwtList.Jwt, 1000*1000*1000*60*60*24*7).Err()
return err return err
} }
...@@ -9,54 +9,56 @@ import ( ...@@ -9,54 +9,56 @@ import (
// @title CreateApi // @title CreateApi
// @description create base apis, 新增基础api // @description create base apis, 新增基础api
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param api model.SysApi
// @param FileName string
// @param FilePath string
// @return error // @return error
func CreateApi(a model.SysApi) (err error) { func CreateApi(api model.SysApi) (err error) {
findOne := global.GVA_DB.Where("path = ? AND method = ?", a.Path, a.Method).Find(&model.SysApi{}).Error findOne := global.GVA_DB.Where("path = ? AND method = ?", api.Path, api.Method).Find(&model.SysApi{}).Error
if findOne == nil { if findOne == nil {
return errors.New("存在相同api") return errors.New("存在相同api")
} else { } else {
err = global.GVA_DB.Create(&a).Error err = global.GVA_DB.Create(&api).Error
} }
return err return err
} }
// @title DeleteApi // @title DeleteApi
// @description delete base apis, 删除基础api // @description delete a base api, 删除基础api
// @auth (2020/04/05 20:22 ) // @param api model.SysApi
// @auth (2020/04/05 20:22)
// @return error // @return error
func DeleteApi(a model.SysApi) (err error) { func DeleteApi(api model.SysApi) (err error) {
err = global.GVA_DB.Delete(a).Error err = global.GVA_DB.Delete(api).Error
ClearCasbin(1, a.Path, a.Method) ClearCasbin(1, api.Path, api.Method)
return err return err
} }
// @title GetInfoList // @title GetInfoList
// @description get apis by pagination, 分页获取数据 // @description get apis by pagination, 分页获取数据
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param info PageInfo // @param api model.SysApi
// @param info request.PageInfo
// @param order string
// @param desc bool
// @return err error // @return err error
// @return list interface{} // @return list interface{}
// @return total int // @return total int
func GetAPIInfoList(a model.SysApi, info request.PageInfo, Order string, Desc bool) (err error, list interface{}, total int) { func GetAPIInfoList(api model.SysApi, info request.PageInfo, order string, desc bool) (err error, list interface{}, total int) {
limit := info.PageSize limit := info.PageSize
offset := info.PageSize * (info.Page - 1) offset := info.PageSize * (info.Page - 1)
db := global.GVA_DB db := global.GVA_DB
var apiList []model.SysApi var apiList []model.SysApi
if a.Path != "" { if api.Path != "" {
db = db.Where("path LIKE ?", "%"+a.Path+"%") db = db.Where("path LIKE ?", "%"+api.Path+"%")
} }
if a.Description != "" { if api.Description != "" {
db = db.Where("description LIKE ?", "%"+a.Description+"%") db = db.Where("description LIKE ?", "%"+api.Description+"%")
} }
if a.Method != "" { if api.Method != "" {
db = db.Where("method = ?", a.Method) db = db.Where("method = ?", api.Method)
} }
err = db.Find(&apiList).Count(&total).Error err = db.Find(&apiList).Count(&total).Error
...@@ -65,12 +67,12 @@ func GetAPIInfoList(a model.SysApi, info request.PageInfo, Order string, Desc bo ...@@ -65,12 +67,12 @@ func GetAPIInfoList(a model.SysApi, info request.PageInfo, Order string, Desc bo
return err, apiList, total return err, apiList, total
} else { } else {
db = db.Limit(limit).Offset(offset) db = db.Limit(limit).Offset(offset)
if Order != "" { if order != "" {
var OrderStr string var OrderStr string
if Desc { if desc {
OrderStr = Order + " desc" OrderStr = order + " desc"
} else { } else {
OrderStr = Order OrderStr = order
} }
err = db.Order(OrderStr, true).Find(&apiList).Error err = db.Order(OrderStr, true).Find(&apiList).Error
} else { } else {
...@@ -82,7 +84,7 @@ func GetAPIInfoList(a model.SysApi, info request.PageInfo, Order string, Desc bo ...@@ -82,7 +84,7 @@ func GetAPIInfoList(a model.SysApi, info request.PageInfo, Order string, Desc bo
// @title GetAllApis // @title GetAllApis
// @description get all apis, 获取所有的api // @description get all apis, 获取所有的api
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @return err error // @return err error
// @return apis []SysApi // @return apis []SysApi
func GetAllApis() (err error, apis []model.SysApi) { func GetAllApis() (err error, apis []model.SysApi) {
...@@ -92,7 +94,8 @@ func GetAllApis() (err error, apis []model.SysApi) { ...@@ -92,7 +94,8 @@ func GetAllApis() (err error, apis []model.SysApi) {
// @title GetApiById // @title GetApiById
// @description 根据id获取api // @description 根据id获取api
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param api model.SysApi
// @param id float64 // @param id float64
// @return error // @return error
func GetApiById(id float64) (err error, api model.SysApi) { func GetApiById(id float64) (err error, api model.SysApi) {
...@@ -102,15 +105,16 @@ func GetApiById(id float64) (err error, api model.SysApi) { ...@@ -102,15 +105,16 @@ func GetApiById(id float64) (err error, api model.SysApi) {
// @title UpdateApi // @title UpdateApi
// @description update a base api, update api // @description update a base api, update api
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param api model.SysApi
// @return error // @return error
func UpdateApi(a model.SysApi) (err error) { func UpdateApi(api model.SysApi) (err error) {
var oldA model.SysApi var oldA model.SysApi
err = global.GVA_DB.Where("id = ?", a.ID).First(&oldA).Error err = global.GVA_DB.Where("id = ?", api.ID).First(&oldA).Error
if oldA.Path != a.Path || oldA.Method != a.Method { if oldA.Path != api.Path || oldA.Method != api.Method {
flag := global.GVA_DB.Where("path = ? AND method = ?", a.Path, a.Method).Find(&model.SysApi{}).RecordNotFound() flag := global.GVA_DB.Where("path = ? AND method = ?", api.Path, api.Method).Find(&model.SysApi{}).RecordNotFound()
if !flag { if !flag {
return errors.New("存在相同api路径") return errors.New("存在相同api路径")
} }
...@@ -118,11 +122,11 @@ func UpdateApi(a model.SysApi) (err error) { ...@@ -118,11 +122,11 @@ func UpdateApi(a model.SysApi) (err error) {
if err != nil { if err != nil {
return err return err
} else { } else {
err = UpdateCasbinApi(oldA.Path, a.Path, oldA.Method, a.Method) err = UpdateCasbinApi(oldA.Path, api.Path, oldA.Method, api.Method)
if err != nil { if err != nil {
return err return err
} else { } else {
err = global.GVA_DB.Save(a).Error err = global.GVA_DB.Save(api).Error
} }
} }
return err return err
......
...@@ -9,51 +9,46 @@ import ( ...@@ -9,51 +9,46 @@ import (
// @title CreateAuthority // @title CreateAuthority
// @description 创建一个角色 // @description 创建一个角色
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param auth model.SysAuthority
// @param FileName string
// @param FilePath string
// @return error // @return error
func CreateAuthority(a model.SysAuthority) (err error, authority model.SysAuthority) { // @return authority model.SysAuthority
err = global.GVA_DB.Create(&a).Error func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) {
return err, a err = global.GVA_DB.Create(&auth).Error
return err, auth
} }
// @title DeleteAuthority // @title DeleteAuthority
// @description 删除角色 // @description 删除角色
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param auth model.SysAuthority
// @param FileName string
// @param FilePath string
// @return error // @return error
// 删除角色 // 删除角色
func DeleteAuthority(a model.SysAuthority) (err error) { func DeleteAuthority(auth model.SysAuthority) (err error) {
err = global.GVA_DB.Where("authority_id = ?", a.AuthorityId).Find(&model.SysUser{}).Error err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).Find(&model.SysUser{}).Error
if err == nil { if err == nil {
err = errors.New("此角色有用户正在使用禁止删除") err = errors.New("此角色有用户正在使用禁止删除")
return return
} }
err = global.GVA_DB.Where("parent_id = ?", a.AuthorityId).Find(&model.SysAuthority{}).Error err = global.GVA_DB.Where("parent_id = ?", auth.AuthorityId).Find(&model.SysAuthority{}).Error
if err == nil { if err == nil {
err = errors.New("此角色存在子角色不允许删除") err = errors.New("此角色存在子角色不允许删除")
return return
} }
db := global.GVA_DB.Preload("SysBaseMenus").Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a) db := global.GVA_DB.Preload("SysBaseMenus").Where("authority_id = ?", auth.AuthorityId).First(auth).Unscoped().Delete(auth)
if len(a.SysBaseMenus) > 0 { if len(auth.SysBaseMenus) > 0 {
err = db.Association("SysBaseMenus").Delete(a.SysBaseMenus).Error err = db.Association("SysBaseMenus").Delete(auth.SysBaseMenus).Error
} else { } else {
err = db.Error err = db.Error
} }
ClearCasbin(0, a.AuthorityId) ClearCasbin(0, auth.AuthorityId)
return err return err
} }
// @title GetInfoList // @title GetInfoList
// @description 删除文件切片记录 // @description 删除文件切片记录
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param info request.PaveInfo
// @param FileName string
// @param FilePath string
// @return error // @return error
// 分页获取数据 // 分页获取数据
func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, total int) { func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, total int) {
...@@ -72,50 +67,43 @@ func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, t ...@@ -72,50 +67,43 @@ func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, t
// @title GetAuthorityInfo // @title GetAuthorityInfo
// @description 获取所有角色信息 // @description 获取所有角色信息
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param auth model.SysAuthority
// @param FileName string
// @param FilePath string
// @return error // @return error
func GetAuthorityInfo(a model.SysAuthority) (err error, sa model.SysAuthority) { // @param authority model.SysAuthority
err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", a.AuthorityId).First(&sa).Error func GetAuthorityInfo(auth model.SysAuthority) (err error, sa model.SysAuthority) {
err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", auth.AuthorityId).First(&sa).Error
return err, sa return err, sa
} }
// @title SetDataAuthority // @title SetDataAuthority
// @description 设置角色资源权限 // @description 设置角色资源权限
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param auth model.SysAuthority
// @param FileName string
// @param FilePath string
// @return error // @return error
func SetDataAuthority(a model.SysAuthority) error { func SetDataAuthority(auth model.SysAuthority) error {
var s model.SysAuthority var s model.SysAuthority
global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", a.AuthorityId) global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", auth.AuthorityId)
err := global.GVA_DB.Model(&s).Association("DataAuthorityId").Replace(&a.DataAuthorityId).Error err := global.GVA_DB.Model(&s).Association("DataAuthorityId").Replace(&auth.DataAuthorityId).Error
return err return err
} }
// @title SetMenuAuthority // @title SetMenuAuthority
// @description 菜单与角色绑定 // @description 菜单与角色绑定
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param auth *model.SysAuthority
// @param FileName string
// @param FilePath string
// @return error // @return error
func SetMenuAuthority(a *model.SysAuthority) error { func SetMenuAuthority(auth *model.SysAuthority) error {
var s model.SysAuthority var s model.SysAuthority
global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", a.AuthorityId) global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", auth.AuthorityId)
err := global.GVA_DB.Model(&s).Association("SysBaseMenus").Replace(&a.SysBaseMenus).Error err := global.GVA_DB.Model(&s).Association("SysBaseMenus").Replace(&auth.SysBaseMenus).Error
return err return err
} }
// @title findChildrenAuthority // @title findChildrenAuthority
// @description 查询子角色 // @description 查询子角色
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param FileMd5 string // @param auth *model.SysAuthority
// @param FileName string
// @param FilePath string
// @return error // @return error
func findChildrenAuthority(authority *model.SysAuthority) (err error) { func findChildrenAuthority(authority *model.SysAuthority) (err error) {
err = global.GVA_DB.Preload("DataAuthorityId").Where("parent_id = ?", authority.AuthorityId).Find(&authority.Children).Error err = global.GVA_DB.Preload("DataAuthorityId").Where("parent_id = ?", authority.AuthorityId).Find(&authority.Children).Error
......
...@@ -9,9 +9,10 @@ import ( ...@@ -9,9 +9,10 @@ import (
// @title CreateTemp // @title CreateTemp
// @description 函数的详细描述 // @description 函数的详细描述
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param autoCode model.AutoCodeStruct
// @return err error // @return err error
func CreateTemp(a model.AutoCodeStruct) (err error) { func CreateTemp(autoCode model.AutoCodeStruct) (err error) {
basePath := "./resource/template" basePath := "./resource/template"
modelTmpl, err := template.ParseFiles(basePath + "/te/model.go.tpl") modelTmpl, err := template.ParseFiles(basePath + "/te/model.go.tpl")
if err != nil { if err != nil {
...@@ -37,31 +38,31 @@ func CreateTemp(a model.AutoCodeStruct) (err error) { ...@@ -37,31 +38,31 @@ func CreateTemp(a model.AutoCodeStruct) (err error) {
_autoCode := "./autoCode/" _autoCode := "./autoCode/"
//自动化后台代码目录 //自动化后台代码目录
_te := "./autoCode/te/" _te := "./autoCode/te/"
_dir := _te + a.PackageName _dir := _te + autoCode.PackageName
_modeldir := _te + a.PackageName + "/model" _modeldir := _te + autoCode.PackageName + "/model"
_apidir := _te + a.PackageName + "/api" _apidir := _te + autoCode.PackageName + "/api"
_routerdir := _te + a.PackageName + "/router" _routerdir := _te + autoCode.PackageName + "/router"
//自动化前台代码目录 //自动化前台代码目录
_fe := "./autoCode/fe/" _fe := "./autoCode/fe/"
_fe_dir := _fe + a.PackageName _fe_dir := _fe + autoCode.PackageName
_fe_apidir := _fe + a.PackageName + "/api" _fe_apidir := _fe + autoCode.PackageName + "/api"
err = utils.CreateDir(_autoCode, _te, _dir, _modeldir, _apidir, _routerdir, _fe, _fe_dir, _fe_apidir) err = utils.CreateDir(_autoCode, _te, _dir, _modeldir, _apidir, _routerdir, _fe, _fe_dir, _fe_apidir)
if err != nil { if err != nil {
return err return err
} }
model, err := os.OpenFile(_te+a.PackageName+"/model/model.go", os.O_CREATE|os.O_WRONLY, 0755) model, err := os.OpenFile(_te+autoCode.PackageName+"/model/model.go", os.O_CREATE|os.O_WRONLY, 0755)
if err != nil { if err != nil {
return err return err
} }
api, err := os.OpenFile(_te+a.PackageName+"/api/api.go", os.O_CREATE|os.O_WRONLY, 0755) api, err := os.OpenFile(_te+autoCode.PackageName+"/api/api.go", os.O_CREATE|os.O_WRONLY, 0755)
if err != nil { if err != nil {
return err return err
} }
router, err := os.OpenFile(_te+a.PackageName+"/router/router.go", os.O_CREATE|os.O_WRONLY, 0755) router, err := os.OpenFile(_te+autoCode.PackageName+"/router/router.go", os.O_CREATE|os.O_WRONLY, 0755)
if err != nil { if err != nil {
return err return err
} }
feapi, err := os.OpenFile(_fe+a.PackageName+"/api/api.js", os.O_CREATE|os.O_WRONLY, 0755) feapi, err := os.OpenFile(_fe+autoCode.PackageName+"/api/api.js", os.O_CREATE|os.O_WRONLY, 0755)
if err != nil { if err != nil {
return err return err
} }
...@@ -71,23 +72,23 @@ func CreateTemp(a model.AutoCodeStruct) (err error) { ...@@ -71,23 +72,23 @@ func CreateTemp(a model.AutoCodeStruct) (err error) {
} }
// 生成代码 // 生成代码
{ {
err = modelTmpl.Execute(model, a) err = modelTmpl.Execute(model, autoCode)
if err != nil { if err != nil {
return err return err
} }
err = apiTmpl.Execute(api, a) err = apiTmpl.Execute(api, autoCode)
if err != nil { if err != nil {
return err return err
} }
err = routerTmpl.Execute(router, a) err = routerTmpl.Execute(router, autoCode)
if err != nil { if err != nil {
return err return err
} }
err = feapiTmpl.Execute(feapi, a) err = feapiTmpl.Execute(feapi, autoCode)
if err != nil { if err != nil {
return err return err
} }
err = readmeTmpl.Execute(readme, a) err = readmeTmpl.Execute(readme, autoCode)
if err != nil { if err != nil {
return err return err
} }
...@@ -98,10 +99,10 @@ func CreateTemp(a model.AutoCodeStruct) (err error) { ...@@ -98,10 +99,10 @@ func CreateTemp(a model.AutoCodeStruct) (err error) {
_ = feapi.Close() _ = feapi.Close()
_ = readme.Close() _ = readme.Close()
fileList := []string{ fileList := []string{
_te + a.PackageName + "/model/model.go", _te + autoCode.PackageName + "/model/model.go",
_te + a.PackageName + "/api/api.go", _te + autoCode.PackageName + "/api/api.go",
_te + a.PackageName + "/router/router.go", _te + autoCode.PackageName + "/router/router.go",
_fe + a.PackageName + "/api/api.js", _fe + autoCode.PackageName + "/api/api.js",
_autoCode + "readme.txt", _autoCode + "readme.txt",
} }
err = utils.ZipFiles("./ginvueadmin.zip", fileList, ".", ".") err = utils.ZipFiles("./ginvueadmin.zip", fileList, ".", ".")
......
...@@ -8,8 +8,8 @@ import ( ...@@ -8,8 +8,8 @@ import (
// @title DeleteBaseMenu // @title DeleteBaseMenu
// @description 删除基础路由 // @description 删除基础路由
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param newPassword string // @param id float64
// @return err error // @return err error
func DeleteBaseMenu(id float64) (err error) { func DeleteBaseMenu(id float64) (err error) {
err = global.GVA_DB.Where("parent_id = ?", id).First(&model.SysBaseMenu{}).Error err = global.GVA_DB.Where("parent_id = ?", id).First(&model.SysBaseMenu{}).Error
...@@ -29,8 +29,8 @@ func DeleteBaseMenu(id float64) (err error) { ...@@ -29,8 +29,8 @@ func DeleteBaseMenu(id float64) (err error) {
// @title UpdateBaseMenu // @title UpdateBaseMenu
// @description 更新路由 // @description 更新路由
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param newPassword string // @param menu model.SysBaseMenu
// @return err error // @return err error
func UpdateBaseMenu(menu model.SysBaseMenu) (err error) { func UpdateBaseMenu(menu model.SysBaseMenu) (err error) {
upDateMap := make(map[string]interface{}) upDateMap := make(map[string]interface{})
...@@ -49,8 +49,8 @@ func UpdateBaseMenu(menu model.SysBaseMenu) (err error) { ...@@ -49,8 +49,8 @@ func UpdateBaseMenu(menu model.SysBaseMenu) (err error) {
// @title GetBaseMenuById // @title GetBaseMenuById
// @description get current menus, 返回当前选中menu // @description get current menus, 返回当前选中menu
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param newPassword string // @param id float64
// @return err error // @return err error
func GetBaseMenuById(id float64) (err error, menu model.SysBaseMenu) { func GetBaseMenuById(id float64) (err error, menu model.SysBaseMenu) {
err = global.GVA_DB.Where("id = ?", id).First(&menu).Error err = global.GVA_DB.Where("id = ?", id).First(&menu).Error
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
// @title UpdateCasbin // @title UpdateCasbin
// @description update casbin authority, 更新casbin权限 // @description update casbin authority, 更新casbin权限
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param authorityId string // @param authorityId string
// @param casbinInfos []CasbinInfo // @param casbinInfos []CasbinInfo
// @return error // @return error
...@@ -37,8 +37,8 @@ func UpdateCasbin(authorityId string, casbinInfos []request.CasbinInfo) error { ...@@ -37,8 +37,8 @@ func UpdateCasbin(authorityId string, casbinInfos []request.CasbinInfo) error {
// @title AddCasbin // @title AddCasbin
// @description add casbin authority, 添加权限 // @description add casbin authority, 添加权限
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param cm CasbinModel // @param cm model.CasbinModel
// @return bool // @return bool
func AddCasbin(cm model.CasbinModel) bool { func AddCasbin(cm model.CasbinModel) bool {
e := Casbin() e := Casbin()
...@@ -47,11 +47,13 @@ func AddCasbin(cm model.CasbinModel) bool { ...@@ -47,11 +47,13 @@ func AddCasbin(cm model.CasbinModel) bool {
// @title UpdateCasbinApi // @title UpdateCasbinApi
// @description update casbin apis, API更新随动 // @description update casbin apis, API更新随动
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param oldPath string // @param oldPath string
// @param newPath string // @param newPath string
// @param oldMethod string
// @param newMethod string
// @return error // @return error
func UpdateCasbinApi(oldPath string, newPath string,oldMethod string, newMethod string) error { func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod string) error {
var cs []model.CasbinModel var cs []model.CasbinModel
err := global.GVA_DB.Table("casbin_rule").Where("v1 = ? AND v2 = ?", oldPath,oldMethod).Find(&cs).Update("v1", newPath).Update("v2", newMethod).Error err := global.GVA_DB.Table("casbin_rule").Where("v1 = ? AND v2 = ?", oldPath,oldMethod).Find(&cs).Update("v1", newPath).Update("v2", newMethod).Error
return err return err
...@@ -59,7 +61,7 @@ func UpdateCasbinApi(oldPath string, newPath string,oldMethod string, newMethod ...@@ -59,7 +61,7 @@ func UpdateCasbinApi(oldPath string, newPath string,oldMethod string, newMethod
// @title GetPolicyPathByAuthorityId // @title GetPolicyPathByAuthorityId
// @description get policy path by authorityId, 获取权限列表 // @description get policy path by authorityId, 获取权限列表
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param authorityId string // @param authorityId string
// @return []string // @return []string
func GetPolicyPathByAuthorityId(authorityId string) []string { func GetPolicyPathByAuthorityId(authorityId string) []string {
...@@ -74,7 +76,7 @@ func GetPolicyPathByAuthorityId(authorityId string) []string { ...@@ -74,7 +76,7 @@ func GetPolicyPathByAuthorityId(authorityId string) []string {
// @title ClearCasbin // @title ClearCasbin
// @description 清除匹配的权限 // @description 清除匹配的权限
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param v int // @param v int
// @param p string // @param p string
// @return bool // @return bool
...@@ -86,7 +88,7 @@ func ClearCasbin(v int, p ...string) bool { ...@@ -86,7 +88,7 @@ func ClearCasbin(v int, p ...string) bool {
// @title Casbin // @title Casbin
// @description store to DB, 持久化到数据库 引入自定义规则 // @description store to DB, 持久化到数据库 引入自定义规则
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
func Casbin() *casbin.Enforcer { func Casbin() *casbin.Enforcer {
a := gormadapter.NewAdapterByDB(global.GVA_DB) a := gormadapter.NewAdapterByDB(global.GVA_DB)
e := casbin.NewEnforcer(global.GVA_CONFIG.Casbin.ModelPath, a) e := casbin.NewEnforcer(global.GVA_CONFIG.Casbin.ModelPath, a)
...@@ -97,7 +99,7 @@ func Casbin() *casbin.Enforcer { ...@@ -97,7 +99,7 @@ func Casbin() *casbin.Enforcer {
// @title ParamsMatch // @title ParamsMatch
// @description customized rule, 自定义规则函数 // @description customized rule, 自定义规则函数
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param fullNameKey1 string // @param fullNameKey1 string
// @param key2 string // @param key2 string
// @return bool // @return bool
...@@ -109,7 +111,7 @@ func ParamsMatch(fullNameKey1 string, key2 string) bool { ...@@ -109,7 +111,7 @@ func ParamsMatch(fullNameKey1 string, key2 string) bool {
// @title ParamsMatchFunc // @title ParamsMatchFunc
// @description customized function, 自定义规则函数 // @description customized function, 自定义规则函数
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param args ...interface{} // @param args ...interface{}
// @return interface{} // @return interface{}
// @return error // @return error
......
...@@ -9,10 +9,10 @@ import ( ...@@ -9,10 +9,10 @@ import (
// @title GetMenuTree // @title GetMenuTree
// @description 获取动态菜单树 // @description 获取动态菜单树
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param authorityId string // @param authorityId string
// @return err error // @return err error
// @return menus []SysMenu // @return menus []model.SysMenu
func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) { func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) {
sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ?" sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ?"
...@@ -25,9 +25,9 @@ func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) { ...@@ -25,9 +25,9 @@ func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) {
// @title getChildrenList // @title getChildrenList
// @description 获取子菜单 // @description 获取子菜单
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param menu *SysMenu // @param menu *model.SysMenu
// @param SQLstatement string // @param sql string
// @return err error // @return err error
func getChildrenList(menu *model.SysMenu, sql string) (err error) { func getChildrenList(menu *model.SysMenu, sql string) (err error) {
err = global.GVA_DB.Raw(sql, menu.AuthorityId, menu.MenuId).Scan(&menu.Children).Error err = global.GVA_DB.Raw(sql, menu.AuthorityId, menu.MenuId).Scan(&menu.Children).Error
...@@ -39,9 +39,11 @@ func getChildrenList(menu *model.SysMenu, sql string) (err error) { ...@@ -39,9 +39,11 @@ func getChildrenList(menu *model.SysMenu, sql string) (err error) {
// @title GetInfoList // @title GetInfoList
// @description 获取路由分页 // @description 获取路由分页
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param newPassword string // @param info request.PageInfo
// @return err error // @return err error
// @return list interface{}
// @return total int
func GetInfoList(info request.PageInfo) (err error, list interface{}, total int) { func GetInfoList(info request.PageInfo) (err error, list interface{}, total int) {
limit := info.PageSize limit := info.PageSize
offset := info.PageSize * (info.Page - 1) offset := info.PageSize * (info.Page - 1)
...@@ -56,8 +58,8 @@ func GetInfoList(info request.PageInfo) (err error, list interface{}, total int) ...@@ -56,8 +58,8 @@ func GetInfoList(info request.PageInfo) (err error, list interface{}, total int)
// @title getBaseChildrenList // @title getBaseChildrenList
// @description get children of menu, 获取菜单的子菜单 // @description get children of menu, 获取菜单的子菜单
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param menu *SysBaseMenu // @param menu *model.SysBaseMenu
// @return err error // @return err error
func getBaseChildrenList(menu *model.SysBaseMenu) (err error) { func getBaseChildrenList(menu *model.SysBaseMenu) (err error) {
err = global.GVA_DB.Where("parent_id = ?", menu.ID).Order("sort", true).Find(&menu.Children).Error err = global.GVA_DB.Where("parent_id = ?", menu.ID).Order("sort", true).Find(&menu.Children).Error
...@@ -69,8 +71,8 @@ func getBaseChildrenList(menu *model.SysBaseMenu) (err error) { ...@@ -69,8 +71,8 @@ func getBaseChildrenList(menu *model.SysBaseMenu) (err error) {
// @title AddBaseMenu // @title AddBaseMenu
// @description 函数的详细描述 // @description 函数的详细描述
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param newPassword string // @param menu *model.SysBaseMenu
// @return err error // @return err error
//增加基础路由 //增加基础路由
func AddBaseMenu(menu model.SysBaseMenu) (err error) { func AddBaseMenu(menu model.SysBaseMenu) (err error) {
...@@ -85,7 +87,7 @@ func AddBaseMenu(menu model.SysBaseMenu) (err error) { ...@@ -85,7 +87,7 @@ func AddBaseMenu(menu model.SysBaseMenu) (err error) {
// @title GetBaseMenuTree // @title GetBaseMenuTree
// @description 获取基础路由树 // @description 获取基础路由树
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @return err error // @return err error
// @return menus []SysBaseMenu // @return menus []SysBaseMenu
func GetBaseMenuTree() (err error, menus []model.SysBaseMenu) { func GetBaseMenuTree() (err error, menus []model.SysBaseMenu) {
...@@ -98,8 +100,8 @@ func GetBaseMenuTree() (err error, menus []model.SysBaseMenu) { ...@@ -98,8 +100,8 @@ func GetBaseMenuTree() (err error, menus []model.SysBaseMenu) {
// @title AddMenuAuthority // @title AddMenuAuthority
// @description 为角色增加menu树 // @description 为角色增加menu树
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param menus []SysBaseMenu // @param menus []model.SysBaseMenu
// @param authorityId string // @param authorityId string
// @return error // @return error
func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error) { func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error) {
...@@ -112,7 +114,7 @@ func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error) ...@@ -112,7 +114,7 @@ func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error)
// @title GetMenuAuthority // @title GetMenuAuthority
// @description 查看当前角色树 // @description 查看当前角色树
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param authorityId string // @param authorityId string
// @return err error // @return err error
// @return menus []SysBaseMenu // @return menus []SysBaseMenu
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
// @title GetSystemConfig // @title GetSystemConfig
// @description 读取配置文件 // @description 读取配置文件
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @return err error // @return err error
// @return conf Server // @return conf Server
func GetSystemConfig() (err error, conf config.Server) { func GetSystemConfig() (err error, conf config.Server) {
...@@ -19,10 +19,11 @@ func GetSystemConfig() (err error, conf config.Server) { ...@@ -19,10 +19,11 @@ func GetSystemConfig() (err error, conf config.Server) {
// @title SetSystemConfig // @title SetSystemConfig
// @description set system config, 设置配置文件 // @description set system config, 设置配置文件
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param system model.System
// @return err error // @return err error
func SetSystemConfig(s model.System) (err error) { func SetSystemConfig(system model.System) (err error) {
cs := utils.StructToMap(s.Config) cs := utils.StructToMap(system.Config)
for k, v := range cs { for k, v := range cs {
global.GVA_VP.Set(k, v) global.GVA_VP.Set(k, v)
} }
......
...@@ -11,7 +11,8 @@ import ( ...@@ -11,7 +11,8 @@ import (
// @title Register // @title Register
// @description register, 用户注册 // @description register, 用户注册
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param u model.SysUser
// @return err error // @return err error
// @return userInter *SysUser // @return userInter *SysUser
func Register(u model.SysUser) (err error, userInter model.SysUser) { func Register(u model.SysUser) (err error, userInter model.SysUser) {
...@@ -32,7 +33,8 @@ func Register(u model.SysUser) (err error, userInter model.SysUser) { ...@@ -32,7 +33,8 @@ func Register(u model.SysUser) (err error, userInter model.SysUser) {
// @title Login // @title Login
// @description login, 用户登录 // @description login, 用户登录
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param u *model.SysUser
// @return err error // @return err error
// @return userInter *SysUser // @return userInter *SysUser
func Login(u *model.SysUser) (err error, userInter *model.SysUser) { func Login(u *model.SysUser) (err error, userInter *model.SysUser) {
...@@ -48,7 +50,8 @@ func Login(u *model.SysUser) (err error, userInter *model.SysUser) { ...@@ -48,7 +50,8 @@ func Login(u *model.SysUser) (err error, userInter *model.SysUser) {
// @title ChangePassword // @title ChangePassword
// @description change the password of a certain user, 修改用户密码 // @description change the password of a certain user, 修改用户密码
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param u *model.SysUser
// @param newPassword string // @param newPassword string
// @return err error // @return err error
// @return userInter *SysUser // @return userInter *SysUser
...@@ -62,8 +65,8 @@ func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter ...@@ -62,8 +65,8 @@ func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter
// @title GetInfoList // @title GetInfoList
// @description get user list by pagination, 分页获取数据 // @description get user list by pagination, 分页获取数据
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param PageInfo int // @param info request.PageInfo
// @return err error // @return err error
// @return list interface{} // @return list interface{}
// @return total int // @return total int
...@@ -78,7 +81,7 @@ func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total ...@@ -78,7 +81,7 @@ func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total
// @title SetUserAuthority // @title SetUserAuthority
// @description set the authority of a certain user, 设置一个用户的权限 // @description set the authority of a certain user, 设置一个用户的权限
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param uuid UUID // @param uuid UUID
// @param authorityId string // @param authorityId string
// @return err error // @return err error
...@@ -89,7 +92,7 @@ func SetUserAuthority(uuid uuid.UUID, authorityId string) (err error) { ...@@ -89,7 +92,7 @@ func SetUserAuthority(uuid uuid.UUID, authorityId string) (err error) {
// @title UploadHeaderImg // @title UploadHeaderImg
// @description upload avatar, 用户头像上传更新地址 // @description upload avatar, 用户头像上传更新地址
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param uuid UUID // @param uuid UUID
// @param filePath string // @param filePath string
// @return err error // @return err error
......
...@@ -7,7 +7,8 @@ import ( ...@@ -7,7 +7,8 @@ import (
// @title Create // @title Create
// @description create a workflow, 创建工作流 // @description create a workflow, 创建工作流
// @auth (2020/04/05 20:22 ) // @auth (2020/04/05 20:22)
// @param wk model.SysWorkflow
// @return error // @return error
func Create(wk model.SysWorkflow) error { func Create(wk model.SysWorkflow) error {
err := global.GVA_DB.Create(&wk).Error err := global.GVA_DB.Create(&wk).Error
......
...@@ -4,7 +4,7 @@ import "os" ...@@ -4,7 +4,7 @@ import "os"
// @title PathExists // @title PathExists
// @description 文件目录是否存在 // @description 文件目录是否存在
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param path string // @param path string
// @return err error // @return err error
func PathExists(path string) (bool, error) { func PathExists(path string) (bool, error) {
...@@ -20,7 +20,7 @@ func PathExists(path string) (bool, error) { ...@@ -20,7 +20,7 @@ func PathExists(path string) (bool, error) {
// @title createDir // @title createDir
// @description 批量创建文件夹 // @description 批量创建文件夹
// @auth (2020/04/05 20:22 // @auth (2020/04/05 20:22)
// @param dirs string // @param dirs string
// @return err error // @return err error
func CreateDir(dirs ...string) (err error) { func CreateDir(dirs ...string) (err error) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册