| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343 |
- /**
- * @ 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
- //}
|