|
@@ -5,6 +5,7 @@ import (
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"main/controller/servers"
|
|
|
"main/model/dbModel"
|
|
|
+ "main/model/modelInterface"
|
|
|
)
|
|
|
|
|
|
type CreateApiParams struct {
|
|
@@ -54,3 +55,51 @@ func DeleteApi(c *gin.Context) {
|
|
|
servers.ReportFormat(c, true, "删除成功", gin.H{})
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+type AuthAndPathIn struct {
|
|
|
+ AuthorityId string `json:"authorityId"`
|
|
|
+ Apis []dbModel.Api `json:"apis"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func SetAuthAndPath(c *gin.Context){
|
|
|
+ var authAndPathIn AuthAndPathIn
|
|
|
+ _ = c.BindJSON(&authAndPathIn)
|
|
|
+ err:=new(dbModel.ApiAuthority).SetAuthAndPath(authAndPathIn.AuthorityId,authAndPathIn.Apis)
|
|
|
+ if err != nil {
|
|
|
+ servers.ReportFormat(c, false, fmt.Sprintf("添加失败:%v", err), gin.H{})
|
|
|
+ } else {
|
|
|
+ servers.ReportFormat(c, true, "添加成功", gin.H{})
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func GetApiList(c *gin.Context) {
|
|
|
+ var pageInfo modelInterface.PageInfo
|
|
|
+ _ = c.BindJSON(&pageInfo)
|
|
|
+ err, list, total := new(dbModel.Api).GetInfoList(pageInfo)
|
|
|
+ if err != nil {
|
|
|
+ servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{})
|
|
|
+ } else {
|
|
|
+ servers.ReportFormat(c, true, "获取数据成功", gin.H{
|
|
|
+ "list": list,
|
|
|
+ "total": total,
|
|
|
+ "page": pageInfo.Page,
|
|
|
+ "pageSize": pageInfo.PageSize,
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+}
|