diff --git a/app/hdl/institutional_management/public_platoon/hdl_basic.go b/app/hdl/institutional_management/public_platoon/hdl_basic.go index 19d1d6f..0d0ae76 100644 --- a/app/hdl/institutional_management/public_platoon/hdl_basic.go +++ b/app/hdl/institutional_management/public_platoon/hdl_basic.go @@ -3,6 +3,7 @@ package public_platoon import ( "applet/app/db" "applet/app/e" + "applet/app/md/institutional_management/public_platoon" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" "github.com/gin-gonic/gin" @@ -25,7 +26,18 @@ func GetPublicPlatoonBasic(c *gin.Context) { e.OutErr(c, e.ERR_DB_ORM, err) return } - e.OutSuc(c, publicPlatoonBasic, nil) + + resp := public_platoon.GetPublicPlatoonBasicResp{ + IsOpen: publicPlatoonBasic.IsOpen, + OriginatorUid: publicPlatoonBasic.OriginatorUid, + SeveralTimes: publicPlatoonBasic.SeveralTimes, + SeveralRows: publicPlatoonBasic.SeveralRows, + SystemPunishReplace: publicPlatoonBasic.SystemPunishReplace, + SystemPunishReplaceValue: publicPlatoonBasic.SystemPunishReplaceValue, + IsSelfActiveGetTeamRevenue: publicPlatoonBasic.IsSelfActiveGetTeamRevenue, + } + + e.OutSuc(c, resp, nil) } // UpdatePublicPlatoonBasic @@ -38,16 +50,29 @@ func GetPublicPlatoonBasic(c *gin.Context) { // @Param req body interface{} true "公排设置表单内容" // @Success 200 {object} map[string]interface{} "修改数据条数" // @Failure 400 {object} md.Response "具体错误" -// @Router /api/publicPlatoon/getBasic [get] +// @Router /api/publicPlatoon/getBasic [post] func UpdatePublicPlatoonBasic(c *gin.Context) { - var req *model.PublicPlatoonBasicSetting + var req *public_platoon.UpdatePublicPlatoonBasicReq if err := c.ShouldBindJSON(&req); err != nil { e.OutErr(c, e.ERR_INVALID_ARGS, err) return } + setting := &model.PublicPlatoonBasicSetting{ + Id: 1, + IsOpen: req.IsOpen, + OriginatorUid: req.OriginatorUid, + SeveralTimes: req.SeveralTimes, + SeveralRows: req.SeveralRows, + SystemPunishReplace: req.SystemPunishReplace, + SystemPunishReplaceValue: req.SystemPunishReplaceValue, + IsSelfActiveGetTeamRevenue: req.IsSelfActiveGetTeamRevenue, + CreateAt: "", + UpdateAt: "", + } + publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db) - update, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingUpdate(req.Id, req, "") + update, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingUpdate(1, setting, "") if err != nil { e.OutErr(c, e.ERR_DB_ORM, err) return diff --git a/app/md/institutional_management/public_platoon/md_public_platoon.go b/app/md/institutional_management/public_platoon/md_public_platoon.go new file mode 100644 index 0000000..5398321 --- /dev/null +++ b/app/md/institutional_management/public_platoon/md_public_platoon.go @@ -0,0 +1,21 @@ +package public_platoon + +type GetPublicPlatoonBasicResp struct { + IsOpen int `json:"is_open"` + OriginatorUid int `json:"originator_uid"` + SeveralTimes int `json:"several_times"` + SeveralRows int `json:"several_rows"` + SystemPunishReplace int `json:"system_punish_replace"` + SystemPunishReplaceValue int `json:"system_punish_replace_value"` + IsSelfActiveGetTeamRevenue int `json:"is_self_active_get_team_revenue"` +} + +type UpdatePublicPlatoonBasicReq struct { + IsOpen int `json:"is_open"` + OriginatorUid int `json:"originator_uid"` + SeveralTimes int `json:"several_times"` + SeveralRows int `json:"several_rows"` + SystemPunishReplace int `json:"system_punish_replace"` + SystemPunishReplaceValue int `json:"system_punish_replace_value"` + IsSelfActiveGetTeamRevenue int `json:"is_self_active_get_team_revenue"` +} diff --git a/app/md/md_public_platoon.go b/app/md/md_public_platoon.go deleted file mode 100644 index 4aa950b..0000000 --- a/app/md/md_public_platoon.go +++ /dev/null @@ -1,12 +0,0 @@ -package md - -type UpdatePublicPlatoonBasicReq struct { - ID int `json:"id" binding:"required"` - IsOpen int8 `json:"is_open"` - OriginatorUid int `json:"originator_uid"` - SeveralTimes int8 `json:"several_times"` - SeveralRows int8 `json:"several_rows"` - SystemPunishReplace int8 `json:"system_punish_replace"` - SystemPunishReplaceValue int `json:"system_punish_replace_value"` - IsSelfActiveGetTeamRevenue int8 `json:"is_self_active_get_team_revenue"` -}