Browse Source

Merge remote-tracking branch 'origin/master'

gaoyagang 1 năm trước cách đây
mục cha
commit
d0d3942849

+ 8 - 8
app/cmd/dtgateway/desc/dtgateway.api

@@ -13,35 +13,35 @@ service dtgateway {
 	@doc "查询working uf信息"
 	@doc "查询working uf信息"
 	@handler WorkingUf
 	@handler WorkingUf
 	get /working-uf/info (DcWorkingReq) returns (CommonResponse)
 	get /working-uf/info (DcWorkingReq) returns (CommonResponse)
-
+	
 	@doc "查询working ro信息"
 	@doc "查询working ro信息"
 	@handler WorkingRo
 	@handler WorkingRo
 	get /working-ro/info (DcWorkingReq) returns (CommonResponse)
 	get /working-ro/info (DcWorkingReq) returns (CommonResponse)
-
+	
 	@doc "查询working chest信息"
 	@doc "查询working chest信息"
 	@handler WorkingChest
 	@handler WorkingChest
 	get /working-chest/info (DcWorkingReq) returns (CommonResponse)
 	get /working-chest/info (DcWorkingReq) returns (CommonResponse)
-
+	
 	@doc "查询working pump信息"
 	@doc "查询working pump信息"
 	@handler WorkingPump
 	@handler WorkingPump
 	get /working-pump/info (DcWorkingReq) returns (CommonResponse)
 	get /working-pump/info (DcWorkingReq) returns (CommonResponse)
-
+	
 	@doc "查询working valve信息"
 	@doc "查询working valve信息"
 	@handler WorkingValve
 	@handler WorkingValve
 	get /working-valve/info (DcWorkingReq) returns (CommonResponse)
 	get /working-valve/info (DcWorkingReq) returns (CommonResponse)
-
+	
 	@doc "秒级单点数据批量入库"
 	@doc "秒级单点数据批量入库"
 	@handler ItemHistoryDataMultiAdd
 	@handler ItemHistoryDataMultiAdd
 	post /item-history/multi-add (MultiAddItemHistoryDataReq) returns (CommonResponse)
 	post /item-history/multi-add (MultiAddItemHistoryDataReq) returns (CommonResponse)
-
+	
 	@doc "点位历史数据查询"
 	@doc "点位历史数据查询"
 	@handler ItemHistoryDataList
 	@handler ItemHistoryDataList
 	get /item-history/list (ItemHistoryDataListReq) returns (CommonResponse)
 	get /item-history/list (ItemHistoryDataListReq) returns (CommonResponse)
-
+	
 	@doc "按时间点位历史数据查询"
 	@doc "按时间点位历史数据查询"
 	@handler ItemHistoryDataInfo
 	@handler ItemHistoryDataInfo
 	get /item-history/info (ItemHistoryDataByTimeReq) returns (CommonResponse)
 	get /item-history/info (ItemHistoryDataByTimeReq) returns (CommonResponse)
-
+	
 	@doc "按时间点位历史数据最大值最小值查询"
 	@doc "按时间点位历史数据最大值最小值查询"
 	@handler ItemHistoryDataMaxMin
 	@handler ItemHistoryDataMaxMin
 	get /item-history/max-min (ItemHistoryDataMaxMinByTimeReq) returns (CommonResponse)
 	get /item-history/max-min (ItemHistoryDataMaxMinByTimeReq) returns (CommonResponse)

+ 2 - 1
app/cmd/dtgateway/desc/dtgateway/dtgateway.api

@@ -26,13 +26,14 @@ type (
     }
     }
 
 
     ItemHistoryData {
     ItemHistoryData {
-        CommonParams
+        ProjectId int64 `json:"project_id"`
         ItemName string `json:"item_name"`
         ItemName string `json:"item_name"`
         Val float64 `json:"val"`
         Val float64 `json:"val"`
         HTime string `json:"h_time"`
         HTime string `json:"h_time"`
     }
     }
 
 
     MultiAddItemHistoryDataReq {
     MultiAddItemHistoryDataReq {
+        CommonParams
         List []*ItemHistoryData `json:"list"`
         List []*ItemHistoryData `json:"list"`
     }
     }
 
 

+ 0 - 3
app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataInfoLogic.go

@@ -6,8 +6,6 @@ import (
 	"GtDataStore/app/cmd/organization/pb"
 	"GtDataStore/app/cmd/organization/pb"
 	"GtDataStore/common/xerr"
 	"GtDataStore/common/xerr"
 	"context"
 	"context"
-	"fmt"
-
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
 )
 )
 
 
