Ver Fonte

feed: 配方评估

Yi há 1 ano atrás
pai
commit
6ac93cedef

+ 4 - 72
backend/operation/statistic.proto

@@ -7,83 +7,15 @@ option go_package = ".;operationPb";
 import "backend/operation/pagination.proto";
 import "backend/operation/enum.proto";
 
-// 添加配方评估 具体字段含义参照formula_estimate表对应的字段
-message AddFormulaEstimateRequest {
-  int32 id = 1;
-  int32 pasture_id = 2;
-  string pasture_name = 3;
-  int32 barn_id = 4;
-  int32 feed_formula_id = 5;
-  string feed_formula_name = 6;
-  int32 cow_number = 7;
-  int32 dry_formula_number = 8;
-  int32 dry_tmr_feed = 9;
-  int32 dry_food_intake = 10;
-  int32 mj_formula_number = 11;
-  int32 mj_tmr_feed = 12;
-  int32 mj_food_intake = 13;
-  int32 nnd_formula_number = 14;
-  int32 nnd_tmr_feed = 15;
-  int32 nnd_food_intake = 16;
-  int32 cpg_formula_number = 17;
-  int32 cpg_tmr_feed = 18;
-  int32 cpg_food_intake = 19;
-  int32 pg_formula_number = 20;
-  int32 pg_tmr_feed = 21;
-  int32 pg_food_intake = 22;
-  int32 dm_formula_number = 23;
-  int32 dm_tmr_feed = 24;
-  int32 dm_food_intake = 25;
-  int32 cpdm_formula_number = 26;
-  int32 cpdm_tmr_feed = 27;
-  int32 cpdm_food_intake = 28;
-  int32 fat_formula_number = 29;
-  int32 fat_tmr_feed = 30;
-  int32 fat_food_intake = 31;
-  int32 starch_formula_number = 32;
-  int32 starch_tmr_feed = 33;
-  int32 starch_food_intake = 34;
-  int32 ndf_formula_number = 35;
-  int32 ndf_tmr_feed = 36;
-  int32 ndf_food_intake = 37;
-  int32 cp_ndf_formula_number = 38;
-  int32 cp_ndf_tmr_feed = 39;
-  int32 cp_ndf_food_intake = 40;
-  int32 adf_formula_number = 41;
-  int32 adf_tmr_feed = 42;
-  int32 adf_food_intake = 43;
-  int32 calcium_formula_number = 44;
-  int32 calcium_tmr_feed = 45;
-  int32 calcium_food_intake = 46;
-  int32 pdm_formula_number = 47;
-  int32 pdm_tmr_feed = 48;
-  int32 pdm_food_intake = 49;
-  int32 cf_ratio_formula_number = 50;
-  int32 cf_ratio_tmr_feed = 51;
-  int32 cf_ratio_food_intake = 52;
-  int32 created_at = 53;
-  string created_at_format = 54;
-}
-
 message SearchFormulaEstimateRequest {
   string start_time  = 1;     // 开始时间
   string end_time    = 2;     // 结束时间
   int32 search_type = 3;      // 查询方式  1 安照配方 2 按照栏舍
   string name = 4;            // 名称
-  PaginationModel pagination = 5; // 分页
-}
-
-message SearchFormulaEstimateResponse {
-  int32 code = 1;
-  string msg = 2;
-  SearchFormulaEstimate data = 3;
-}
-
-message SearchFormulaEstimate {
-  int32 page = 1;
-  int32 total = 2;
-  int32 page_size = 3;
-  repeated AddFormulaEstimateRequest list = 4;
+  int32 pasture_id = 5;       // 牧场id
+  int32 template_id = 6;     // 配方模板id
+  int32 barn_id = 7;          // 栏舍id
+  PaginationModel pagination = 8; // 分页
 }
 
 // 首页 dashboard 准确性分析

+ 2 - 2
config/app.develop.yaml

