|
@@ -43,3 +43,45 @@ func (h *HrSensors) HrSensorsUpdate() (err error) {
|
|
|
h.Ctx().JSON(http.StatusOK, r)
|
|
h.Ctx().JSON(http.StatusOK, r)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+type AddHRRtn struct {
|
|
|
|
|
+ ResponseBase
|
|
|
|
|
+ InClass int
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// AddAppHeartRate godoc
|
|
|
|
|
+// @Summary App心率数据上报
|
|
|
|
|
+// @tags HrSensors
|
|
|
|
|
+// @Description App心率数据上报
|
|
|
|
|
+// @Accept x-www-form-urlencoded
|
|
|
|
|
+// @Produce json
|
|
|
|
|
+// @Param token formData string true "Token"
|
|
|
|
|
+// @Param duId formData int true "duId"
|
|
|
|
|
+// @Param sn formData string true "sn"
|
|
|
|
|
+// @Param hrId formData int true "心率带id"
|
|
|
|
|
+// @Param heartRate formData int true "心跳"
|
|
|
|
|
+// @Param rcvTime formData int true "时间戳毫秒"
|
|
|
|
|
+// @Param calories formData int true "卡路里"
|
|
|
|
|
+// @Param pureCalories formData int true "运动卡路里"
|
|
|
|
|
+// @Success 200 {object} controller.AddHRRtn
|
|
|
|
|
+// @Router /HrSensors/AddAppHeartRate [post]
|
|
|
|
|
+func (h *HrSensors) AddAppHeartRate() (err error) {
|
|
|
|
|
+ token := h.Ctx().PostForm("token")
|
|
|
|
|
+ duId := h.postIntNecessary("duId")
|
|
|
|
|
+ sn := h.Ctx().PostForm("sn")
|
|
|
|
|
+ hrId := h.postIntNecessary("hrId")
|
|
|
|
|
+ heartRate := h.postIntNecessary("heartRate")
|
|
|
|
|
+ rcvTime := h.postIntNecessary("rcvTime")
|
|
|
|
|
+ calories := h.postIntNecessary("calories")
|
|
|
|
|
+ pureCalories := h.postIntNecessary("pureCalories")
|
|
|
|
|
+ inClass, err := service.HrSensors{}.AddAppHeartRate(token, duId, sn, hrId, heartRate, rcvTime, calories, pureCalories)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ r := AddHRRtn{
|
|
|
|
|
+ newResponseBase(),
|
|
|
|
|
+ inClass,
|
|
|
|
|
+ }
|
|
|
|
|
+ h.Ctx().JSON(http.StatusOK, r)
|
|
|
|
|
+ return
|
|
|
|
|
+}
|