From 9b4b82cb839ea29518036f0e2dacde15c8f69f51 Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Mon, 4 Dec 2023 12:26:57 +0800 Subject: [PATCH 01/29] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 0e2dca3..8153624 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ #### 介绍 公共协议, 每个服务需要git submodule 拉 xxx/proto 目录下. 然后使用序列. +``` +安装protoc protoc-25.0-linux-x86_64.zip +``` + ```bash git submodule add https://gitee.com/fusenpack/proto ``` @@ -15,6 +19,8 @@ go run proto/goutils/proto_build/main.go ./update_fspkg_master.sh # 执行更新最新的包 ``` + + #### 软件架构 软件架构说明 From 0e721f4bd6d6b88163a657f476c94d767ab11566 Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Mon, 4 Dec 2023 14:19:43 +0800 Subject: [PATCH 02/29] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 8153624..dc628d4 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ ``` ```bash +# 去掉SUMDB的验证 +go env -w GOSUMDB="off" + git submodule add https://gitee.com/fusenpack/proto ``` 然后执行 From 572b6e198a41de03d1ed7a31a21affcabab6e2f7 Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Mon, 4 Dec 2023 14:20:43 +0800 Subject: [PATCH 03/29] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E5=86=85=E9=83=A8gitlab=E7=9A=84=E6=A8=A1=E5=9D=97=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc628d4..98c8eaf 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ # 去掉SUMDB的验证 go env -w GOSUMDB="off" -git submodule add https://gitee.com/fusenpack/proto +git submodule add git@gitlab.fusenpack.com:backend/proto.git ``` 然后执行 ```bash From 624b492db1215bbc59fd13c37254c32b4e3b5b85 Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Mon, 4 Dec 2023 14:56:42 +0800 Subject: [PATCH 04/29] update --- service/fsservice.proto | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index 13e0442..3fbbab3 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -1,17 +1,26 @@ syntax = "proto3"; //版本声明,使用v3版本 package fsservice; -option go_package = "gitlab.fusenpack.com/backend/service;service"; - +option go_package = "gitee.com/fusenpack/fusen-service;service"; + // 导入google/api/annotations.proto 注释依赖 import "google/api/annotations.proto"; import "service/basic.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/any.proto"; +//定义服务 +service notify { + rpc Hello(basic.Request) returns (basic.Response) { + option (google.api.http) = { + post: "/api/notify/hello" + body: "*" + }; + } +} //定义服务 -service info { +service info { // 用户信息 rpc UserInfo(UserInfoRequest) returns (basic.Response) { option (google.api.http) = { @@ -124,6 +133,15 @@ service info { } +//定义产品服务 +service product { + // 产品详情 + rpc GetProductDetail(GetProductDetailReq) returns (GetProductDetailRsp) { + option (google.api.http) = { + get: "/api/product/get_product_detail" + }; + } +} message UserInfoRequest { repeated string module = 1; // 模块 @@ -134,7 +152,7 @@ message QueryProfileRequest { } message QueryProfileResponse { - google.protobuf.Struct data = 1; + google.protobuf.Struct data = 1; } message DefaultProfileRequest { @@ -213,4 +231,14 @@ message ContactUsRequest { string message = 4; // 消息内容 } +message GetProductDetailReq{ + int64 product_id = 1; + string template_tag = 2; + int64 selected_color_index = 3; + optional string logo = 4; +} +message GetProductDetailRsp{ + string msg = 1; +} + From 748e0daffcafe5e1eab3cd7d1ebb9a20e9a3249b Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Mon, 4 Dec 2023 15:10:18 +0800 Subject: [PATCH 05/29] update --- service/fsservice.proto | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index 3fbbab3..d6546a4 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -9,16 +9,6 @@ import "service/basic.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/any.proto"; -//定义服务 -service notify { - rpc Hello(basic.Request) returns (basic.Response) { - option (google.api.http) = { - post: "/api/notify/hello" - body: "*" - }; - } -} - //定义服务 service info { // 用户信息 From 1879f71f768b699759a39d47efb4be2b067ce9d1 Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Mon, 4 Dec 2023 16:00:09 +0800 Subject: [PATCH 06/29] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++++ service/fsservice.proto | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 98c8eaf..95ffd3c 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ git submodule add git@gitlab.fusenpack.com:backend/proto.git ``` 然后执行 ```bash +go install \ +github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \ +github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \ +google.golang.org/protobuf/cmd/protoc-gen-go \ +google.golang.org/grpc/cmd/protoc-gen-go-grpc + go run proto/goutils/proto_build/main.go 或者 在proto/goutils/proto_build/main_test.go执行测试 TestMain diff --git a/service/fsservice.proto b/service/fsservice.proto index d6546a4..8eb37e6 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -128,7 +128,7 @@ service product { // 产品详情 rpc GetProductDetail(GetProductDetailReq) returns (GetProductDetailRsp) { option (google.api.http) = { - get: "/api/product/get_product_detail" + get: "/api/product/detail" }; } } @@ -223,9 +223,9 @@ message ContactUsRequest { message GetProductDetailReq{ int64 product_id = 1; - string template_tag = 2; - int64 selected_color_index = 3; - optional string logo = 4; + // string template_tag = 2; + // int64 selected_color_index = 3; + // string logo = 4; } message GetProductDetailRsp{ string msg = 1; From 0eafcfd3e268a4077a6ab9230d26534f4e9ac0a9 Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Mon, 4 Dec 2023 16:26:44 +0800 Subject: [PATCH 07/29] update --- service/fsservice.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index 8eb37e6..bdd228f 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -223,9 +223,9 @@ message ContactUsRequest { message GetProductDetailReq{ int64 product_id = 1; - // string template_tag = 2; - // int64 selected_color_index = 3; - // string logo = 4; + string template_tag = 2; + int64 selected_color_index = 3; + string logo = 4; } message GetProductDetailRsp{ string msg = 1; From 75f76f7be5686f70917c3f5293b074b26d390517 Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Mon, 4 Dec 2023 16:45:41 +0800 Subject: [PATCH 08/29] fix --- service/fsservice.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/service/fsservice.proto b/service/fsservice.proto index bdd228f..0d1258d 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -229,6 +229,7 @@ message GetProductDetailReq{ } message GetProductDetailRsp{ string msg = 1; + string name = 2; } From 4cfab40419f0725192c188eb74f0cce023f48692 Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Mon, 4 Dec 2023 17:15:41 +0800 Subject: [PATCH 09/29] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- goutils/proto_build/main.go | 34 +++++++++++++++++++++++++++ goutils/proto_build/tpls/main.tpl | 5 ++-- goutils/proto_build/tpls/main_gen.tpl | 15 ++++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 goutils/proto_build/tpls/main_gen.tpl diff --git a/goutils/proto_build/main.go b/goutils/proto_build/main.go index a5d52fd..86f87fb 100644 --- a/goutils/proto_build/main.go +++ b/goutils/proto_build/main.go @@ -267,6 +267,12 @@ func ExecCreateAutoLogic(workerSpaceDir string, ServiceName string, genDir, pack // 处理main.go文件 defer func() { // name := underscoreToLowerCamelCase(ServiceName) + + // name := underscoreToLowerCamelCase(ServiceName) + createFile("server/main_gen.go", func(f io.Writer) error { + return tpl.ExecuteTemplate(f, "main_gen.tpl", mtpl) + }) + createFileWithPermNotExists("server/main.go", func(f io.Writer) error { return tpl.ExecuteTemplate(f, "main.tpl", mtpl) }) @@ -1246,6 +1252,34 @@ func _getTypeString(expr ast.Expr, packageName *string, level int) string { } } +func createFile(filename string, do func(f io.Writer) error) error { + // 检测文件是否存在 + + file, err := os.OpenFile(filename, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644) + if err != nil { + return err + } + defer file.Close() + + var buf = bytes.NewBuffer(nil) + err = do(buf) + if err != nil { + panic(err) + } + data, err := format.Source(buf.Bytes()) + if err != nil { + _, err = file.Write(buf.Bytes()) + } else { + _, err = file.Write(data) + } + + if err != nil { + panic(err) + } + + return nil +} + func createFileWithPermNotExists(filename string, do func(f io.Writer) error) error { // 检测文件是否存在 _, err := os.Stat(filename) diff --git a/goutils/proto_build/tpls/main.tpl b/goutils/proto_build/tpls/main.tpl index 4d41cf4..e97338e 100644 --- a/goutils/proto_build/tpls/main.tpl +++ b/goutils/proto_build/tpls/main.tpl @@ -30,9 +30,8 @@ func main() { log.Fatalf("failed to listen: %v", err) } s := grpc.NewServer(sopt) //新建一个grpc服务 - {{range .StructServiceNames}} - service.Register{{.StructServiceName}}Server(s, &{{.LogicPackageName}}.{{.StructServiceName}}LogicGrpc{}) // {{.LogicPackageName}} 服务注册 - {{- end}} + + MainRegisterServer(s) // 注册所有的service if err := s.Serve(lis); err != nil { log.Fatalf("failed to serve: %v", err) diff --git a/goutils/proto_build/tpls/main_gen.tpl b/goutils/proto_build/tpls/main_gen.tpl new file mode 100644 index 0000000..4809b22 --- /dev/null +++ b/goutils/proto_build/tpls/main_gen.tpl @@ -0,0 +1,15 @@ +package main + +import ( + "{{.ProjectName}}/gen/go/service" + "{{.ProjectName}}/server/logics/info_logic" + "{{.ProjectName}}/server/logics/product_logic" + + "google.golang.org/grpc" +) + +func MainRegisterServer(s *grpc.Server) { + {{range .StructServiceNames}} + service.Register{{.StructServiceName}}Server(s, &{{.LogicPackageName}}.{{.StructServiceName}}LogicGrpc{}) // {{.LogicPackageName}} 服务注册 + {{- end}} +} From 78336ab41037fe89274a5ecd9aa4afed0867409c Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Mon, 4 Dec 2023 17:16:28 +0800 Subject: [PATCH 10/29] fix --- service/fsservice.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index 0d1258d..665df30 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -128,7 +128,7 @@ service product { // 产品详情 rpc GetProductDetail(GetProductDetailReq) returns (GetProductDetailRsp) { option (google.api.http) = { - get: "/api/product/detail" + get: "/api/product/get_product_detail" }; } } From 066595618a6260d5a1677d82515d38f5420b2379 Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Mon, 4 Dec 2023 18:20:02 +0800 Subject: [PATCH 11/29] fix --- service/fsservice.proto | 56 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index 665df30..301e302 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -221,15 +221,65 @@ message ContactUsRequest { string message = 4; // 消息内容 } +//获取产品详情 message GetProductDetailReq{ int64 product_id = 1; string template_tag = 2; int64 selected_color_index = 3; string logo = 4; } -message GetProductDetailRsp{ - string msg = 1; - string name = 2; +message GetProductDetailRsp { + string logo = 1; //logo + TemplateTagColorInfo template_tag_color_info = 2; //标签颜色信息 + ProductInfo product_info = 3; //产品基本信息 + google.protobuf.Struct base_colors = 4; //一些返回写死的颜色 + repeated SizeInfo size_list = 5; //尺寸相关信息 } +message SizeInfo { + int64 id =1; //尺寸id + int64 is_default = 2; //是否默认显示 + google.protobuf.Struct title = 3; //尺寸标题信息 + string capacity = 4; //尺寸名称 + int64 parts_can_deleted = 5; //配件是否可删除 + int64 is_hot = 6; //是否热门 + string min_price = 7; //最低价 + google.protobuf.Struct template_info = 8; //模板相关信息 + ModelInfo model_info = 9; //模型相关信息 + repeated FittingInfo fitting_list = 10; //配件相关信息 +} +message FittingInfo { + int64 id = 1; //配件id + int64 is_hot = 2; //是否热门 + string material_image = 3;//配件材质图 + google.protobuf.Struct design_info = 4; //配件设计信息 + string price = 5; //配件价格 + string name = 6; //配件名 + int64 is_default = 7; //是否默认的配件 +} +message ModelInfo { + int64 id = 1; //模型id + google.protobuf.Struct design_info = 2; //模型设计信息 + LightInfo light_info = 3; //灯光信息 +} +message LightInfo { + int64 id = 1; //灯光id + google.protobuf.Struct light_design_info = 2; //灯光设计信息 +} +message ProductInfo { + int64 id = 1; //产品id + string description = 2; //产品描述 + int64 product_type = 3; //产品类型id + string product_type_name = 4;//产品类型名称 + string title = 5; //产品标题 + int64 is_env = 6; //是否环保 + int64 is_micro = 7; //是否可微波炉 + int64 is_customization = 8; //是否可定制产品 + google.protobuf.Struct website_unit = 9; //产品前台网站单位 +} +message TemplateTagColorInfo { + google.protobuf.Struct colors = 1; //传入logo对应的算法颜色组 + int64 selected_color_index = 2; //选择的模板标签的颜色索引值 + google.protobuf.Struct template_tag_groups = 3; //模板标签分组信息 +} From 99d37a5ef23ae8fb0b95aea7896f36c5775ac3a5 Mon Sep 17 00:00:00 2001 From: "menghaiwen@fusen.cn" Date: Mon, 4 Dec 2023 18:21:07 +0800 Subject: [PATCH 12/29] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9C=8D=E5=8A=A1:reso?= =?UTF-8?q?urce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/resource.proto | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 service/resource.proto diff --git a/service/resource.proto b/service/resource.proto new file mode 100644 index 0000000..9ab70bd --- /dev/null +++ b/service/resource.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; //版本声明,使用v3版本 + +package resource; +option go_package = "gitlab.fusenpack.com/backend/resource;service"; + +// 导入google/api/annotations.proto 注释依赖 +import "google/api/annotations.proto"; +import "service/basic.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/any.proto"; + +//定义服务 +service resource { + + // 获取资源详情 + rpc GetResourceInfo(GetResourceInfoReq) returns (GetResourceInfoRes) { + option (google.api.http) = { + get: "/api/resource/info" + }; + } +} + +/* 获取资源详情 */ +message GetResourceInfoReq{ + optional string resource_id = 1; + optional int64 guest_id =2; + optional int64 user_id =3; + optional string resource_type = 4; + optional string resource_url = 5; + optional string version = 6; + optional int64 api_type = 7; + optional string bucket_name = 8; + optional string source = 9; +} +message GetResourceInfoRes { + string resource_id = 1; + int64 guest_id =2; + int64 user_id =3; + string resource_type = 4; + string resource_url = 5; + string version = 6; + int64 api_type = 7; + string bucket_name = 8; + string source = 9; + string uploaded_at = 10; + google.protobuf.Struct metadata = 11; +} +/* 获取资源详情 */ \ No newline at end of file From cd93fa05f71c4d88c52f76d12ff3fb3b0e204bd5 Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Tue, 5 Dec 2023 10:41:26 +0800 Subject: [PATCH 13/29] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- goutils/proto_build/tpls/main_gen.tpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/goutils/proto_build/tpls/main_gen.tpl b/goutils/proto_build/tpls/main_gen.tpl index 4809b22..02f5bf4 100644 --- a/goutils/proto_build/tpls/main_gen.tpl +++ b/goutils/proto_build/tpls/main_gen.tpl @@ -2,8 +2,9 @@ package main import ( "{{.ProjectName}}/gen/go/service" - "{{.ProjectName}}/server/logics/info_logic" - "{{.ProjectName}}/server/logics/product_logic" + {{range .StructServiceNames}} + "{{$.ProjectName}}/server/logics/{{.LogicPackageName}}" + {{- end}} "google.golang.org/grpc" ) From 6074bb8e44d0757165e51b7e74f5149893631d0a Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Tue, 5 Dec 2023 13:05:23 +0800 Subject: [PATCH 14/29] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dresponse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/basic.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/basic.proto b/service/basic.proto index 28c99eb..5a944da 100644 --- a/service/basic.proto +++ b/service/basic.proto @@ -13,7 +13,7 @@ message Request { // golang使用一个map返回, 使用这个response message Response { - google.protobuf.Value data=1; + bytes data=1; } From a530630f389e4412a5cb3e4fd411cf278070da7f Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Tue, 5 Dec 2023 14:30:49 +0800 Subject: [PATCH 15/29] fix --- .idea/.gitignore | 0 .idea/modules.xml | 8 ++++++++ .idea/proto.iml | 9 +++++++++ .idea/vcs.xml | 6 ++++++ .idea/workspace.xml | 31 +++++++++++++++++++++++++++++++ service/fsservice.proto | 2 +- 6 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/modules.xml create mode 100644 .idea/proto.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7b71657 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/proto.iml b/.idea/proto.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/proto.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..e03dad9 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/service/fsservice.proto b/service/fsservice.proto index 301e302..67d2ba5 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -232,7 +232,7 @@ message GetProductDetailRsp { string logo = 1; //logo TemplateTagColorInfo template_tag_color_info = 2; //标签颜色信息 ProductInfo product_info = 3; //产品基本信息 - google.protobuf.Struct base_colors = 4; //一些返回写死的颜色 + repeated google.protobuf.ListValue base_colors = 4; //一些返回写死的颜色 repeated SizeInfo size_list = 5; //尺寸相关信息 } From 47191d5c25c6acdb162578cc8d7bbd2e275d2676 Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Tue, 5 Dec 2023 14:39:15 +0800 Subject: [PATCH 16/29] fix --- service/fsservice.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index 67d2ba5..f61860f 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -232,7 +232,7 @@ message GetProductDetailRsp { string logo = 1; //logo TemplateTagColorInfo template_tag_color_info = 2; //标签颜色信息 ProductInfo product_info = 3; //产品基本信息 - repeated google.protobuf.ListValue base_colors = 4; //一些返回写死的颜色 + google.protobuf.ListValue base_colors = 4; //一些返回写死的颜色 repeated SizeInfo size_list = 5; //尺寸相关信息 } From b1eb47103b8fb43ee639bd53dc0cd0d3c330f417 Mon Sep 17 00:00:00 2001 From: "menghaiwen@fusen.cn" Date: Tue, 5 Dec 2023 14:46:45 +0800 Subject: [PATCH 17/29] fix --- service/resource.proto | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/service/resource.proto b/service/resource.proto index 9ab70bd..3fae88e 100644 --- a/service/resource.proto +++ b/service/resource.proto @@ -13,7 +13,7 @@ import "google/protobuf/any.proto"; service resource { // 获取资源详情 - rpc GetResourceInfo(GetResourceInfoReq) returns (GetResourceInfoRes) { + rpc GetResourceInfo(GetResourceInfoReq) returns (basic.Response) { option (google.api.http) = { get: "/api/resource/info" }; @@ -43,6 +43,7 @@ message GetResourceInfoRes { string bucket_name = 8; string source = 9; string uploaded_at = 10; - google.protobuf.Struct metadata = 11; + // google.protobuf.Struct metadata = 11; + google.protobuf.Any metadata =11; } /* 获取资源详情 */ \ No newline at end of file From eea47ad72c1c13bc7fea650eea9ab0c773b5169f Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Tue, 5 Dec 2023 15:02:13 +0800 Subject: [PATCH 18/29] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/basic.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/basic.proto b/service/basic.proto index 5a944da..28c99eb 100644 --- a/service/basic.proto +++ b/service/basic.proto @@ -13,7 +13,7 @@ message Request { // golang使用一个map返回, 使用这个response message Response { - bytes data=1; + google.protobuf.Value data=1; } From 2695460f82dd400ec3884670f35d88df24e41cb6 Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Tue, 5 Dec 2023 15:04:25 +0800 Subject: [PATCH 19/29] update --- service/fsservice.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index f61860f..23e90f1 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -278,7 +278,7 @@ message ProductInfo { google.protobuf.Struct website_unit = 9; //产品前台网站单位 } message TemplateTagColorInfo { - google.protobuf.Struct colors = 1; //传入logo对应的算法颜色组 + google.protobuf.ListValue colors = 1; //传入logo对应的算法颜色组 int64 selected_color_index = 2; //选择的模板标签的颜色索引值 google.protobuf.Struct template_tag_groups = 3; //模板标签分组信息 } From a6f87e75b8243b8df670083cd15fc4b8727ae188 Mon Sep 17 00:00:00 2001 From: "menghaiwen@fusen.cn" Date: Tue, 5 Dec 2023 15:20:02 +0800 Subject: [PATCH 20/29] update --- service/resource.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/resource.proto b/service/resource.proto index 3fae88e..5526e2b 100644 --- a/service/resource.proto +++ b/service/resource.proto @@ -13,7 +13,7 @@ import "google/protobuf/any.proto"; service resource { // 获取资源详情 - rpc GetResourceInfo(GetResourceInfoReq) returns (basic.Response) { + rpc GetResourceInfo(GetResourceInfoReq) returns (GetResourceInfoRes) { option (google.api.http) = { get: "/api/resource/info" }; From 2c936c6536451094987ff53639dee0b4b990d5fe Mon Sep 17 00:00:00 2001 From: "menghaiwen@fusen.cn" Date: Tue, 5 Dec 2023 15:40:46 +0800 Subject: [PATCH 21/29] =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/resource.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/resource.proto b/service/resource.proto index 5526e2b..35ea3aa 100644 --- a/service/resource.proto +++ b/service/resource.proto @@ -13,7 +13,7 @@ import "google/protobuf/any.proto"; service resource { // 获取资源详情 - rpc GetResourceInfo(GetResourceInfoReq) returns (GetResourceInfoRes) { + rpc GetResourceInfo(GetResourceInfoReq) returns (basic.Response) { option (google.api.http) = { get: "/api/resource/info" }; @@ -43,7 +43,7 @@ message GetResourceInfoRes { string bucket_name = 8; string source = 9; string uploaded_at = 10; - // google.protobuf.Struct metadata = 11; - google.protobuf.Any metadata =11; + google.protobuf.Struct metadata = 11; + // google.protobuf.Any metadata =11; } /* 获取资源详情 */ \ No newline at end of file From c467d31915254ecc59196c85b14f86f3a5c2d1c8 Mon Sep 17 00:00:00 2001 From: "menghaiwen@fusen.cn" Date: Tue, 5 Dec 2023 16:12:13 +0800 Subject: [PATCH 22/29] =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/resource.proto | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/service/resource.proto b/service/resource.proto index 35ea3aa..3a2f9ee 100644 --- a/service/resource.proto +++ b/service/resource.proto @@ -18,7 +18,30 @@ service resource { get: "/api/resource/info" }; } + + // 获取资源列表 + rpc GetResourceList(GetResourceListReq) returns (basic.Response) { + option (google.api.http) = { + get: "/api/resource/list" + }; + } } +/* 获取资源列表 */ +message GetResourceList{ + optional string resource_id = 1; + optional int64 guest_id =2; + optional int64 user_id =3; + optional string resource_type = 4; + optional string resource_url = 5; + optional string version = 6; + optional int64 api_type = 7; + optional string bucket_name = 8; + optional string source = 9; + + optional int64 current_page =100; + optional int64 per_page =200; +} +/* 获取资源列表 */ /* 获取资源详情 */ message GetResourceInfoReq{ @@ -32,18 +55,4 @@ message GetResourceInfoReq{ optional string bucket_name = 8; optional string source = 9; } -message GetResourceInfoRes { - string resource_id = 1; - int64 guest_id =2; - int64 user_id =3; - string resource_type = 4; - string resource_url = 5; - string version = 6; - int64 api_type = 7; - string bucket_name = 8; - string source = 9; - string uploaded_at = 10; - google.protobuf.Struct metadata = 11; - // google.protobuf.Any metadata =11; -} /* 获取资源详情 */ \ No newline at end of file From c09b26bc8b5a60f085c44c9c978c44735a8260ed Mon Sep 17 00:00:00 2001 From: "menghaiwen@fusen.cn" Date: Tue, 5 Dec 2023 16:19:54 +0800 Subject: [PATCH 23/29] =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/resource.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/resource.proto b/service/resource.proto index 3a2f9ee..8624b69 100644 --- a/service/resource.proto +++ b/service/resource.proto @@ -27,7 +27,7 @@ service resource { } } /* 获取资源列表 */ -message GetResourceList{ +message GetResourceListReq{ optional string resource_id = 1; optional int64 guest_id =2; optional int64 user_id =3; From 47cafe7c6d565ac31d9dcbf3aee81be2dfa5d1b8 Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Tue, 5 Dec 2023 16:56:48 +0800 Subject: [PATCH 24/29] update --- service/fsservice.proto | 54 +---------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index 23e90f1..8d0716b 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -229,57 +229,5 @@ message GetProductDetailReq{ string logo = 4; } message GetProductDetailRsp { - string logo = 1; //logo - TemplateTagColorInfo template_tag_color_info = 2; //标签颜色信息 - ProductInfo product_info = 3; //产品基本信息 - google.protobuf.ListValue base_colors = 4; //一些返回写死的颜色 - repeated SizeInfo size_list = 5; //尺寸相关信息 + google.protobuf.Any name = 1; } - -message SizeInfo { - int64 id =1; //尺寸id - int64 is_default = 2; //是否默认显示 - google.protobuf.Struct title = 3; //尺寸标题信息 - string capacity = 4; //尺寸名称 - int64 parts_can_deleted = 5; //配件是否可删除 - int64 is_hot = 6; //是否热门 - string min_price = 7; //最低价 - google.protobuf.Struct template_info = 8; //模板相关信息 - ModelInfo model_info = 9; //模型相关信息 - repeated FittingInfo fitting_list = 10; //配件相关信息 -} -message FittingInfo { - int64 id = 1; //配件id - int64 is_hot = 2; //是否热门 - string material_image = 3;//配件材质图 - google.protobuf.Struct design_info = 4; //配件设计信息 - string price = 5; //配件价格 - string name = 6; //配件名 - int64 is_default = 7; //是否默认的配件 -} -message ModelInfo { - int64 id = 1; //模型id - google.protobuf.Struct design_info = 2; //模型设计信息 - LightInfo light_info = 3; //灯光信息 -} -message LightInfo { - int64 id = 1; //灯光id - google.protobuf.Struct light_design_info = 2; //灯光设计信息 -} -message ProductInfo { - int64 id = 1; //产品id - string description = 2; //产品描述 - int64 product_type = 3; //产品类型id - string product_type_name = 4;//产品类型名称 - string title = 5; //产品标题 - int64 is_env = 6; //是否环保 - int64 is_micro = 7; //是否可微波炉 - int64 is_customization = 8; //是否可定制产品 - google.protobuf.Struct website_unit = 9; //产品前台网站单位 -} -message TemplateTagColorInfo { - google.protobuf.ListValue colors = 1; //传入logo对应的算法颜色组 - int64 selected_color_index = 2; //选择的模板标签的颜色索引值 - google.protobuf.Struct template_tag_groups = 3; //模板标签分组信息 -} - From 557a2331b3dcf8ca4a051ca11d49159562dc8e7a Mon Sep 17 00:00:00 2001 From: "menghaiwen@fusen.cn" Date: Tue, 5 Dec 2023 17:31:28 +0800 Subject: [PATCH 25/29] =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/resource.proto | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/service/resource.proto b/service/resource.proto index 8624b69..e65d416 100644 --- a/service/resource.proto +++ b/service/resource.proto @@ -38,8 +38,9 @@ message GetResourceListReq{ optional string bucket_name = 8; optional string source = 9; - optional int64 current_page =100; - optional int64 per_page =200; + optional int64 current_page =101; + optional int64 per_page =102; + optional string order_by = 103; } /* 获取资源列表 */ From dddd8f4a29eb3b0017cc964c436f28c5abcd16f7 Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Tue, 5 Dec 2023 17:43:04 +0800 Subject: [PATCH 26/29] update --- service/fsservice.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index 8d0716b..df299d7 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -9,6 +9,7 @@ import "service/basic.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/any.proto"; + //定义服务 service info { // 用户信息 @@ -229,5 +230,5 @@ message GetProductDetailReq{ string logo = 4; } message GetProductDetailRsp { - google.protobuf.Any name = 1; + google.protobuf.Struct name = 1; } From 30bf1bddeab89c8b394cb08178b0681864ad655e Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Tue, 5 Dec 2023 18:02:04 +0800 Subject: [PATCH 27/29] fix --- service/fsservice.proto | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index df299d7..359bf12 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -127,7 +127,7 @@ service info { //定义产品服务 service product { // 产品详情 - rpc GetProductDetail(GetProductDetailReq) returns (GetProductDetailRsp) { + rpc GetProductDetail(GetProductDetailReq) returns (basic.Response) { option (google.api.http) = { get: "/api/product/get_product_detail" }; @@ -228,7 +228,4 @@ message GetProductDetailReq{ string template_tag = 2; int64 selected_color_index = 3; string logo = 4; -} -message GetProductDetailRsp { - google.protobuf.Struct name = 1; -} +} \ No newline at end of file From 656c14c640e802be2fec19eeb8372782f1478cea Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Wed, 6 Dec 2023 10:41:27 +0800 Subject: [PATCH 28/29] update --- service/fsservice.proto | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/fsservice.proto b/service/fsservice.proto index 359bf12..4087164 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -224,8 +224,8 @@ message ContactUsRequest { //获取产品详情 message GetProductDetailReq{ - int64 product_id = 1; - string template_tag = 2; - int64 selected_color_index = 3; - string logo = 4; + int64 product_id = 1; + string template_tag = 2; + int64 selected_color_index = 3; + string logo = 4; } \ No newline at end of file From 0dc3cc97e004bf4a2f5e3079a1df1c6b416fa0cd Mon Sep 17 00:00:00 2001 From: "laodaming@fusen.cn" Date: Wed, 6 Dec 2023 11:33:49 +0800 Subject: [PATCH 29/29] update --- service/fsservice.proto | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/service/fsservice.proto b/service/fsservice.proto index 4087164..e305606 100644 --- a/service/fsservice.proto +++ b/service/fsservice.proto @@ -132,6 +132,12 @@ service product { get: "/api/product/get_product_detail" }; } + //获取产品列表 + rpc GetProductList(GetProductListReq) returns (basic.Response) { + option (google.api.http) = { + get: "/api/product/tag_product_list" + }; + } } message UserInfoRequest { @@ -228,4 +234,11 @@ message GetProductDetailReq{ string template_tag = 2; int64 selected_color_index = 3; string logo = 4; +} +//获取产品列表 +message GetProductListReq{ + int64 basic_tag_id = 1; //传入则以该分类为最高层分类查询 + int64 merchant_type = 2; //商户类型 + string template_tag = 3; //模板标签 + bool with_product = 4; //是否携带分类下的产品 } \ No newline at end of file