@@ -1,7 +1,7 @@
-app_name: kpt-event
+app_name: kpt-tmr-group
 app_environment: test
 debug: true
-http_server_addr: ':8000'
+http_server_addr: ':8090'
 http_metrics_addr: ':23332'
 
 store:

+ 1 - 3
config/app.go

@@ -8,8 +8,6 @@ import (
 	"sync"
 )
 
-const AppName = "kptTmrGroup"
-
 var (
 	Module   = di.Provide(Options)
 	options  *AppConfig
@@ -79,7 +77,7 @@ func init() {
 		switch appEnv {
 		default:
 			err = Initialize("app.test.yaml", cfg)
-		case "development":
+		case "develop":
 			err = Initialize("app.develop.yaml", cfg)
 		case "production":
 			err = Initialize("app.production.yaml", cfg)

+ 1 - 1
config/app.test.yaml

@@ -1,4 +1,4 @@
-app_name: kpt-event
+app_name: kpt-tmr-group
 app_environment: test
 debug: true
 http_server_addr: ':8000'

+ 1 - 1
config/load_config_test.go

@@ -13,7 +13,7 @@ func TestInitialize(t *testing.T) {
 		wantErr bool
 	}{
 		{
-			name: AppName,
+			name: "AppName",
 			args: args{
 				path:      "app.test.yaml",
 				cfgStruct: nil,

+ 15 - 4
http/handler/statistic/analysis.go

@@ -13,8 +13,18 @@ import (
 
 // SearchFormulaEstimateList 配方评估
 func SearchFormulaEstimateList(c *gin.Context) {
-	req := &operationPb.SearchFormulaEstimateRequest{}
-	if err := c.BindJSON(req); err != nil {
+	var req operationPb.SearchFormulaEstimateRequest
+	if err := ginutil.BindProto(c, &req); err != nil {
+		apierr.AbortBadRequest(c, http.StatusBadRequest, err)
+		return
+	}
+
+	if err := valid.ValidateStruct(&req,
+		valid.Field(&req.Name, valid.Required),
+		valid.Field(&req.StartTime, valid.Required),
+		valid.Field(&req.EndTime, valid.Required),
+		valid.Field(&req.SearchType, valid.Required, valid.Min(0), valid.Max(2)),
+	); err != nil {
 		apierr.AbortBadRequest(c, http.StatusBadRequest, err)
 		return
 	}
@@ -25,12 +35,13 @@ func SearchFormulaEstimateList(c *gin.Context) {
 		PageOffset: int32(c.GetInt(middleware.PageOffset)),
 	}
 
-	res, err := middleware.BackendOperation(c).OpsService.SearchFormulaEstimateList(c, req)
+	res, err := middleware.BackendOperation(c).OpsService.SearchFormulaEstimateList(c, &req)
 	if err != nil {
 		apierr.ClassifiedAbort(c, err)
 		return
 	}
-	ginutil.JSONResp(c, res)
+	// ginutil.JSONResp(c, res)
+	c.JSON(http.StatusOK, res)
 }
 
 // AnalysisAccuracy 准备性分析

+ 1 - 0
http/route/root.go

@@ -20,6 +20,7 @@ func Root(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
 			middleware.Pagination(),
 			requestid.New(),
 			gzip.Gzip(gzip.DefaultCompression),
+			gin.Recovery(),
 		)
 	}
 }

+ 29 - 67
model/formula_estimate.go

@@ -1,10 +1,5 @@
 package model
 
-import (
-	operationPb "kpt-tmr-group/proto/go/backend/operation"
-	"time"
-)
-
 type FormulaEstimate struct {
 	Id                   int32  `json:"id"`
 	PastureId            int32  `json:"pasture_id"`
@@ -66,67 +61,34 @@ func (f *FormulaEstimate) TableName() string {
 	return "formula_estimate"
 }
 
-type FormulaEstimateSlice []*FormulaEstimate
+type FormulaEstimateRequest struct {
+	Name       string                 `json:"name"`
+	Page       int32                  `json:"page"`
+	Offset     int32                  `json:"offset"`
+	PageCount  int32                  `json:"pagecount"`
+	ReturnType string                 `json:"returntype"`
+	ParamMaps  *FormulaEstimateParams `json:"parammaps"`
+}
+
+type FormulaEstimateParams struct {
+	PastureId     string   `json:"pastureid"`
+	StartTime     string   `json:"startTime"`
+	StopTime      string   `json:"stopTime"`
+	InputDatetime []string `json:"inputDatetime"`
+	Search        string   `json:"search"`
+	TempletId     string   `json:"templetid"`
+	Barid         string   `json:"barid"`
+}
+
+type FormulaEstimateResponse struct {
+	Code int32                `json:"code"`
+	Msg  string               `json:"msg"`
+	Data *FormulaEstimateData `json:"data"`
+}
 
-func (f FormulaEstimateSlice) ToPB() []*operationPb.AddFormulaEstimateRequest {
-	res := make([]*operationPb.AddFormulaEstimateRequest, len(f))
-	for i, v := range f {
-		res[i] = &operationPb.AddFormulaEstimateRequest{
-			Id:                   v.Id,
-			PastureId:            v.PastureId,
-			PastureName:          v.PastureName,
-			BarnId:               v.BarnId,
-			FeedFormulaId:        v.FeedFormulaId,
-			FeedFormulaName:      v.FeedFormulaName,
-			CowNumber:            v.CowNumber,
-			DryFoodIntake:        v.DryFoodIntake,
-			DryFormulaNumber:     v.DryFormulaNumber,
-			DryTmrFeed:           v.DryTmrFeed,
-			MjFoodIntake:         v.MjFoodIntake,
-			MjFormulaNumber:      v.MjFormulaNumber,
-			MjTmrFeed:            v.MjTmrFeed,
-			NndFoodIntake:        v.NndFoodIntake,
-			NndFormulaNumber:     v.NndFormulaNumber,
-			NndTmrFeed:           v.NndTmrFeed,
-			CpgFoodIntake:        v.CpgFoodIntake,
-			CpgFormulaNumber:     v.CpgFormulaNumber,
-			CpgTmrFeed:           v.CpgTmrFeed,
-			PgFoodIntake:         v.PgFoodIntake,
-			PgFormulaNumber:      v.PgFormulaNumber,
-			PgTmrFeed:            v.PgTmrFeed,
-			DmFoodIntake:         v.DmFoodIntake,
-			DmFormulaNumber:      v.DmFormulaNumber,
-			DmTmrFeed:            v.DmTmrFeed,
-			CpdmFoodIntake:       v.CpdmFoodIntake,
-			CpdmFormulaNumber:    v.CpdmFormulaNumber,
-			CpdmTmrFeed:          v.CpdmTmrFeed,
-			FatFoodIntake:        v.FatFoodIntake,
-			FatFormulaNumber:     v.FatFormulaNumber,
-			FatTmrFeed:           v.FatTmrFeed,
-			StarchFoodIntake:     v.StarchFoodIntake,
-			StarchFormulaNumber:  v.StarchFormulaNumber,
-			StarchTmrFeed:        v.StarchTmrFeed,
-			NdfFoodIntake:        v.NdfFoodIntake,
-			NdfFormulaNumber:     v.NdfFormulaNumber,
-			NdfTmrFeed:           v.NdfTmrFeed,
-			CpNdfFoodIntake:      v.CpNdfFoodIntake,
-			CpNdfFormulaNumber:   v.CpNdfFormulaNumber,
-			CpNdfTmrFeed:         v.CpNdfTmrFeed,
-			AdfFoodIntake:        v.AdfFoodIntake,
-			AdfFormulaNumber:     v.AdfFormulaNumber,
-			AdfTmrFeed:           v.AdfTmrFeed,
-			CalciumFoodIntake:    v.CalciumFoodIntake,
-			CalciumFormulaNumber: v.CalciumFormulaNumber,
-			CalciumTmrFeed:       v.CalciumTmrFeed,
-			PdmFoodIntake:        v.PdmFoodIntake,
-			PdmFormulaNumber:     v.PdmFormulaNumber,
-			PdmTmrFeed:           v.PdmTmrFeed,
-			CfRatioFoodIntake:    v.CfRatioFoodIntake,
-			CfRatioFormulaNumber: v.CfRatioFormulaNumber,
-			CfRatioTmrFeed:       v.CfRatioTmrFeed,
-			CreatedAt:            v.CreatedAt,
-			CreatedAtFormat:      time.Unix(int64(v.CreatedAt), 0).Format(LayoutTime),
-		}
-	}
-	return res
+type FormulaEstimateData struct {
+	List     interface{} `json:"list"`
+	PageSize int32       `json:"pageSize"`
+	Total    int32       `json:"total"`
+	PageNum  int32       `json:"pageNum"`
 }

+ 75 - 1
model/group_pasture.go

@@ -1,8 +1,15 @@
 package model
 
 import (
+	"bytes"
+	"encoding/json"
+	"go.uber.org/zap"
+	"io/ioutil"
+	"kpt-tmr-group/pkg/logger/zaplog"
 	"kpt-tmr-group/pkg/tool"
+	"kpt-tmr-group/pkg/xerr"
 	operationPb "kpt-tmr-group/proto/go/backend/operation"
+	"net/http"
 	"time"
 )
 
@@ -13,6 +20,9 @@ type GroupPasture struct {
 	Password     string                  `json:"password"`
 	ManagerUser  string                  `json:"manager_user"`
 	ManagerPhone string                  `json:"manager_phone"`
+	Domain       string                  `json:"domain"`
+	Extranet     string                  `json:"extranet"`
+	Intranet     string                  `json:"intranet"`
 	IsShow       operationPb.IsShow_Kind `json:"is_show,omitempty"`
 	IsDelete     operationPb.IsShow_Kind `json:"is_delete,omitempty"`
 	Address      string                  `json:"address"`
@@ -20,7 +30,7 @@ type GroupPasture struct {
 	UpdatedAt    int64                   `json:"updated_at,omitempty"`
 }
 
-func (s *GroupPasture) TableName() string {
+func (g *GroupPasture) TableName() string {
 	return "group_pasture"
 }
 
@@ -40,6 +50,70 @@ func NewGroupPasture(req *operationPb.AddPastureRequest) *GroupPasture {
 	return groupPasture
 }
 
+type PastureClient struct {
+	Token      string        `json:"token"`
+	Detail     *GroupPasture `json:"detail"`
+	authClient *http.Client
+}
+
+func NewPastureClient(g *GroupPasture) *PastureClient {
+	return &PastureClient{Detail: g}
+}
+
+func (p *PastureClient) doRequest(req *http.Request) ([]byte, error) {
+	resp, err := p.authClient.Do(req)
+	if err != nil {
+		zaplog.Error("PastureClient", zap.Any("authClient.Do", err))
+		return nil, xerr.WithStack(err)
+	}
+	b, err := ioutil.ReadAll(resp.Body)
+	if err != nil {
+		zaplog.Error("PastureClient", zap.Any("ioutil.ReadAll", err))
+		return nil, xerr.WithStack(err)
+	}
+	if resp.StatusCode != http.StatusOK {
+		if len(b) > 0 {
+			return nil, xerr.Customf("err:%v,body:%s", err, string(b))
+		} else {
+			return nil, xerr.Customf("err:%v", err)
+		}
+	}
+	return b, nil
+}
+
+func (p *PastureClient) DoGet(url string) ([]byte, error) {
+	req, err := http.NewRequest(http.MethodGet, url, nil)
+	if err != nil {
+		zaplog.Error("PastureClient", zap.Any("DoGet", err))
+		return nil, err
+	}
+	req.Header.Add("Accept", "application/json")
+	req.Header.Add("token", p.Token)
+	req.Header.Add("Content-Type", "application/json")
+	return p.doRequest(req)
+}
+
+func (p *PastureClient) DoPost(url string, body interface{}) ([]byte, error) {
+	b, err := json.Marshal(body)
+	if err != nil {
+		zaplog.Error("PastureClient", zap.Any("DoPost-Marshal", err))
+		return nil, xerr.WithStack(err)
+	}
+	req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(b))
+	if err != nil {
+		zaplog.Error("PastureClient", zap.Any("NewRequest", err))
+		return nil, xerr.WithStack(err)
+	}
+	req.Header.Add("Accept", "application/json")
+	req.Header.Add("token", p.Token)
+	req.Header.Add("Content-Type", "application/json")
+	return p.doRequest(req)
+}
+
+func (p *PastureClient) GetToken() {
+
+}
+
 type GroupPastureSlice []*GroupPasture
 
 func (g GroupPastureSlice) ToPB() []*operationPb.AddPastureRequest {

+ 12 - 14
module/backend/feed_service.go

@@ -302,22 +302,20 @@ func (s *StoreEntry) EncodeNumber(ctx context.Context) string {
 	prefix := fmt.Sprintf("%s_%s", EncodeNumberPrefix, currTime)
 	data := &model.UniqueData{}
 	if err := s.DB.Order("id desc").Where("prefix = ?", prefix).First(data).Error; err != nil {
-		if errors.Is(err, gorm.ErrRecordNotFound) {
-			ud, _ := strconv.Atoi(currTime)
-			result := ud*100 + 1
-			newData := &model.UniqueData{
-				Prefix: prefix,
-				Data:   int64(result),
-			}
-			zaplog.Info("EncodeNumber Create Info", zap.Any("data", newData))
-			if err = s.DB.Create(newData).Error; err != nil {
-				zaplog.Error("EncodeNumber Create", zap.Any("data", newData), zap.Any("Err", err))
-				return ""
-			}
-			return fmt.Sprintf("%d", newData.Data)
-		} else {
+		if !errors.Is(err, gorm.ErrRecordNotFound) {
+			return ""
+		}
+		ud, _ := strconv.Atoi(currTime)
+		result := ud*100 + 1
+		newData := &model.UniqueData{
+			Prefix: prefix,
+			Data:   int64(result),
+		}
+		if err = s.DB.Create(newData).Error; err != nil {
+			zaplog.Error("EncodeNumber Create", zap.Any("data", newData), zap.Any("Err", err))
 			return ""
 		}
+		return fmt.Sprintf("%d", newData.Data)
 	}
 
 	data.Data += 1

+ 7 - 7
module/backend/interface.go

@@ -24,9 +24,9 @@ type Hub struct {
 type StoreEntry struct {
 	dig.In
 
-	Cfg      *config.AppConfig
-	DB       *kptstore.DB
-	WxClient *wechat.ClientService
+	Cfg        *config.AppConfig
+	DB         *kptstore.DB
+	HttpClient *wechat.ClientService
 }
 
 func NewStore(store StoreEntry) KptService {
@@ -35,9 +35,9 @@ func NewStore(store StoreEntry) KptService {
 
 func NewStoreEntry(cfg *config.AppConfig, Db *kptstore.DB) *StoreEntry {
 	return &StoreEntry{
-		Cfg:      cfg,
-		DB:       Db,
-		WxClient: nil,
+		Cfg:        cfg,
+		DB:         Db,
+		HttpClient: nil,
 	}
 }
 
@@ -129,7 +129,7 @@ type SystemService interface {
 }
 
 type StatisticService interface {
-	SearchFormulaEstimateList(ctx context.Context, req *operationPb.SearchFormulaEstimateRequest) (*operationPb.SearchFormulaEstimateResponse, error)
+	SearchFormulaEstimateList(ctx context.Context, req *operationPb.SearchFormulaEstimateRequest) (*model.FormulaEstimateResponse, error)
 	SearchAnalysisAccuracy(ctx context.Context, req *operationPb.SearchAnalysisAccuracyRequest) (*model.SearchAnalysisAccuracyResponse, error)
 }
 

+ 2 - 2
module/backend/mock/kptservice.go

@@ -810,10 +810,10 @@ func (mr *MockKptServiceMockRecorder) SearchForageList(arg0, arg1 interface{}) *
 }
 
 // SearchFormulaEstimateList mocks base method.
-func (m *MockKptService) SearchFormulaEstimateList(arg0 context.Context, arg1 *operationPb.SearchFormulaEstimateRequest) (*operationPb.SearchFormulaEstimateResponse, error) {
+func (m *MockKptService) SearchFormulaEstimateList(arg0 context.Context, arg1 *operationPb.SearchFormulaEstimateRequest) (*model.FormulaEstimateResponse, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "SearchFormulaEstimateList", arg0, arg1)
-	ret0, _ := ret[0].(*operationPb.SearchFormulaEstimateResponse)
+	ret0, _ := ret[0].(*model.FormulaEstimateResponse)
 	ret1, _ := ret[1].(error)
 	return ret0, ret1
 }

+ 43 - 36
module/backend/statistic_service.go

@@ -2,62 +2,69 @@ package backend
 
 import (
 	"context"
+	"encoding/json"
 	"fmt"
+	"go.uber.org/zap"
 	"kpt-tmr-group/model"
+	"kpt-tmr-group/pkg/logger/zaplog"
 	"kpt-tmr-group/pkg/xerr"
 	operationPb "kpt-tmr-group/proto/go/backend/operation"
 	"net/http"
 	"strconv"
 	"strings"
-	"time"
 )
 
-func (s *StoreEntry) SearchFormulaEstimateList(ctx context.Context, req *operationPb.SearchFormulaEstimateRequest) (*operationPb.SearchFormulaEstimateResponse, error) {
-	startTime, err := time.Parse(model.LayoutTime, req.StartTime)
-	if err != nil {
+// PastureDetailById 获取指定牧场详情
+func (s *StoreEntry) PastureDetailById(ctx context.Context, pastureId int64) (*model.GroupPasture, error) {
+	result := &model.GroupPasture{Id: pastureId}
+	if err := s.DB.Where("is_delete = ? and is_show = ?", operationPb.IsShow_OK, operationPb.IsShow_OK).First(result).Error; err != nil {
 		return nil, xerr.WithStack(err)
 	}
+	return result, nil
+}
 
-	endTime, err := time.Parse(model.LayoutTime, req.EndTime)
+// SearchFormulaEstimateList 配方评估
+func (s *StoreEntry) SearchFormulaEstimateList(ctx context.Context, req *operationPb.SearchFormulaEstimateRequest) (*model.FormulaEstimateResponse, error) {
+	pastureDetail, err := s.PastureDetailById(ctx, int64(req.PastureId))
 	if err != nil {
-		return nil, xerr.WithStack(err)
+		zaplog.Error("SearchFormulaEstimateList", zap.Any("Err", err), zap.Any("req", req))
+		return nil, xerr.Customf("该牧场数据错误")
 	}
-
-	startTimeUnix := startTime.Unix()
-	endTimeUnix := endTime.Unix()
-
-	formulaEstimate := make([]*model.FormulaEstimate, 0)
-	var count int64 = 0
-
-	pref := s.DB.Model(new(model.FormulaEstimate))
-	if req.Name != "" {
-		pref.Where("name like ?", fmt.Sprintf("%s%s%s", "%", req.Name, "%"))
+	pastureClient := model.NewPastureClient(pastureDetail)
+	body := &model.FormulaEstimateRequest{
+		Name:       req.Name,
+		Page:       req.Pagination.Page,
+		Offset:     req.Pagination.PageOffset,
+		PageCount:  req.Pagination.PageSize,
+		ReturnType: "map",
+		ParamMaps: &model.FormulaEstimateParams{
+			PastureId:     fmt.Sprintf("%d", req.PastureId),
+			StartTime:     req.StartTime,
+			StopTime:      req.EndTime,
+			InputDatetime: nil,
+			Search:        fmt.Sprintf("%d", req.SearchType),
+			TempletId:     fmt.Sprintf("%d", req.TemplateId),
+			Barid:         fmt.Sprintf("%d", req.BarnId),
+		},
 	}
-	if startTimeUnix > 0 && endTimeUnix > 0 && endTimeUnix >= startTimeUnix {
-		pref.Where("created_at BETWEEN ? AND ?", startTimeUnix, endTimeUnix)
+	url := fmt.Sprintf("%s/%s", pastureDetail.Domain, "authdata/GetDataByName")
+	result, err := pastureClient.DoPost(url, body)
+	if err != nil {
+		return nil, xerr.WithStack(err)
 	}
-
-	if req.SearchType == 1 {
-		pref.Where("feed_formula_name = ?", req.Name)
-	} else {
-		pref.Where("barn_id = ?", req.Name)
+	response := &model.FormulaEstimateResponse{}
+	if err = json.Unmarshal(result, response); err != nil {
+		return nil, xerr.WithStack(err)
 	}
+	if response.Code == 400 {
+		if response.Msg == "登录超时" {
 
-	if err = pref.Order("id desc").Count(&count).Limit(int(req.Pagination.PageSize)).Offset(int(req.Pagination.PageOffset)).
-		Find(&formulaEstimate).Error; err != nil {
-		return nil, xerr.WithStack(err)
+		} else {
+			return nil, xerr.WithStack(err)
+		}
 	}
 
-	return &operationPb.SearchFormulaEstimateResponse{
-		Code: http.StatusOK,
-		Msg:  "ok",
-		Data: &operationPb.SearchFormulaEstimate{
-			Page:     req.Pagination.Page,
-			Total:    int32(count),
-			PageSize: req.Pagination.PageSize,
-			List:     model.FormulaEstimateSlice(formulaEstimate).ToPB(),
-		},
-	}, nil
+	return response, nil
 }
 
 func (s *StoreEntry) SearchAnalysisAccuracy(ctx context.Context, req *operationPb.SearchAnalysisAccuracyRequest) (*model.SearchAnalysisAccuracyResponse, error) {

+ 2 - 2
module/backend/wx_applet_service.go

@@ -18,8 +18,8 @@ const (
 )
 
 func (s *StoreEntry) GetOpenId(ctx context.Context, jsCode string) (*operationPb.WxOpenId, error) {
-	url := fmt.Sprintf("%s?appid=%s&secret=%s&js_code=%s&grant_type=%s", OPENID_URL, s.WxClient.AppID, s.WxClient.Secret, jsCode, GRANT_TYPE)
-	res, err := s.WxClient.DoGet(url)
+	url := fmt.Sprintf("%s?appid=%s&secret=%s&js_code=%s&grant_type=%s", OPENID_URL, s.HttpClient.AppID, s.HttpClient.Secret, jsCode, GRANT_TYPE)
+	res, err := s.HttpClient.DoGet(url)
 	if err != nil {
 		zaplog.Error("GetOpenId", zap.Any("DoGet", err), zap.String("url", url))
 		return nil, xerr.WithStack(err)

+ 1 - 1
pkg/logger/logrus/log.go

@@ -35,7 +35,7 @@ func init() {
 	)
 	logrus.SetOutput(writer) // logrus 设置日志的输出方式
 	// Only log the warning severity or above.
-	logrus.SetLevel(DebugLevel)
+	logrus.SetLevel(WarnLevel)
 }
 
 // These are the different logging levels. You can set the logging level to log

Diff do ficheiro suprimidas por serem muito extensas
+ 138 - 871
proto/go/backend/operation/statistic.pb.go


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff