Ver código fonte

Merge branch 'hotfix/mix_table_number' of eta_server/eta_chart_lib into master

xyxie 11 meses atrás
pai
commit
b72fcdb8a4
3 arquivos alterados com 7 adições e 7 exclusões
  1. 1 1
      models/chart.go
  2. 3 3
      utils/redis/cluster_redis.go
  3. 3 3
      utils/redis/standalone_redis.go

+ 1 - 1
models/chart.go

@@ -157,7 +157,7 @@ func GetEdbDataList(source, subSource, endInfoId int, startDate, endDate string)
 		condition += ` AND data_time<=? `
 		pars = append(pars, endDate)
 	}
-	sql := `SELECT edb_data_id,edb_info_id,data_time,TRUNCATE(value,4) AS value,data_timestamp FROM %s WHERE edb_info_id=? `
+	sql := `SELECT edb_data_id,edb_info_id,data_time,value,data_timestamp FROM %s WHERE edb_info_id=? `
 	if condition != "" {
 		sql += condition
 	}

+ 3 - 3
utils/redis/cluster_redis.go

@@ -149,12 +149,12 @@ func (rc *ClusterRedisClient) Put(key string, val interface{}, timeout time.Dura
 // @param timeout
 // @return bool
 func (rc *ClusterRedisClient) SetNX(key string, val interface{}, timeout time.Duration) bool {
-	result, err := rc.redisClient.SetEX(context.TODO(), key, val, timeout).Result()
-	if err != nil || result != "OK" {
+	result, err := rc.redisClient.SetNX(context.TODO(), key, val, timeout).Result()
+	if err != nil {
 		return false
 	}
 
-	return true
+	return result
 }
 
 // Delete

+ 3 - 3
utils/redis/standalone_redis.go

@@ -141,12 +141,12 @@ func (rc *StandaloneRedisClient) Put(key string, val interface{}, timeout time.D
 // @param timeout
 // @return bool
 func (rc *StandaloneRedisClient) SetNX(key string, val interface{}, timeout time.Duration) bool {
-	result, err := rc.redisClient.SetEX(context.TODO(), key, val, timeout).Result()
-	if err != nil || result != "OK" {
+	result, err := rc.redisClient.SetNX(context.TODO(), key, val, timeout).Result()
+	if err != nil {
 		return false
 	}
 
-	return true
+	return result
 }
 
 // Delete