蛋蛋星球 后台端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

83 lines
3.1 KiB

  1. package public_platoon
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/md/institutional_management/public_platoon"
  6. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  7. "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // GetPublicPlatoonBasic
  11. // @Summary 制度中心-公排管理-公排基础设置(获取)
  12. // @Tags 公排管理
  13. // @Description 公排基础设置(获取)
  14. // @Accept json
  15. // @Produce json
  16. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  17. // @Success 200 {object} map[string]interface{} "用户数据"
  18. // @Failure 400 {object} md.Response "具体错误"
  19. // @Router /api/publicPlatoon/getBasic [get]
  20. func GetPublicPlatoonBasic(c *gin.Context) {
  21. publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db)
  22. publicPlatoonBasic, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingGetOneByParams(nil)
  23. if err != nil {
  24. e.OutErr(c, e.ERR_DB_ORM, err)
  25. return
  26. }
  27. resp := public_platoon.GetPublicPlatoonBasicResp{
  28. IsOpen: publicPlatoonBasic.IsOpen,
  29. OriginatorUid: publicPlatoonBasic.OriginatorUid,
  30. SeveralTimes: publicPlatoonBasic.SeveralTimes,
  31. SeveralRows: publicPlatoonBasic.SeveralRows,
  32. SystemPunishReplace: publicPlatoonBasic.SystemPunishReplace,
  33. SystemPunishReplaceValue: publicPlatoonBasic.SystemPunishReplaceValue,
  34. IsSelfActiveGetTeamRevenue: publicPlatoonBasic.IsSelfActiveGetTeamRevenue,
  35. }
  36. e.OutSuc(c, resp, nil)
  37. }
  38. // UpdatePublicPlatoonBasic
  39. // @Summary 制度中心-公排管理-公排基础设置(修改)
  40. // @Tags 公排管理
  41. // @Description 公排基础设置(修改)
  42. // @Accept json
  43. // @Produce json
  44. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  45. // @Param req body interface{} true "公排设置表单内容"
  46. // @Success 200 {object} map[string]interface{} "修改数据条数"
  47. // @Failure 400 {object} md.Response "具体错误"
  48. // @Router /api/publicPlatoon/getBasic [post]
  49. func UpdatePublicPlatoonBasic(c *gin.Context) {
  50. var req *public_platoon.UpdatePublicPlatoonBasicReq
  51. if err := c.ShouldBindJSON(&req); err != nil {
  52. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  53. return
  54. }
  55. setting := &model.PublicPlatoonBasicSetting{
  56. Id: 1,
  57. IsOpen: req.IsOpen,
  58. OriginatorUid: req.OriginatorUid,
  59. SeveralTimes: req.SeveralTimes,
  60. SeveralRows: req.SeveralRows,
  61. SystemPunishReplace: req.SystemPunishReplace,
  62. SystemPunishReplaceValue: req.SystemPunishReplaceValue,
  63. IsSelfActiveGetTeamRevenue: req.IsSelfActiveGetTeamRevenue,
  64. CreateAt: "",
  65. UpdateAt: "",
  66. }
  67. publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db)
  68. update, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingUpdate(1, setting, "")
  69. if err != nil {
  70. e.OutErr(c, e.ERR_DB_ORM, err)
  71. return
  72. }
  73. e.OutSuc(c, update, nil)
  74. }