用户关联查询 jwt鉴权调整 api删除调整 authorityId默认类型调整

This commit is contained in:
pixel
2019-10-09 17:32:14 +08:00
parent 756353bd68
commit ddf879793a
9 changed files with 51 additions and 50 deletions
+19 -21
View File
@@ -14,7 +14,7 @@ type CreateApiParams struct {
}
type DeleteApiParams struct {
Path uint `json:"path"`
ID uint `json:"id"`
}
// @Tags Api
@@ -41,7 +41,7 @@ func CreateApi(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.DeleteApiParams true "删除api"
// @Param data body dbModel.Api true "删除api"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/deleteApi [post]
func DeleteApi(c *gin.Context) {
@@ -56,8 +56,8 @@ func DeleteApi(c *gin.Context) {
}
type AuthAndPathIn struct {
AuthorityId string `json:"authorityId"`
ApiIds []uint `json:"apiIds"`
AuthorityId string `json:"authorityId"`
ApiIds []uint `json:"apiIds"`
}
// @Tags Api
@@ -120,14 +120,12 @@ func GetApiById(c *gin.Context) {
servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{})
} else {
servers.ReportFormat(c, true, "获取数据成功", gin.H{
"api": api,
"api": api,
})
}
}
// @Tags Api
// @Summary 创建基础api
// @Security ApiKeyAuth
@@ -136,16 +134,16 @@ func GetApiById(c *gin.Context) {
// @Param data body api.CreateApiParams true "创建api"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/updataApi [post]
func UpdataApi(c *gin.Context) {
var api dbModel.Api
_ = c.BindJSON(&api)
err := api.UpdataApi()
if err != nil {
servers.ReportFormat(c, false, fmt.Sprintf("修改数据失败,%v", err), gin.H{})
} else {
servers.ReportFormat(c, true, "修改数据成功", gin.H{})
}
}
func UpdataApi(c *gin.Context) {
var api dbModel.Api
_ = c.BindJSON(&api)
err := api.UpdataApi()
if err != nil {
servers.ReportFormat(c, false, fmt.Sprintf("修改数据失败,%v", err), gin.H{})
} else {
servers.ReportFormat(c, true, "修改数据成功", gin.H{})
}
}
// @Tags Api
// @Summary 获取所有的Api 不分页
@@ -154,13 +152,13 @@ func GetApiById(c *gin.Context) {
// @Produce application/json
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/getAllApis [post]
func GetAllApis(c *gin.Context){
err,apis := new(dbModel.Api).GetAllApis()
func GetAllApis(c *gin.Context) {
err, apis := new(dbModel.Api).GetAllApis()
if err != nil {
servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{})
} else {
servers.ReportFormat(c, true, "获取数据成功", gin.H{
"apis": apis,
"apis": apis,
})
}
}
}
+2 -2
View File
@@ -159,8 +159,8 @@ func UploadHeaderImg(c *gin.Context) {
// @Produce application/json
// @Param data body modelInterface.PageInfo true "分页获取用户列表"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /user/getInfoList [post]
func GetInfoList(c *gin.Context) {
// @Router /user/getUserList [post]
func GetUserList(c *gin.Context) {
var pageInfo modelInterface.PageInfo
_ = c.BindJSON(&pageInfo)
err, list, total := new(dbModel.User).GetInfoList(pageInfo)
+2 -2
View File
@@ -9,8 +9,8 @@ import (
"time"
)
var accessKey string = "25j8dYBZ2wui***************62b8xiFguwxzZ" // 你在七牛云的accessKey
var secretKey string = "pgdbqEsf7ooZ***************_VecFXPDeG5JY" // 你在七牛云的secretKey
var accessKey string = "25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ" // 你在七牛云的accessKey 这里是我个人测试号的key 仅供测试使用 恳请大家不要乱传东西
var secretKey string = "pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY" // 你在七牛云的secretKey 这里是我个人测试号的key 仅供测试使用 恳请大家不要乱传东西
// 接收两个参数 一个文件流 一个 bucket 你的七牛云标准空间的名字
func Upload(file *multipart.FileHeader, bucket string, urlPath string) (err error, path string) {