|
- 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"
- )
-
- // GetPublicPlatoonBasic
- // @Summary 制度中心-公排管理-公排基础设置(获取)
- // @Tags 公排管理
- // @Description 公排基础设置(获取)
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Success 200 {object} map[string]interface{} "用户数据"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/publicPlatoon/getBasic [get]
- func GetPublicPlatoonBasic(c *gin.Context) {
- publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db)
- publicPlatoonBasic, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingGetOneByParams(nil)
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err)
- return
- }
-
- 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
- // @Summary 制度中心-公排管理-公排基础设置(修改)
- // @Tags 公排管理
- // @Description 公排基础设置(修改)
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Param req body interface{} true "公排设置表单内容"
- // @Success 200 {object} map[string]interface{} "修改数据条数"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/publicPlatoon/getBasic [post]
- func UpdatePublicPlatoonBasic(c *gin.Context) {
- 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(1, setting, "")
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err)
- return
- }
-
- e.OutSuc(c, update, nil)
- }
|