diff --git a/app/hdl/institutional_management/public_platoon/hdl_basic.go b/app/hdl/institutional_management/public_platoon/hdl_basic.go index a1c9b85..de831ab 100644 --- a/app/hdl/institutional_management/public_platoon/hdl_basic.go +++ b/app/hdl/institutional_management/public_platoon/hdl_basic.go @@ -1,10 +1,57 @@ package public_platoon import ( + "applet/app/db" + "applet/app/e" + "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 +// @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 + } + e.OutSuc(c, publicPlatoonBasic, nil) +} + +// UpdatePublicPlatoonBasic +// @Summary 更改公排设置 +// @Tags 公排相关接口 +// @Description 更改公排设置 +// @Accept json +// @Produce json +// @Param Authorization header +// @Param req body interface{} true "公排设置表单内容" +// @Success 200 {object} map[string]interface{} "修改数据条数" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/publicPlatoon/getBasic [get] +func UpdatePublicPlatoonBasic(c *gin.Context) { + var req *model.PublicPlatoonBasicSetting + if err := c.ShouldBindJSON(&req); err != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err) + return + } + + publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db) + update, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingUpdate(req.Id, req, "") + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err) + return + } - return + e.OutSuc(c, update, nil) } diff --git a/app/md/md_public_platoon.go b/app/md/md_public_platoon.go new file mode 100644 index 0000000..4aa950b --- /dev/null +++ b/app/md/md_public_platoon.go @@ -0,0 +1,12 @@ +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"` +} diff --git a/app/router/router.go b/app/router/router.go index 1a4e675..6ae8716 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -60,6 +60,7 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理 rPublicPlatoon := r.Group("/publicPlatoon") //公排设置 { rPublicPlatoon.GET("/getBasic", public_platoon.GetPublicPlatoonBasic) + rPublicPlatoon.PUT("/getBasic", public_platoon.UpdatePublicPlatoonBasic) } } diff --git a/go.mod b/go.mod index c59d801..a9a8b99 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module applet go 1.19 replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models +//replace code.fnuoos.com/EggPlanet/egg_models.git => C:\Users\Administrator\GolandProjects\egg_models require ( github.com/boombuler/barcode v1.0.1 @@ -32,6 +33,7 @@ require ( ) require ( + code.fnuoos.com/EggPlanet/egg_models.git v0.2.0 code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/go-sql-driver/mysql v1.8.1 github.com/gocolly/colly v1.2.0 @@ -39,7 +41,6 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/KyleBanks/depth v1.2.1 // indirect github.com/PuerkitoBio/goquery v1.9.2 // indirect