master
wubin 5 years ago
parent d10a4d2326
commit 41b568dd9a

@ -0,0 +1,8 @@
package Model
type Res struct {
Success interface{} `json:"success"`
Message interface{} `json:"message,omitempty"` //omitempty有值就输出没值则不输出
List interface{} `json:"list,omitempty"` //omitempty有值就输出没值则不输出
Count interface{} `json:"count,omitempty"` //omitempty有值就输出没值则不输出
}

@ -1,8 +1,12 @@
package AccessSystemController
import (
"dsSupport/Model"
"dsSupport/MyModel/AccessSystem/AccessSystemDao"
"dsSupport/Utils/CommonUtil"
"github.com/gin-gonic/gin"
"net/http"
"strings"
)
//模块的路由配置
@ -44,6 +48,22 @@ func PageAccessSystemInfo(c *gin.Context) {
page := CommonUtil.ConvertStringToInt32(c.Query("page"))
//一页显示多少条
limit := CommonUtil.ConvertStringToInt32(c.Query("limit"))
res, count, err := AccessSystemDao.ListApp("", page, limit)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
List: res,
Count: count,
})
}
// @Summary 增加接入系统
@ -67,6 +87,18 @@ func AddAccessSystemInfo(c *gin.Context) {
appCode := c.PostForm("appCode")
//排序号
sortId := CommonUtil.ConvertStringToInt32(c.PostForm("sortId"))
err := AccessSystemDao.AddApp(appCode, appName, sortId)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
})
}
// @Summary 修改接入系统
@ -93,6 +125,18 @@ func UpdateAccessSystemInfo(c *gin.Context) {
appCode := c.PostForm("appCode")
//排序号
sortId := CommonUtil.ConvertStringToInt32(c.PostForm("sortId"))
err := AccessSystemDao.UpdateApp(appId, appCode, appName, sortId)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
})
}
// @Summary 删除接入系统
@ -100,16 +144,28 @@ func UpdateAccessSystemInfo(c *gin.Context) {
// @Tags 接入系统
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Param appIds formData string true "系统ID,多个用逗号分隔"
// @Param appId formData string true "系统ID"
// @Success 200 {object} Model.Res
// @Router /base/support/DeleteAccessSystemInfo [post]
// @X-EmptyLimit ["appIds"]
// @X-LengthLimit [{"appIds":"36,3700"}]
// @X-EmptyLimit ["appId"]
// @X-LengthLimit [{"appId":"36,36"}]
// @X-TableName ["t_app_base"]
// @X-Sort [3]
func DeleteAccessSystemInfo(c *gin.Context) {
//系统ID多个用逗号分隔
appIds := c.PostForm("appIds")
//系统ID
appId := c.PostForm("appId")
err := AccessSystemDao.DelApp(appId)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
})
}
// @Summary 获取接入系统的使用范围
@ -147,23 +203,23 @@ func SettingAccessSystemRangeInfo(c *gin.Context) {
appId := c.PostForm("appId")
//使用范围的行政区划码、单位ID多个用逗号分隔
rangeCode := c.PostForm("rangeCode")
}
arr := make([]string, 0)
if len(rangeCode) > 0 {
arr = strings.Split(rangeCode, ",")
}
// @Summary 清空接入系统的使用范围
// @Description 清空接入系统的使用范围
// @Tags 接入系统
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Param appId formData string true "系统ID"
// @Success 200 {object} Model.Res
// @Router /base/support/EmptyAccessSystemRangeInfo [post]
// @X-EmptyLimit ["orgId"]
// @X-LengthLimit [{"orgId":"36,36"}]
// @X-TableName ["t_app_base"]
// @X-Sort [5]
func EmptyAccessSystemRangeInfo(c *gin.Context) {
//系统ID
appId := c.PostForm("appId")
err := AccessSystemDao.SaveAppRange(appId, arr)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
c.JSON(http.StatusOK, Model.Res{
Success: true,
Message: "操作成功!",
})
}
// @Summary 获取接入系统的统一认证信息
@ -205,6 +261,8 @@ func SettingAccessSystemSsoInfo(c *gin.Context) {
//统一认证登出地址
logoutUri := c.PostForm("logoutUri")
AccessSystemDao.UpdateSso()
}
// @Summary 清空接入系统的统一认证信息

@ -664,3 +664,13 @@ func CompressStr(str string) string {
reg := regexp.MustCompile("\\s+")
return reg.ReplaceAllString(str, "")
}
/**
int32
2020-04-17
*/
func ConvertStringToInt32(s string) int32 {
i, _ := strconv.Atoi(s)
return int32(i)
}
Loading…
Cancel
Save