@@ -32,7 +30,6 @@ func (l *ItemHistoryDataInfoLogic) ItemHistoryDataInfo(req *types.ItemHistoryDat
 		Stime:     req.STime,
 		Stime:     req.STime,
 		Etime:     req.ETime,
 		Etime:     req.ETime,
 	})
 	})
-	fmt.Println("rpc:", dataList)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}

+ 2 - 1
app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataMultiAddLogic.go

@@ -7,6 +7,7 @@ import (
 	"GtDataStore/common/xerr"
 	"GtDataStore/common/xerr"
 	"context"
 	"context"
 	"errors"
 	"errors"
+	"fmt"
 
 
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
 )
 )
@@ -39,7 +40,7 @@ func (l *ItemHistoryDataMultiAddLogic) ItemHistoryDataMultiAdd(req *types.MultiA
 			HTime:     line.HTime,
 			HTime:     line.HTime,
 		}
 		}
 	}
 	}
-
+	fmt.Println("project_id:", req.List[0].ProjectId)
 	_, err = l.svcCtx.OrganizationRpc.MultiAddItemHistoryData(l.ctx, &pb.MultiAddItemHistoryDataReq{
 	_, err = l.svcCtx.OrganizationRpc.MultiAddItemHistoryData(l.ctx, &pb.MultiAddItemHistoryDataReq{
 		ProjectId: req.List[0].ProjectId,
 		ProjectId: req.List[0].ProjectId,
 		List:      dataList,
 		List:      dataList,

+ 8 - 0
app/cmd/dtgateway/internal/middleware/datasignMiddleware.go

@@ -9,6 +9,7 @@ import (
 	"bytes"
 	"bytes"
 	"context"
 	"context"
 	"fmt"
 	"fmt"
+	"github.com/zeromicro/go-zero/core/service"
 	"github.com/zeromicro/go-zero/core/stores/sqlx"
 	"github.com/zeromicro/go-zero/core/stores/sqlx"
 	"github.com/zeromicro/go-zero/core/validation"
 	"github.com/zeromicro/go-zero/core/validation"
 	"github.com/zeromicro/go-zero/rest/httpx"
 	"github.com/zeromicro/go-zero/rest/httpx"
@@ -34,6 +35,7 @@ var (
 	appSecrets     = make(map[string]secretExpire)
 	appSecrets     = make(map[string]secretExpire)
 	appSecretsLock sync.Mutex
 	appSecretsLock sync.Mutex
 	validator      atomic.Value
 	validator      atomic.Value
+	confMode       string
 )
 )
 
 
 type (
 type (
@@ -57,6 +59,7 @@ type (
 )
 )
 
 
 func NewDataSignMiddleware(conf config.Config) *DataSignMiddleware {
 func NewDataSignMiddleware(conf config.Config) *DataSignMiddleware {
+	confMode = conf.Mode
 	mysql := sqlx.NewMysql(conf.DtDataStoreDB.DataSource)
 	mysql := sqlx.NewMysql(conf.DtDataStoreDB.DataSource)
 	return &DataSignMiddleware{
 	return &DataSignMiddleware{
 		AppInfo: model.NewDcAppInfoModel(mysql),
 		AppInfo: model.NewDcAppInfoModel(mysql),
@@ -64,6 +67,11 @@ func NewDataSignMiddleware(conf config.Config) *DataSignMiddleware {
 }
 }
 
 
 func (m *DataSignMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
 func (m *DataSignMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
+	if confMode == service.DevMode {
+		return func(w http.ResponseWriter, r *http.Request) {
+			next(w, r)
+		}
+	}
 	return func(w http.ResponseWriter, r *http.Request) {
 	return func(w http.ResponseWriter, r *http.Request) {
 		cps := CommonParams{}
 		cps := CommonParams{}
 		err := m.parseCommonParams(r, &cps)
 		err := m.parseCommonParams(r, &cps)

+ 5 - 4
app/cmd/dtgateway/internal/types/types.go

@@ -26,13 +26,14 @@ type DcWorkingReq struct {
 }
 }
 
 
 type ItemHistoryData struct {
 type ItemHistoryData struct {
-	CommonParams
-	ItemName string  `json:"item_name"`
-	Val      float64 `json:"val"`
-	HTime    string  `json:"h_time"`
+	ProjectId int64   `json:"project_id"`
+	ItemName  string  `json:"item_name"`
+	Val       float64 `json:"val"`
+	HTime     string  `json:"h_time"`
 }
 }
 
 
 type MultiAddItemHistoryDataReq struct {
 type MultiAddItemHistoryDataReq struct {
+	CommonParams
 	List []*ItemHistoryData `json:"list"`
 	List []*ItemHistoryData `json:"list"`
 }
 }