diff --git a/dsSupport/Model/Res.go b/dsSupport/Model/Res.go index c3b31453..9c0eea65 100644 --- a/dsSupport/Model/Res.go +++ b/dsSupport/Model/Res.go @@ -1,8 +1,12 @@ 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有值就输出,没值则不输出 + Success interface{} `json:"success"` + Message interface{} `json:"message,omitempty"` //omitempty有值就输出,没值则不输出 + List interface{} `json:"list,omitempty"` //omitempty有值就输出,没值则不输出 + Count interface{} `json:"count,omitempty"` //omitempty有值就输出,没值则不输出 + TeacherFlag interface{} `json:"teacherFlag,omitempty"` //omitempty有值就输出,没值则不输出 + StudentFlag interface{} `json:"studentFlag,omitempty"` //omitempty有值就输出,没值则不输出 + ParentFlag interface{} `json:"parentFlag,omitempty"` //omitempty有值就输出,没值则不输出 + PositionList interface{} `json:"positionList,omitempty"` //omitempty有值就输出,没值则不输出 } diff --git a/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go b/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go index 5cde6bef..dd3b80cd 100644 --- a/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go +++ b/dsSupport/MyModel/AccessSystem/AccessSystemController/AccessSystemController.go @@ -4,7 +4,6 @@ import ( "dsSupport/Model" "dsSupport/MyModel/AccessSystem/AccessSystemDao" "dsSupport/Utils/CommonUtil" - "fmt" "github.com/gin-gonic/gin" "net/http" "os" @@ -27,9 +26,11 @@ func Routers(r *gin.RouterGroup) { rr.GET("/GetAccessSystemIntegratedInfo", GetAccessSystemIntegratedInfo) rr.POST("/SettingAccessSystemIntegratedInfo", SettingAccessSystemIntegratedInfo) rr.POST("/EmptyAccessSystemIntegratedInfo", EmptyAccessSystemIntegratedInfo) - rr.GET("/GetAccessSystemIdentityPositionInfo", GetAccessSystemIdentityPositionInfo) + rr.POST("/SettingAccessSystemIdentityPositionInfo", SettingAccessSystemIdentityPositionInfo) + rr.GET("/GetAccessSystemStageInfo", GetAccessSystemStageInfo) + rr.POST("/SettingAccessSystemStageInfo", SettingAccessSystemStageInfo) return } @@ -461,15 +462,7 @@ func EmptyAccessSystemIntegratedInfo(c *gin.Context) { func GetAccessSystemIdentityPositionInfo(c *gin.Context) { //系统ID appId := c.Query("appId") - positionRes, err := AccessSystemDao.GetAppPosition(appId) - if err != nil { - c.JSON(http.StatusOK, Model.Res{ - Success: false, - Message: err.Error(), - }) - return - } - fmt.Println(positionRes) + identityRes, err1 := AccessSystemDao.GetAppIdentity(appId) if err1 != nil { c.JSON(http.StatusOK, Model.Res{ @@ -478,20 +471,48 @@ func GetAccessSystemIdentityPositionInfo(c *gin.Context) { }) return } - /* + teacherFlag := 2 - identityFlag := 2 + studentFlag := 2 parentFlag := 2 - */ - for i := range identityRes { - fmt.Println(i) + if identityRes[i]["identity_id"] == CommonUtil.ConvertIntToInt64(2) { + teacherFlag = 1 + } + if identityRes[i]["identity_id"] == CommonUtil.ConvertIntToInt64(3) { + studentFlag = 1 + } + if identityRes[i]["identity_id"] == CommonUtil.ConvertIntToInt64(4) { + parentFlag = 1 + } + } + + positionRes, err := AccessSystemDao.GetAppPosition(appId) + if err != nil { + c.JSON(http.StatusOK, Model.Res{ + Success: false, + Message: err.Error(), + }) + return + } + + positionArr := make([]string, 0) + + if len(positionRes) > 0 { + teacherFlag = 2 + for i := range positionRes { + positionArr = append(positionArr, positionRes[i]["position_id"].(string)) + } } c.JSON(http.StatusOK, Model.Res{ - Success: true, - Message: "操作成功!", + Success: true, + TeacherFlag: teacherFlag, + StudentFlag: studentFlag, + ParentFlag: parentFlag, + PositionList: positionArr, + Message: "操作成功!", }) } @@ -561,3 +582,76 @@ func SettingAccessSystemIdentityPositionInfo(c *gin.Context) { Message: "操作成功!", }) } + +// @Summary 获取接入系统的学段信息 +// @Description 获取接入系统的学段信息 +// @Tags 接入系统 +// @Accept application/x-www-form-urlencoded +// @Produce json +// @Param appId query string true "系统ID" +// @Success 200 {object} Model.Res +// @Router /support/accessSystem/GetAccessSystemStageInfo [get] +// @X-EmptyLimit ["appId"] +// @X-LengthLimit [{"appId":"36,36"}] +// @X-TableName ["t_app_base"] +// @X-Sort [9] +func GetAccessSystemStageInfo(c *gin.Context) { + //系统ID + appId := c.Query("appId") + + res, err := AccessSystemDao.GetAppStage(appId) + if err != nil { + c.JSON(http.StatusOK, Model.Res{ + Success: false, + Message: err.Error(), + }) + return + } + arr := make([]int64, 0) + if len(res) > 0 { + for i := range res { + arr = append(arr, res[i]["stage_id"].(int64)) + } + + } + c.JSON(http.StatusOK, Model.Res{ + Success: true, + Message: "操作成功!", + List: arr, + }) + +} + +// @Summary 设置接入系统的身份信息和职务信息 +// @Description 设置接入系统的身份信息和职务信息 +// @Tags 接入系统 +// @Accept application/x-www-form-urlencoded +// @Produce json +// @Param appId formData string true "系统ID" +// @Param stageIds formData int true "学段ID,多个用逗号分隔,如果是通用传-1" +// @Success 200 {object} Model.Res +// @Router /support/accessSystem/SettingAccessSystemStageInfo [post] +// @X-EmptyLimit ["appId","stageIds"] +// @X-LengthLimit [{"appId":"36,36"}] +// @X-IntRangeLimit [{"teacherFlag":"1,3"},{"studentFlag":"1,2"},{"parentFlag":"1,2"}] +// @X-TableName ["t_app_base"] +// @X-Sort [10] +func SettingAccessSystemStageInfo(c *gin.Context) { + //系统ID + appId := c.PostForm("appId") + //学段ID,多个用逗号分隔,如果是通用传-1 + stageIds := c.PostForm("stageIds") + stageArr := strings.Split(stageIds, ",") + err := AccessSystemDao.SaveAppStage(appId, stageArr) + if err != nil { + c.JSON(http.StatusOK, Model.Res{ + Success: false, + Message: err.Error(), + }) + return + } + c.JSON(http.StatusOK, Model.Res{ + Success: true, + Message: "操作成功!", + }) +}