jyq 4 anos atrás
pai
commit
2914264e1c

+ 1 - 0
assembly/heartRate/model/band_data.go

@@ -6,4 +6,5 @@ type BandData struct {
 	HeartRate int
 	Battery   int
 	TimeMiles int64
+	CrId      int
 }

+ 4 - 3
assembly/heartRate/model/hr_course_detail.go

@@ -5,13 +5,14 @@ type HrResult struct {
 	PureCalorieNoVo2 int  `json:"pure_calorie_no_vo_2"`
 	Ck               int  `json:"ck"`
 	SportPer         int  `json:"sport_per"`
-	Hr               int  `json:"hr"`
+	HeartRate        int  `json:"heart_rate"`
 	AvgHr            int  `json:"avg_hr"`
 	MaxHr            int  `json:"max_hr"`
+	Battery          int  `json:"battery"`
+	GroupNo          int  `json:"group_no"`
+	IsPrivate        int  `json:"is_private"`
 	IsWin            bool `json:"is_win"`
 	IsBest           bool `json:"is_best"`
-	IsBreaking       bool `json:"is_breaking"`
-	BreakTime        int  `json:"break_time"`
 }
 type HrCourseDetail struct {
 	CrID int

+ 25 - 0
assembly/heartRate/model/hr_verify.go

@@ -0,0 +1,25 @@
+// Package model
+/**
+ * @ File: hr_verify.go
+ * @ Date: 2021/6/8 18:06
+ * @ Author: JYQ
+ * @ Description:
+ */
+package model
+
+type HrVerify struct {
+	CrId      int    `json:"cr_id"`
+	Age       int    `json:"age"`
+	Weight    int    `json:"weight"`
+	Sex       int    `json:"sex"`
+	StaticHr  int    `json:"static_hr"`
+	Height    int    `json:"height"`
+	HeadImg   string `json:"head_img"`
+	Name      string `json:"name"`
+	IsPrivate int    `json:"is_private"`
+}
+
+type HrVerifyDetail struct {
+	Sn string
+	HrVerify
+}

+ 42 - 0
assembly/heartRate/repository/redis/hr_verify_r1.go

@@ -0,0 +1,42 @@
+// Package redis
+/**
+ * @ File: hr_verify_r1.go
+ * @ Date: 2021/6/8 18:03
+ * @ Author: JYQ
+ * @ Description:
+ */
+package redis
+
+import (
+	"encoding/json"
+	"fmt"
+	"sportfitness/base/assembly/heartRate/model"
+
+	"github.com/go-redis/redis/v8"
+	"github.com/sirupsen/logrus"
+)
+
+const hrVerifyR1Key = prefix + ":hr_verify_r1"
+
+func HrVerifyR1(list []model.HrVerifyDetail) {
+	cmder, err := getClient().TxPipelined(ctx, func(pipeliner redis.Pipeliner) error {
+		for _, one := range list {
+			data, err2 := json.Marshal(one.HrVerify)
+			if err2 != nil {
+				panic(err2)
+			}
+			pipeliner.Set(ctx, fmt.Sprintf("%s:%s", hrVerifyR1Key, one.Sn), data, 0)
+		}
+		return nil
+	})
+
+	if err != nil {
+		logrus.Errorf("HrVerufyR1 保存失败:%s", err)
+		return
+	}
+	for _, r := range cmder {
+		if r.Err() != nil {
+			logrus.Errorf("HrVerufyR1 保存失败:%s", r.Err())
+		}
+	}
+}