hrSensors.go 939 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @ File:
  3. * @ Date: 2021/1/25 16:15
  4. * @ Author: JYQ
  5. * @ Description:
  6. */
  7. package controller
  8. import (
  9. "net/http"
  10. "video_course/service"
  11. )
  12. type HrSensors struct {
  13. BaseController
  14. }
  15. type UpdateHrSensorsInfo struct {
  16. ResponseBase
  17. HrId int
  18. }
  19. // HrSensorsUpdate godoc
  20. // @Summary 心率带信息查询和更新
  21. // @tags HrSensors
  22. // @Description 心率带信息查询和更新
  23. // @Accept x-www-form-urlencoded
  24. // @Produce json
  25. // @Param token formData string true "Token"
  26. // @Param sn formData string true "心率带编号"
  27. // @Success 200 {object} controller.ResponseBase
  28. // @Router /HrSensors/HrSensorsUpdate [post]
  29. func (h *HrSensors) HrSensorsUpdate() (err error) {
  30. token := h.Ctx().PostForm("token")
  31. sn := h.Ctx().PostForm("sn")
  32. hrId, err := service.HrSensors{}.HrSensorsUpdate(token, sn)
  33. if err != nil {
  34. return
  35. }
  36. r := UpdateHrSensorsInfo{
  37. newResponseBase(),
  38. hrId,
  39. }
  40. h.Ctx().JSON(http.StatusOK, r)
  41. return
  42. }