hrSensors.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. /**
  2. * @ File:
  3. * @ Date: 2021/1/25 16:15
  4. * @ Author: JYQ
  5. * @ Description:
  6. */
  7. package controller
  8. type HrSensors struct {
  9. BaseController
  10. }
  11. //
  12. //// AddHrSensors godoc
  13. //// @Summary 添加商家公共心率设备
  14. //// @tags HrSensors
  15. //// @Description 添加商家公共心率设备
  16. //// @Accept x-www-form-urlencoded
  17. //// @Produce json
  18. //// @Param token formData string true "Token"
  19. //// @Param shopId formData int true "商家ID"
  20. //// @Param sn formData int true "心率带Sn"
  21. //// @Param venueNo formData string false "场馆内编号 01 02"
  22. //// @Success 200 {object} controller.ResponseBase
  23. //// @Router /HrSensors/AddHrSensors [post]
  24. //func (h *HrSensors) AddHrSensors() (err error) {
  25. // //sess := h.Ctx().PostForm("Token")
  26. // //sn := h.postString("sn", true)
  27. // //venueNo := h.Ctx().PostForm("venueNo")
  28. // //shopId := h.postIntNecessary("shopId")
  29. // //
  30. // //logInfo, err := service.HrSensors{}.AddHrSensors(sess, sn, venueNo, shopId)
  31. // //if err != nil {
  32. // // return
  33. // //}
  34. // //h.saveOptLogInfo(logInfo)
  35. // //h.json(newResponseBase())
  36. // return
  37. //}
  38. //
  39. //// AddPvtHrSensors godoc
  40. //// @Summary 添加会员私有心率设备
  41. //// @tags HrSensors
  42. //// @Description 添加会员私有心率设备
  43. //// @Accept x-www-form-urlencoded
  44. //// @Produce json
  45. //// @Param token formData string true "Token"
  46. //// @Param shopId formData int true "商家ID"
  47. //// @Param sn formData int true "心率带Sn"
  48. //// @Param userId formData int true "用户ID"
  49. //// @Success 200 {object} controller.ResponseBase
  50. //// @Router /HrSensors/AddPvtHrSensors [post]
  51. //func (h *HrSensors) AddPvtHrSensors() (err error) {
  52. // //sess := h.Ctx().PostForm("Token")
  53. // //sn := h.postString("sn", true)
  54. // //shopId := h.postIntNecessary("shopId")
  55. // //userId := h.postIntNecessary("userId")
  56. // //
  57. // //logInfo, err := service.HrSensors{}.AddPvtHrSensors(sess, sn, userId, shopId)
  58. // //if err != nil {
  59. // // return
  60. // //}
  61. // //h.saveOptLogInfo(logInfo)
  62. // //h.json(newResponseBase())
  63. // return
  64. //}
  65. //
  66. //// EditHrSensors godoc
  67. //// @Summary 修改商家心率设备信息
  68. //// @tags HrSensors
  69. //// @Description 修改商家心率设备信息
  70. //// @Accept x-www-form-urlencoded
  71. //// @Produce json
  72. //// @Param token formData string true "Token"
  73. //// @Param hrId formData int true "心率带ID"
  74. //// @Param sn formData string true "心率带Sn"
  75. //// @Param shopId formData string true "商家ID"
  76. //// @Param venueNo formData string false "场馆内编号 01 02"
  77. //// @Success 200 {object} controller.ResponseBase
  78. //// @Router /HrSensors/EditHrSensors [post]
  79. //func (h *HrSensors) EditHrSensors() (err error) {
  80. // //sess := h.getSession()
  81. // //sn := h.postString("sn", true)
  82. // //venueNo := h.Ctx().PostForm("venueNo")
  83. // //hrId := h.postIntNecessary("hrId")
  84. // //shopId := h.postIntNecessary("shopId")
  85. // //
  86. // //logInfo, err := service.HrSensors{}.EditHrSensors(sess, sn, venueNo, shopId, hrId)
  87. // //if err != nil {
  88. // // return
  89. // //}
  90. // //h.saveOptLogInfo(logInfo)
  91. // //h.json(newResponseBase())
  92. // return
  93. //}
  94. //
  95. //// HrSensorsStatusEdit godoc
  96. //// @Summary 修改商家心率设备状态
  97. //// @tags HrSensors
  98. //// @Description 修改商家心率设备状态
  99. //// @Accept x-www-form-urlencoded
  100. //// @Produce json
  101. //// @Param token formData string true "Token"
  102. //// @Param hrId formData int true "心率带ID"
  103. //// @Param status formData int true "状态, 1:启用,8:暂停,9:删除"
  104. //// @Success 200 {object} controller.ResponseBase
  105. //// @Router /HrSensors/HrSensorsStatusEdit [post]
  106. //func (h *HrSensors) HrSensorsStatusEdit() (err error) {
  107. // //sess := h.getSession()
  108. // //hrId := h.postIntNecessary("hrId")
  109. // //status := h.postIntNecessary("status")
  110. // //
  111. // //logInfo, err := service.HrSensors{}.HrSensorsStatusEdit(sess, hrId, status)
  112. // //if err != nil {
  113. // // return
  114. // //}
  115. // //h.saveOptLogInfo(logInfo)
  116. // //h.json(newResponseBase())
  117. // return
  118. //}
  119. //
  120. //type QueryHrSensorsInfo struct {
  121. // ResponseBase
  122. // Rs string
  123. //}
  124. //
  125. //// QueryHrSensors godoc
  126. //// @Summary 查询商家公共心率设备
  127. //// @tags HrSensors
  128. //// @Description 查询商家公共心率设备
  129. //// @Accept x-www-form-urlencoded
  130. //// @Produce json
  131. //// @Param token formData string true "Token"
  132. //// @Param shopId formData int true "商家ID"
  133. //// @Param status formData int false "设备状态"
  134. //// @Param str formData string false "模糊查询sn与场内编号"
  135. //// @Success 200 {object} controller.ResponseBase
  136. //// @Router /HrSensors/QueryHrSensors [post]
  137. //func (h *HrSensors) QueryHrSensors() (err error) {
  138. // //sess := h.getSession()
  139. // //str := h.Ctx().PostForm("str")
  140. // //shopId := h.postIntNecessary("shopId")
  141. // //status := h.postInt("status")
  142. // //hr, err := service.HrSensors{}.QueryHrSensors(sess, shopId, str, status)
  143. // //if err != nil {
  144. // // return
  145. // //}
  146. // //h.json(QueryHrSensorsInfo{
  147. // // ResponseBase: ResponseBase{},
  148. // // Rs: hr,
  149. // //})
  150. // return
  151. //}
  152. //
  153. //// QueryPvtHrSensors godoc
  154. //// @Summary 查询商家会员私有心率设备
  155. //// @tags HrSensors
  156. //// @Description 查询商家会员私有心率设备
  157. //// @Accept x-www-form-urlencoded
  158. //// @Produce json
  159. //// @Param token formData string true "Token"
  160. //// @Param shopId formData int true "商家ID"
  161. //// @Param status formData int false "设备状态"
  162. //// @Param userName formData string false "用户姓名"
  163. //// @Param str formData string false "模糊查询sn与场内编号"
  164. //// @Success 200 {object} controller.ResponseBase
  165. //// @Router /HrSensors/QueryPvtHrSensors [post]
  166. //func (h *HrSensors) QueryPvtHrSensors() (err error) {
  167. // //sess := h.getSession()
  168. // //str := h.Ctx().PostForm("str")
  169. // //userName := h.Ctx().PostForm("userName")
  170. // //shopId := h.postIntNecessary("shopId")
  171. // //status := h.postInt("status")
  172. // //hr, err := service.HrSensors{}.QueryPvtHrSensors(sess, shopId, str, userName, status)
  173. // //if err != nil {
  174. // // return
  175. // //}
  176. // //h.json(QueryHrSensorsInfo{
  177. // // ResponseBase: ResponseBase{},
  178. // // Rs: hr,
  179. // //})
  180. // return
  181. //}
  182. //
  183. //// BindHrSensorsToUser godoc
  184. //// @Summary 心率带绑定用户
  185. //// @tags HrSensors
  186. //// @Description 心率带绑定用户
  187. //// @Accept x-www-form-urlencoded
  188. //// @Produce json
  189. //// @Param token formData string true "Token"
  190. //// @Param sn formData string true "心率带Sn"
  191. //// @Param cfId formData int true "课堂记录Id,必传字段"
  192. //// @Param userId formData int true "用户Id"
  193. //// @Param shopId formData int true "商家ID"
  194. //// @Param hrId formData int true "心率带ID"
  195. //// @Success 200 {object} controller.ResponseBase
  196. //// @Router /HrSensors/BindHrSensorsToUser [post]
  197. //func (h *HrSensors) BindHrSensorsToUser() (err error) {
  198. // //sess := h.getSession()
  199. // //sn := h.postString("sn", true)
  200. // //cfId := h.postIntNecessary("cfId")
  201. // //userId := h.postIntNecessary("userId")
  202. // //shopId := h.postIntNecessary("shopId")
  203. // //hrId := h.postIntNecessary("hrId")
  204. // ////dpId := h.postInt("dpId") // 用来判断是否上课的依据,目前不需要前台传递,根据cfId进行反查。且未确认上课时cf表中dpId=0
  205. // ////oldSn := h.Ctx().PostForm("oldSn")
  206. // //
  207. // //logInfo, err := service.HrSensors{}.HrSensorsBindUser(sess, sn, cfId, userId, shopId, hrId)
  208. // //if err != nil {
  209. // // return
  210. // //}
  211. // //h.saveOptLogInfo(logInfo)
  212. // //h.json(newResponseBase())
  213. // return
  214. //}
  215. //
  216. //// UnBindHrSensorsToUser godoc
  217. //// @Summary 心率带解绑用户
  218. //// @tags HrSensors
  219. //// @Description 心率带解绑用户
  220. //// @Accept x-www-form-urlencoded
  221. //// @Produce json
  222. //// @Param token formData string true "Token"
  223. //// @Param cfId formData int true "课堂记录Id,必传字段"
  224. //// @Param bindId formData int true "绑定ID"
  225. //// @Param userId formData int true "用户ID"
  226. //// @Param sn formData string true "心率带Sn"
  227. //// @Success 200 {object} controller.ResponseBase
  228. //// @Router /HrSensors/UnBindHrSensorsToUser [post]
  229. //func (h *HrSensors) UnBindHrSensorsToUser() (err error) {
  230. // //sess := h.getSession()
  231. // //cfId := h.postIntNecessary("cfId")
  232. // //bindId := h.postIntNecessary("bindId")
  233. // //userId := h.postIntNecessary("userId")
  234. // //sn := h.postString("sn", true)
  235. // //
  236. // //logInfo, err := service.HrSensors{}.UnBindHrSensorsToUser(sess, sn, cfId, bindId, userId)
  237. // //if err != nil {
  238. // // return
  239. // //}
  240. // //h.saveOptLogInfo(logInfo)
  241. // //h.json(newResponseBase())
  242. // return
  243. //}
  244. //
  245. //type SelectHrSensorsRs struct {
  246. // ResponseBase
  247. // Rs string
  248. // //Rs []*model.HrSensors
  249. //}
  250. //
  251. //// SelectHrSensors godoc
  252. //// @Summary 查询未绑定的心率带--下拉框用
  253. //// @tags HrSensors
  254. //// @Description 查询未绑定的心率带--下拉框用
  255. //// @Accept x-www-form-urlencoded
  256. //// @Produce json
  257. //// @Param token formData string true "Token"
  258. //// @Param userId formData int false "用户ID"
  259. //// @Success 200 {object} controller.ResponseBase
  260. //// @Router /HrSensors/SelectHrSensors [post]
  261. //func (h *HrSensors) SelectHrSensors() (err error) {
  262. // //sess := h.getSession()
  263. // //userId := h.postInt("userId")
  264. // //rs, err := service.HrSensors{}.SelectHrSensors(sess, userId)
  265. // //if err != nil {
  266. // // return
  267. // //}
  268. // //h.json(SelectHrSensorsRs{
  269. // // ResponseBase: ResponseBase{},
  270. // // Rs: rs,
  271. // //})
  272. // return
  273. //}
  274. //
  275. //type HrSensorsBindHistoryRs struct {
  276. // ResponseBase
  277. // Rs string
  278. //}
  279. //
  280. //// HrSensorsBindHistory godoc
  281. //// @Summary 查询心率带绑定历史记录
  282. //// @tags HrSensors
  283. //// @Description 查询心率带绑定历史记录
  284. //// @Accept x-www-form-urlencoded
  285. //// @Produce json
  286. //// @Param token formData string true "Token"
  287. //// @Param hrId formData int false "心率带ID"
  288. //// @Param bt formData string true "开始时间 2020-10-10 00:00:01"
  289. //// @Param et formData string true "结束时间 2020-10-10 23:59:59"
  290. //// @Success 200 {object} controller.ResponseBase
  291. //// @Router /HrSensors/HrSensorsBindHistory [post]
  292. //func (h *HrSensors) HrSensorsBindHistory() (err error) {
  293. // //sess := h.getSession()
  294. // //bt, err := h.getPostFromTime("bt")
  295. // //if err != nil {
  296. // // return
  297. // //}
  298. // //et, err := h.getPostFromTime("et")
  299. // //if err != nil {
  300. // // return
  301. // //}
  302. // //hrId := h.postInt("hrId")
  303. // //
  304. // //rs, err := service.HrSensors{}.HrSensorsBindHistory(sess, hrId, bt, et)
  305. // //if err != nil {
  306. // // return
  307. // //}
  308. // //h.json(HrSensorsBindHistoryRs{
  309. // // ResponseBase: ResponseBase{},
  310. // // Rs: rs,
  311. // //})
  312. // return
  313. //}
  314. //
  315. //// GetHrSensorsPowerPercent godoc
  316. //// @Summary 获取心率带电量
  317. //// @tags HrSensors
  318. //// @Description 获取心率带电量
  319. //// @Accept x-www-form-urlencoded
  320. //// @Produce json
  321. //// @Param token formData string true "Token"
  322. //// @Param shopId formData int true "商家ID"
  323. //// @Param hrId formData int false "心率带Id"
  324. //// @Success 200 {object} controller.ResponseBase
  325. //// @Router /HrSensors/GetHrSensorsPowerPercent [post]
  326. //func (h *HrSensors) GetHrSensorsPowerPercent() (err error) {
  327. // //sess := h.getSession()
  328. // //shopId := h.postIntNecessary("shopId")
  329. // //hrId := h.postInt("hrId")
  330. // ////jsonStr := h.postString("jsonStr", false)
  331. // ////dpId := h.postInt("dpId") // 用来判断是否上课的依据,目前不需要前台传递,根据cfId进行反查。且未确认上课时cf表中dpId=0
  332. // ////oldSn := h.Ctx().PostForm("oldSn")
  333. // //
  334. // //logInfo, err := service.HrSensors{}.GetHrSensorsPowerPercent(sess, shopId, hrId)
  335. // //if err != nil {
  336. // // return
  337. // //}
  338. // //h.saveOptLogInfo(logInfo)
  339. // //h.json(newResponseBase())
  340. // return
  341. //}