蛋蛋星球-客户端
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.
 
 
 
 

87 lines
3.2 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} public_platoon.GetPublicPlatoonBasicResp "具体数据"
  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. var resp public_platoon.GetPublicPlatoonBasicResp
  28. resp = public_platoon.GetPublicPlatoonBasicResp{
  29. IsOpen: publicPlatoonBasic.IsOpen,
  30. OriginatorUid: publicPlatoonBasic.OriginatorUid,
  31. SeveralTimes: publicPlatoonBasic.SeveralTimes,
  32. SeveralRows: publicPlatoonBasic.SeveralRows,
  33. SystemPunishReplace: publicPlatoonBasic.SystemPunishReplace,
  34. SystemPunishReplaceValue: publicPlatoonBasic.SystemPunishReplaceValue,
  35. IsSelfActiveGetTeamRevenue: publicPlatoonBasic.IsSelfActiveGetTeamRevenue,
  36. }
  37. e.OutSuc(c, resp, nil)
  38. }
  39. // UpdatePublicPlatoonBasic
  40. // @Summary 制度中心-公排管理-公排基础设置(修改)
  41. // @Tags 公排管理
  42. // @Description 公排基础设置(修改)
  43. // @Accept json
  44. // @Produce json
  45. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  46. // @Param req body interface{} true "公排设置表单内容"
  47. // @Success 200 {string} "success"
  48. // @Failure 400 {object} md.Response "具体错误"
  49. // @Router /api/publicPlatoon/getBasic [post]
  50. func UpdatePublicPlatoonBasic(c *gin.Context) {
  51. var req *public_platoon.UpdatePublicPlatoonBasicReq
  52. if err := c.ShouldBindJSON(&req); err != nil {
  53. e.OutErr(c, e.ERR_INVALID_ARGS, err)
  54. return
  55. }
  56. setting := &model.PublicPlatoonBasicSetting{
  57. Id: 1,
  58. IsOpen: req.IsOpen,
  59. OriginatorUid: req.OriginatorUid,
  60. SeveralTimes: req.SeveralTimes,
  61. SeveralRows: req.SeveralRows,
  62. SystemPunishReplace: req.SystemPunishReplace,
  63. SystemPunishReplaceValue: req.SystemPunishReplaceValue,
  64. IsSelfActiveGetTeamRevenue: req.IsSelfActiveGetTeamRevenue,
  65. CreateAt: "",
  66. UpdateAt: "",
  67. }
  68. publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db)
  69. updateAffected, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingUpdate(1, setting, "")
  70. if err != nil {
  71. e.OutErr(c, e.ERR_DB_ORM, err)
  72. return
  73. }
  74. if updateAffected <= 0 {
  75. e.OutErr(c, e.ERR_DB_ORM, "更新数据表失败")
  76. return
  77. }
  78. e.OutSuc(c, "success", nil)
  79. }