/** * @ File: * @ Date: 2021/1/25 16:15 * @ Author: JYQ * @ Description: */ package controller type HrSensors struct { BaseController } // //// AddHrSensors godoc //// @Summary 添加商家公共心率设备 //// @tags HrSensors //// @Description 添加商家公共心率设备 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param shopId formData int true "商家ID" //// @Param sn formData int true "心率带Sn" //// @Param venueNo formData string false "场馆内编号 01 02" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/AddHrSensors [post] //func (h *HrSensors) AddHrSensors() (err error) { // //sess := h.Ctx().PostForm("Token") // //sn := h.postString("sn", true) // //venueNo := h.Ctx().PostForm("venueNo") // //shopId := h.postIntNecessary("shopId") // // // //logInfo, err := service.HrSensors{}.AddHrSensors(sess, sn, venueNo, shopId) // //if err != nil { // // return // //} // //h.saveOptLogInfo(logInfo) // //h.json(newResponseBase()) // return //} // //// AddPvtHrSensors godoc //// @Summary 添加会员私有心率设备 //// @tags HrSensors //// @Description 添加会员私有心率设备 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param shopId formData int true "商家ID" //// @Param sn formData int true "心率带Sn" //// @Param userId formData int true "用户ID" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/AddPvtHrSensors [post] //func (h *HrSensors) AddPvtHrSensors() (err error) { // //sess := h.Ctx().PostForm("Token") // //sn := h.postString("sn", true) // //shopId := h.postIntNecessary("shopId") // //userId := h.postIntNecessary("userId") // // // //logInfo, err := service.HrSensors{}.AddPvtHrSensors(sess, sn, userId, shopId) // //if err != nil { // // return // //} // //h.saveOptLogInfo(logInfo) // //h.json(newResponseBase()) // return //} // //// EditHrSensors godoc //// @Summary 修改商家心率设备信息 //// @tags HrSensors //// @Description 修改商家心率设备信息 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param hrId formData int true "心率带ID" //// @Param sn formData string true "心率带Sn" //// @Param shopId formData string true "商家ID" //// @Param venueNo formData string false "场馆内编号 01 02" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/EditHrSensors [post] //func (h *HrSensors) EditHrSensors() (err error) { // //sess := h.getSession() // //sn := h.postString("sn", true) // //venueNo := h.Ctx().PostForm("venueNo") // //hrId := h.postIntNecessary("hrId") // //shopId := h.postIntNecessary("shopId") // // // //logInfo, err := service.HrSensors{}.EditHrSensors(sess, sn, venueNo, shopId, hrId) // //if err != nil { // // return // //} // //h.saveOptLogInfo(logInfo) // //h.json(newResponseBase()) // return //} // //// HrSensorsStatusEdit godoc //// @Summary 修改商家心率设备状态 //// @tags HrSensors //// @Description 修改商家心率设备状态 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param hrId formData int true "心率带ID" //// @Param status formData int true "状态, 1:启用,8:暂停,9:删除" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/HrSensorsStatusEdit [post] //func (h *HrSensors) HrSensorsStatusEdit() (err error) { // //sess := h.getSession() // //hrId := h.postIntNecessary("hrId") // //status := h.postIntNecessary("status") // // // //logInfo, err := service.HrSensors{}.HrSensorsStatusEdit(sess, hrId, status) // //if err != nil { // // return // //} // //h.saveOptLogInfo(logInfo) // //h.json(newResponseBase()) // return //} // //type QueryHrSensorsInfo struct { // ResponseBase // Rs string //} // //// QueryHrSensors godoc //// @Summary 查询商家公共心率设备 //// @tags HrSensors //// @Description 查询商家公共心率设备 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param shopId formData int true "商家ID" //// @Param status formData int false "设备状态" //// @Param str formData string false "模糊查询sn与场内编号" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/QueryHrSensors [post] //func (h *HrSensors) QueryHrSensors() (err error) { // //sess := h.getSession() // //str := h.Ctx().PostForm("str") // //shopId := h.postIntNecessary("shopId") // //status := h.postInt("status") // //hr, err := service.HrSensors{}.QueryHrSensors(sess, shopId, str, status) // //if err != nil { // // return // //} // //h.json(QueryHrSensorsInfo{ // // ResponseBase: ResponseBase{}, // // Rs: hr, // //}) // return //} // //// QueryPvtHrSensors godoc //// @Summary 查询商家会员私有心率设备 //// @tags HrSensors //// @Description 查询商家会员私有心率设备 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param shopId formData int true "商家ID" //// @Param status formData int false "设备状态" //// @Param userName formData string false "用户姓名" //// @Param str formData string false "模糊查询sn与场内编号" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/QueryPvtHrSensors [post] //func (h *HrSensors) QueryPvtHrSensors() (err error) { // //sess := h.getSession() // //str := h.Ctx().PostForm("str") // //userName := h.Ctx().PostForm("userName") // //shopId := h.postIntNecessary("shopId") // //status := h.postInt("status") // //hr, err := service.HrSensors{}.QueryPvtHrSensors(sess, shopId, str, userName, status) // //if err != nil { // // return // //} // //h.json(QueryHrSensorsInfo{ // // ResponseBase: ResponseBase{}, // // Rs: hr, // //}) // return //} // //// BindHrSensorsToUser godoc //// @Summary 心率带绑定用户 //// @tags HrSensors //// @Description 心率带绑定用户 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param sn formData string true "心率带Sn" //// @Param cfId formData int true "课堂记录Id,必传字段" //// @Param userId formData int true "用户Id" //// @Param shopId formData int true "商家ID" //// @Param hrId formData int true "心率带ID" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/BindHrSensorsToUser [post] //func (h *HrSensors) BindHrSensorsToUser() (err error) { // //sess := h.getSession() // //sn := h.postString("sn", true) // //cfId := h.postIntNecessary("cfId") // //userId := h.postIntNecessary("userId") // //shopId := h.postIntNecessary("shopId") // //hrId := h.postIntNecessary("hrId") // ////dpId := h.postInt("dpId") // 用来判断是否上课的依据,目前不需要前台传递,根据cfId进行反查。且未确认上课时cf表中dpId=0 // ////oldSn := h.Ctx().PostForm("oldSn") // // // //logInfo, err := service.HrSensors{}.HrSensorsBindUser(sess, sn, cfId, userId, shopId, hrId) // //if err != nil { // // return // //} // //h.saveOptLogInfo(logInfo) // //h.json(newResponseBase()) // return //} // //// UnBindHrSensorsToUser godoc //// @Summary 心率带解绑用户 //// @tags HrSensors //// @Description 心率带解绑用户 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param cfId formData int true "课堂记录Id,必传字段" //// @Param bindId formData int true "绑定ID" //// @Param userId formData int true "用户ID" //// @Param sn formData string true "心率带Sn" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/UnBindHrSensorsToUser [post] //func (h *HrSensors) UnBindHrSensorsToUser() (err error) { // //sess := h.getSession() // //cfId := h.postIntNecessary("cfId") // //bindId := h.postIntNecessary("bindId") // //userId := h.postIntNecessary("userId") // //sn := h.postString("sn", true) // // // //logInfo, err := service.HrSensors{}.UnBindHrSensorsToUser(sess, sn, cfId, bindId, userId) // //if err != nil { // // return // //} // //h.saveOptLogInfo(logInfo) // //h.json(newResponseBase()) // return //} // //type SelectHrSensorsRs struct { // ResponseBase // Rs string // //Rs []*model.HrSensors //} // //// SelectHrSensors godoc //// @Summary 查询未绑定的心率带--下拉框用 //// @tags HrSensors //// @Description 查询未绑定的心率带--下拉框用 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param userId formData int false "用户ID" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/SelectHrSensors [post] //func (h *HrSensors) SelectHrSensors() (err error) { // //sess := h.getSession() // //userId := h.postInt("userId") // //rs, err := service.HrSensors{}.SelectHrSensors(sess, userId) // //if err != nil { // // return // //} // //h.json(SelectHrSensorsRs{ // // ResponseBase: ResponseBase{}, // // Rs: rs, // //}) // return //} // //type HrSensorsBindHistoryRs struct { // ResponseBase // Rs string //} // //// HrSensorsBindHistory godoc //// @Summary 查询心率带绑定历史记录 //// @tags HrSensors //// @Description 查询心率带绑定历史记录 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param hrId formData int false "心率带ID" //// @Param bt formData string true "开始时间 2020-10-10 00:00:01" //// @Param et formData string true "结束时间 2020-10-10 23:59:59" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/HrSensorsBindHistory [post] //func (h *HrSensors) HrSensorsBindHistory() (err error) { // //sess := h.getSession() // //bt, err := h.getPostFromTime("bt") // //if err != nil { // // return // //} // //et, err := h.getPostFromTime("et") // //if err != nil { // // return // //} // //hrId := h.postInt("hrId") // // // //rs, err := service.HrSensors{}.HrSensorsBindHistory(sess, hrId, bt, et) // //if err != nil { // // return // //} // //h.json(HrSensorsBindHistoryRs{ // // ResponseBase: ResponseBase{}, // // Rs: rs, // //}) // return //} // //// GetHrSensorsPowerPercent godoc //// @Summary 获取心率带电量 //// @tags HrSensors //// @Description 获取心率带电量 //// @Accept x-www-form-urlencoded //// @Produce json //// @Param token formData string true "Token" //// @Param shopId formData int true "商家ID" //// @Param hrId formData int false "心率带Id" //// @Success 200 {object} controller.ResponseBase //// @Router /HrSensors/GetHrSensorsPowerPercent [post] //func (h *HrSensors) GetHrSensorsPowerPercent() (err error) { // //sess := h.getSession() // //shopId := h.postIntNecessary("shopId") // //hrId := h.postInt("hrId") // ////jsonStr := h.postString("jsonStr", false) // ////dpId := h.postInt("dpId") // 用来判断是否上课的依据,目前不需要前台传递,根据cfId进行反查。且未确认上课时cf表中dpId=0 // ////oldSn := h.Ctx().PostForm("oldSn") // // // //logInfo, err := service.HrSensors{}.GetHrSensorsPowerPercent(sess, shopId, hrId) // //if err != nil { // // return // //} // //h.saveOptLogInfo(logInfo) // //h.json(newResponseBase()) // return //}