互动
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.

51 lines
1.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. package pc
  2. import (
  3. "hudongzhuanjia/controllers"
  4. "hudongzhuanjia/models"
  5. "hudongzhuanjia/utils/code"
  6. "hudongzhuanjia/utils/define"
  7. )
  8. type PadSignCtl struct {
  9. controllers.AuthorCtl
  10. }
  11. func (t *PadSignCtl) Setting() {
  12. activityId := t.MustGetInt("activity_id")
  13. // rehearsalId := t.MustGetInt("rehearsal_id")
  14. // 平板签约信息
  15. padSigning := &models.PadSigning{}
  16. exist, err := padSigning.GetByActivityId(activityId)
  17. t.CheckErr(err)
  18. t.Assert(exist, code.MSG_PAD_SIGNING_NOT_EXIST, "平板签约信息异常")
  19. signers, err := models.ListPadSignerByActivityId(activityId)
  20. t.CheckErr(err)
  21. t.JSON(map[string]interface{}{
  22. "pad_signing": padSigning,
  23. "pad_signers": signers,
  24. })
  25. }
  26. func (t *PadSignCtl) Switch() {
  27. activityId := t.MustGetInt("activity_id")
  28. // rehearsalId := t.MustGetInt("rehearsal_id")
  29. status := t.MustGet("status")
  30. if status != define.StatusOpen && status != define.StatusClose {
  31. t.DisplayByError("status值为开启或关闭", code.MSG_ERR_Param)
  32. return
  33. }
  34. padSigning := &models.PadSigning{}
  35. exist, err := padSigning.GetByActivityId(activityId)
  36. t.CheckErr(err)
  37. t.Assert(exist, code.MSG_PAD_SIGNING_NOT_EXIST, "平板签约信息异常")
  38. padSigning.PadSignStatus = status
  39. _, err = padSigning.Update(padSigning, padSigning.Id, "pad_sign_status")
  40. t.CheckErr(err)
  41. t.DisplayBySuccess("已" + status)
  42. }