Parcourir la source

新增接口与修改存过函数名称

jyq il y a 4 ans
Parent
commit
531126859b

+ 18 - 0
api/grpc/base.go

@@ -174,6 +174,16 @@ func (a Api) GroupSimpleQueryByShopID(ctx context.Context, r *pb.StandardRequest
 	return rst, nil
 }
 
+// EqSimpleQuery 商家分组简单查询-通过商家自己ID查询
+func (a Api) EqSimpleQuery(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
+	// 获取token,并验证签名函数
+	token, q, sign := a.webToGoVerify(ctx, r)
+
+	rs := service.Shop{}.EqSimpleQuery(token, q.ShopID, q.JsonStr, sign)
+	rst := a.toWebFunc(rs)
+	return rst, nil
+}
+
 // ----------------------- 商家信息管理 ---------------------------------------------
 
 func (a Api) ManageableShopList(ctx context.Context, r *pb.ShopListRequest) (*pb.ShopListReply, error) {
@@ -226,6 +236,14 @@ func (a Api) GetShopNavi(ctx context.Context, r *pb.GetShopNaviRequest) (*pb.Get
 	return rs, nil
 }
 
+// GetShopNaviAll 查询商家全部栏目
+func (a Api) GetShopNaviAll(ctx context.Context, r *pb.GetShopNaviAllRequest) (*pb.GetShopNaviAllReply, error) {
+	token := a.getToken(ctx)
+
+	rs := service.Shop{}.GetShopNaviAll(token, r)
+	return rs, nil
+}
+
 // ShopGroupAdd 商家跨店分组添加
 func (a Api) ShopGroupAdd(ctx context.Context, r *pb.StandardRequest) (*pb.StandardReply, error) {
 	// 获取token,并验证签名函数

Fichier diff supprimé car celui-ci est trop grand
+ 587 - 478
api/grpc/base/base.pb.go


+ 36 - 0
api/grpc/base/base_grpc.pb.go

@@ -39,6 +39,7 @@ type ApiClient interface {
 	ShopLicenseList(ctx context.Context, in *ShopDetailRequest, opts ...grpc.CallOption) (*LicenseList, error)
 	ShopLicenseTypeMap(ctx context.Context, in *IdList, opts ...grpc.CallOption) (*LicenseTypeMapReply, error)
 	GetShopNavi(ctx context.Context, in *GetShopNaviRequest, opts ...grpc.CallOption) (*GetShopNaviReply, error)
+	GetShopNaviAll(ctx context.Context, in *GetShopNaviAllRequest, opts ...grpc.CallOption) (*GetShopNaviAllReply, error)
 	ShopGroupQuery(ctx context.Context, in *StandardRequest, opts ...grpc.CallOption) (*StandardReply, error)
 	ShopGroupAdd(ctx context.Context, in *StandardRequest, opts ...grpc.CallOption) (*StandardReply, error)
 	ShopGroupEdit(ctx context.Context, in *StandardRequest, opts ...grpc.CallOption) (*StandardReply, error)
@@ -324,6 +325,15 @@ func (c *apiClient) GetShopNavi(ctx context.Context, in *GetShopNaviRequest, opt
 	return out, nil
 }
 
+func (c *apiClient) GetShopNaviAll(ctx context.Context, in *GetShopNaviAllRequest, opts ...grpc.CallOption) (*GetShopNaviAllReply, error) {
+	out := new(GetShopNaviAllReply)
+	err := c.cc.Invoke(ctx, "/base.Api/GetShopNaviAll", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *apiClient) ShopGroupQuery(ctx context.Context, in *StandardRequest, opts ...grpc.CallOption) (*StandardReply, error) {
 	out := new(StandardReply)
 	err := c.cc.Invoke(ctx, "/base.Api/ShopGroupQuery", in, out, opts...)
@@ -1303,6 +1313,7 @@ type ApiServer interface {
 	ShopLicenseList(context.Context, *ShopDetailRequest) (*LicenseList, error)
 	ShopLicenseTypeMap(context.Context, *IdList) (*LicenseTypeMapReply, error)
 	GetShopNavi(context.Context, *GetShopNaviRequest) (*GetShopNaviReply, error)
+	GetShopNaviAll(context.Context, *GetShopNaviAllRequest) (*GetShopNaviAllReply, error)
 	ShopGroupQuery(context.Context, *StandardRequest) (*StandardReply, error)
 	ShopGroupAdd(context.Context, *StandardRequest) (*StandardReply, error)
 	ShopGroupEdit(context.Context, *StandardRequest) (*StandardReply, error)
@@ -1477,6 +1488,9 @@ func (UnimplementedApiServer) ShopLicenseTypeMap(context.Context, *IdList) (*Lic
 func (UnimplementedApiServer) GetShopNavi(context.Context, *GetShopNaviRequest) (*GetShopNaviReply, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetShopNavi not implemented")
 }
+func (UnimplementedApiServer) GetShopNaviAll(context.Context, *GetShopNaviAllRequest) (*GetShopNaviAllReply, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetShopNaviAll not implemented")
+}
 func (UnimplementedApiServer) ShopGroupQuery(context.Context, *StandardRequest) (*StandardReply, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ShopGroupQuery not implemented")
 }
@@ -2132,6 +2146,24 @@ func _Api_GetShopNavi_Handler(srv interface{}, ctx context.Context, dec func(int
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Api_GetShopNaviAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GetShopNaviAllRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(ApiServer).GetShopNaviAll(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/base.Api/GetShopNaviAll",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(ApiServer).GetShopNaviAll(ctx, req.(*GetShopNaviAllRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 func _Api_ShopGroupQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(StandardRequest)
 	if err := dec(in); err != nil {
@@ -4119,6 +4151,10 @@ var Api_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "GetShopNavi",
 			Handler:    _Api_GetShopNavi_Handler,
 		},
+		{
+			MethodName: "GetShopNaviAll",
+			Handler:    _Api_GetShopNaviAll_Handler,
+		},
 		{
 			MethodName: "ShopGroupQuery",
 			Handler:    _Api_ShopGroupQuery_Handler,

+ 7 - 0
assembly/base/repository/postgre/shop.go

@@ -303,3 +303,10 @@ func (PGShop) GroupSimpleQuery(optUserId int64, objectShopId int64, jsonStr stri
 
 	return
 }
+
+func (PGShop) EqSimpleQuery(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
+	err = getClient().Raw("select fn_eq_simple_query(? ,? ,?, ? )", optUserId, objectShopId, jsonStr, verfStr).
+		Scan(&result).Error
+
+	return
+}

+ 77 - 2
assembly/base/service/shop.go

@@ -8,6 +8,7 @@
 package service
 
 import (
+	"encoding/json"
 	pb "sportfitness/base/api/grpc/base"
 	"sportfitness/base/assembly/base/repository/postgre"
 	"sportfitness/base/errors"
@@ -123,7 +124,7 @@ func (s Shop) LicenseTypeMap(token string, r *pb.IdList) *pb.LicenseTypeMapReply
 func (s Shop) GetShopNavi(token string, r *pb.GetShopNaviRequest) *pb.GetShopNaviReply {
 	optId := s.checkPermission(token, r.GetShopId())
 
-	rst := im.GetShopNavi(int64(optId), r.GetShopId(), r.GetParentId())
+	rst := im.GetShopNavi(optId, r.GetShopId(), r.GetParentId())
 	var info []*pb.Column
 	if len(rst.List) > 0 {
 		for _, v := range rst.List {
@@ -138,10 +139,73 @@ func (s Shop) GetShopNavi(token string, r *pb.GetShopNaviRequest) *pb.GetShopNav
 			info = append(info, l)
 		}
 	}
-
+	column, err := json.Marshal(info)
+	if err != nil {
+		println(err)
+	}
+	println(string(column))
 	return &pb.GetShopNaviReply{List: info}
 }
 
+type ShopColumn struct {
+	Navi
+	Second []Navi
+}
+
+type Navi struct {
+	Name    string
+	Url     string
+	Code    string
+	Sn      int32
+	Status  pb.WebStatus
+	NavShow bool
+	Id      string
+}
+
+// GetShopNaviAll 获取全部商家导航
+func (s Shop) GetShopNaviAll(token string, r *pb.GetShopNaviAllRequest) *pb.GetShopNaviAllReply {
+	optId := s.checkPermission(token, r.GetShopId())
+
+	rst := im.GetShopNavi(optId, r.GetShopId(), 0)
+	var info []*ShopColumn
+	if len(rst.List) > 0 {
+		for _, v := range rst.List {
+			l := &ShopColumn{}
+			l.Name = v.Name
+			l.Url = v.Url
+			l.Code = v.Code
+			l.Sn = v.Sn
+			l.NavShow = v.NavShow
+			l.Id = strconv.FormatInt(v.Id, 10)
+			l.Status = s.ManageStatusToWebStatus(v.Status)
+			secRs := im.GetShopNavi(optId, r.GetShopId(), v.Id)
+			if secRs.List != nil {
+				for _, v := range secRs.List {
+					n := Navi{}
+					n.Name = v.Name
+					n.Url = v.Url
+					n.Code = v.Code
+					n.Sn = v.Sn
+					n.NavShow = v.NavShow
+					n.Id = strconv.FormatInt(v.Id, 10)
+					n.Status = s.ManageStatusToWebStatus(v.Status)
+					l.Second = append(l.Second, n)
+				}
+			} else {
+				l.Second = make([]Navi, 0)
+			}
+
+			info = append(info, l)
+		}
+	}
+	column, err := json.Marshal(info)
+	if err != nil {
+		println(err)
+	}
+
+	return &pb.GetShopNaviAllReply{ColumnRs: string(column)}
+}
+
 // ShopLicenseList 获取商家许可证
 func (s Shop) ShopLicenseList(token string, r *pb.ShopDetailRequest) *pb.LicenseList {
 	_ = s.checkPermission(token, r.GetShopId())
@@ -340,3 +404,14 @@ func (s Shop) GroupSimpleQueryByShopID(token string, objectShopId int64, jsonStr
 	}
 	return rst
 }
+
+// EqSimpleQuery 显示设备简单查询
+func (s Shop) EqSimpleQuery(token string, objectShopId int64, jsonStr string, sign string) string {
+	optId := s.checkPermission(token, objectShopId)
+
+	rst, err := postgre.PGShop{}.EqSimpleQuery(optId, objectShopId, jsonStr, sign)
+	if err != nil {
+		panic(errors.PGError)
+	}
+	return rst
+}

+ 9 - 9
assembly/heartRate/repository/postgre/hr.go

@@ -11,42 +11,42 @@ type PGHr struct {
 }
 
 func (PGHr) PublicSensorQuery(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
-	err = getClient().Raw("select fn_public_sensor_query(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
+	err = getClient().Raw("select fn_hr_sensors_public_sensors_del(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
 		Scan(&result).Error
 
 	return
 }
 
 func (PGHr) PrivateSensorQuery(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
-	err = getClient().Raw("select fn_private_sensor_query(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
+	err = getClient().Raw("select fn_hr_sensors_private_sensors_del(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
 		Scan(&result).Error
 
 	return
 }
 
 func (PGHr) PublicSensorsAdd(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
-	err = getClient().Raw("select fn_public_sensor_add(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
+	err = getClient().Raw("select fn_hr_sensors_public_sensors_add(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
 		Scan(&result).Error
 
 	return
 }
 
 func (PGHr) PrivateSensorsAdd(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
-	err = getClient().Raw("select fn_private_sensor_add(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
+	err = getClient().Raw("select fn_hr_sensors_private_sensors_add(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
 		Scan(&result).Error
 
 	return
 }
 
 func (PGHr) SensorsEdit(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
-	err = getClient().Raw("select fn_sensor_edit(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
+	err = getClient().Raw("select fn_hr_sensors_sensors_edit(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
 		Scan(&result).Error
 
 	return
 }
 
 func (PGHr) SensorsDel(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
-	err = getClient().Raw("select fn_sensor_del(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
+	err = getClient().Raw("select fn_hr_sensors_sensors_del(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
 		Scan(&result).Error
 
 	return
@@ -60,21 +60,21 @@ func (PGHr) PkGroupChg(optUserId int64, objectShopId int64, jsonStr string, verf
 }
 
 func (PGHr) CrBind(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
-	err = getClient().Raw("select fn_cr_bind(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
+	err = getClient().Raw("select fn_hr_sensors_cr_bind(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
 		Scan(&result).Error
 
 	return
 }
 
 func (PGHr) CrUnBind(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
-	err = getClient().Raw("select fn_cr_unbind(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
+	err = getClient().Raw("select fn_hr_sensors_cr_unbind(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
 		Scan(&result).Error
 
 	return
 }
 
 func (PGHr) UnBindSensorsQuery(optUserId int64, objectShopId int64, jsonStr string, verfStr string) (result string, err error) {
-	err = getClient().Raw("select fn_unbind_sensors_query(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
+	err = getClient().Raw("select fn_hr_sensors_unbind_sensors_query(? ,? ,? )", optUserId, objectShopId, jsonStr, verfStr).
 		Scan(&result).Error
 
 	return

+ 9 - 0
proto/server/base.proto

@@ -44,6 +44,7 @@ service Api {
   rpc ShopLicenseList (ShopDetailRequest) returns (LicenseList) {}
   rpc ShopLicenseTypeMap (IdList) returns (LicenseTypeMapReply)  {}
   rpc GetShopNavi (GetShopNaviRequest) returns (GetShopNaviReply) {}
+  rpc GetShopNaviAll (GetShopNaviAllRequest) returns (GetShopNaviAllReply) {}
   rpc ShopGroupQuery (StandardRequest) returns (StandardReply) {}
   rpc ShopGroupAdd (StandardRequest) returns (StandardReply) {}
   rpc ShopGroupEdit (StandardRequest) returns (StandardReply) {}
@@ -261,6 +262,10 @@ message GetShopNaviRequest{
   int64 parentId = 2;
 }
 
+message GetShopNaviAllRequest{
+  int64 shopId = 1;
+}
+
 message Column{
   string name = 1;
   string url = 2;
@@ -276,6 +281,10 @@ message GetShopNaviReply{
   repeated Column list = 1;
 }
 
+message GetShopNaviAllReply{
+  string ColumnRs = 1;
+}
+
 message GetOverlayImgRequest{
   string fileName = 1;
 }

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff