Browse Source

proto3: 解决int64 jsonpb 后转成string问题

Yi 1 year ago
parent
commit
0c9882485f

+ 3 - 0
README.md

@@ -30,3 +30,6 @@ lint:
 需要更新 gomock:
 - 生成 mock 前,请确保你能够编译 & 编译完成
 - make generate
+
+TODO 列表
+- proto3 int64 jsonpb处理后自动转成string,目前是把int64类型改成uint32或者int32类型

+ 3 - 4
backend/operation/mobile.proto

@@ -11,7 +11,7 @@ message SearchMobileRequest {
 }
 
 message SearchMobileResponse {
-  int64 code = 1;
+  int32 code = 1;
   string msg = 2;
   SearchMobileData data = 3;
 }
@@ -23,11 +23,10 @@ message SearchMobileData {
   repeated  MobileData list = 4;
 }
 
-
 message MobileData {
-  int64  id = 1;
+  uint32 id = 1;
   string name = 2;
-  int64 created_at = 3;
+  uint32 created_at = 3;
   string created_at_format = 4;
 }
 

+ 67 - 28
backend/operation/pasture.proto

@@ -7,14 +7,14 @@ import "backend/operation/enum.proto";
 import "backend/operation/pagination.proto";
 
 message AddPastureRequest {
-  int64 id = 1;
+  uint32 id = 1;
   string name = 2; // 牧场名称
   string account = 3;   // 登录账号名称
   string manager_user = 4; // 牧场负责人名称
   string manager_phone = 5;   // 牧场负责人手机号
   string address = 6;   // 牧场地址
   IsShow.Kind is_show = 7;    // 是否启用
-  int64 created_at = 8;    // 创建时间
+  uint32 created_at = 8;    // 创建时间
   string created_at_format = 9;    // 创建时间格式化
 }
 
@@ -22,13 +22,13 @@ message SearchPastureRequest {
   string name = 1;       // 牧场名称
   string manager_user = 2; // 牧场负责人名称
   string manager_phone = 3;   // 牧场负责人手机号
-  int64 start_time = 4;       // 开始时间
-  int64 end_time = 5;    // 结束时间
+  uint32 start_time = 4;       // 开始时间
+  uint32 end_time = 5;    // 结束时间
   PaginationModel pagination = 6; // 分页
 }
 
 message SearchPastureResponse {
-  int64 code = 1;
+  int32 code = 1;
   string msg = 2;
   SearchPastureData data = 3;
 }
@@ -41,30 +41,30 @@ message SearchPastureData {
 
 // 重置牧场登录密码
 message RestPasswordGroupPasture {
-  int64 pasture_id = 1;    // 牧场id
+  uint32 pasture_id = 1;    // 牧场id
   string password = 2;     // 密码(md5加密过的)
 }
 
 message IsShowGroupPasture {
-  int64 pasture_id = 1;    // 牧场id
+  uint32 pasture_id = 1;    // 牧场id
   IsShow.Kind is_show = 2;     // 是否开启
 }
 
 // 添加牧畜分类
 message AddCattleCategoryRequest {
-  int64 id = 1;
+  uint32 id = 1;
   CattleCategoryParent.Kind parent_id = 2;  // 父类id
   string parent_name = 3;        // 父类名称
   string name = 4;               // 牧畜分类名称
   string number = 5;            // 畜牧类别编号
   IsShow.Kind is_show = 6;      // 是否启用
-  int64 created_at = 7;         // 创建时间
+  uint32 created_at = 7;         // 创建时间
   string created_at_format = 8;   // 创建时间格式
 }
 
 // 是否启用
 message IsShowCattleCategory {
-  int64 cattle_category_id = 1;
+  uint32 cattle_category_id = 1;
   IsShow.Kind is_show = 2;
 }
 
@@ -77,7 +77,7 @@ message SearchCattleCategoryRequest {
 }
 
 message SearchCattleCategoryResponse {
-  int64 code = 1;
+  int32 code = 1;
   string msg = 2;
   SearchCattleCategoryData data = 3;
 }
@@ -90,19 +90,19 @@ message SearchCattleCategoryData {
 
 // 添加饲料分类
 message AddForageCategoryRequest {
-  int64 id = 1;
+  uint32 id = 1;
   ForageCategoryParent.Kind parent_id = 2;  // 父类id
   string parent_name = 3;        // 父类名称
   string name = 4;               // 牧畜分类名称
   string number = 5;            // 畜牧类别编号
   IsShow.Kind is_show = 6;      // 是否启用
-  int64 created_at = 7;         // 创建时间
+  uint32 created_at = 7;         // 创建时间
   string created_at_format = 8;   // 创建时间格式
 }
 
 // 是否启用
 message IsShowForageCategory {
-  int64 forage_category_id = 1;
+  uint32 forage_category_id = 1;
   IsShow.Kind is_show = 2;
 }
 
@@ -115,7 +115,7 @@ message SearchForageCategoryRequest {
 }
 
 message SearchForageCategoryResponse {
-  int64 code = 1;
+  int32 code = 1;
   string msg = 2;
     SearchForageCategoryData data = 3;
 }
@@ -128,27 +128,27 @@ message SearchForageCategoryData {
 
 // 饲料列表
 message AddForageRequest {
-  int64 id = 1;
+  uint32 id = 1;
   string name = 2;                // 饲料名称
-  int64 category_id = 3;          // 饲料分类id
+  uint32 category_id = 3;          // 饲料分类id
   string category_name = 4;       // 饲料分类名称
-  int64 material_type = 5;        // 物料类型
+  uint32 material_type = 5;        // 物料类型
   string unique_encode = 7;       // 唯一编码
   ForageSource.Kind forage_source_id = 8;       // 饲料来源
   ForagePlanType.Kind plan_type_id = 9;       // 计划类型
   string  small_material_scale = 10;           // 小料称
-  int64 allow_error = 11;                     // 允许误差 (单位kg)
-  int64 package_weight = 12;                  // 包装重量 (单位kg)
-  int64 price = 13;                          // 单价(单位分)
-  int64 jump_weight = 14;                    // 跳转重量域(单位kg)
+  uint32 allow_error = 11;                     // 允许误差 (单位kg)
+  uint32 package_weight = 12;                  // 包装重量 (单位kg)
+  uint32 price = 13;                          // 单价(单位分)
+  uint32 jump_weight = 14;                    // 跳转重量域(单位kg)
   JumpDelaType.Kind jump_delay = 15;         // 跳转延迟
   IsShow.Kind confirm_start = 16;            // 确认开始
-  int64  relay_locations = 17;               // 继电器位置
+  uint32  relay_locations = 17;               // 继电器位置
   IsShow.Kind jmp = 18;                     // 无上域
   string backup1 = 19;                      // 备用字段1
   string backup2 = 20;                      // 备用字段2
   string backup3 = 21;                      // 备用字段3
-  int64 created_at = 22;                    // 创建时间
+  uint32 created_at = 22;                    // 创建时间
   string created_at_format = 23;            // 创建时间格式化
   IsShow.Kind is_show = 24;                  // 是否启用
 }
@@ -156,10 +156,10 @@ message AddForageRequest {
 message SearchForageListRequest {
   string name = 1;   // 饲料名称
   string category_id = 2;   // 饲料分类id
-  int64 forage_source_id = 3;   // 饲料来源
+  uint32 forage_source_id = 3;   // 饲料来源
   IsShow.Kind is_show = 4;    // 是否启用
-  int64 allow_error = 5;      // 允许误差
-  int64 jump_weight = 6;      // 跳转重量域
+  uint32 allow_error = 5;      // 允许误差
+  uint32 jump_weight = 6;      // 跳转重量域
   JumpDelaType.Kind  jump_delay = 7;   // 跳转延迟
   PaginationModel pagination = 8; // 分页
 }
@@ -173,6 +173,45 @@ message SearchForageListResponse {
 
 // 是否启用
 message IsShowForage {
-  int64 forage_id = 1;
+  uint32 forage_id = 1;
   IsShow.Kind is_show = 2;
+}
+
+message ForageEnumList {
+  repeated ForageSourceEnum forage_source = 1;
+  repeated ForagePlanTypeEnum forage_plan_type = 2;
+  repeated JumpDelaTypeEnum jump_dela_type = 3;
+  repeated CattleParentCategoryEnum cattle_parent_category = 4;
+  repeated ForageParentCategoryEnum forage_parent_category = 5;
+  repeated IsShowEnum is_show = 6;
+}
+
+message ForageSourceEnum {
+  ForageSource.Kind value = 1;
+  string label = 2;
+}
+
+message ForagePlanTypeEnum {
+  ForagePlanType.Kind value = 1;
+  string label = 2;
+}
+
+message JumpDelaTypeEnum {
+  JumpDelaType.Kind value = 1;
+  string label = 2;
+}
+
+message CattleParentCategoryEnum {
+  CattleCategoryParent.Kind value = 1;
+  string label = 2;
+}
+
+message ForageParentCategoryEnum {
+  ForageCategoryParent.Kind value = 1;
+  string label = 2;
+}
+
+message IsShowEnum {
+  IsShow.Kind value = 1;
+  string label = 2;
 }

+ 36 - 24
backend/operation/system.proto

@@ -8,7 +8,7 @@ import "backend/operation/pagination.proto";
 import "backend/operation/pasture.proto";
 
 message CommonOK {
-  int64 code = 1;
+  int32 code = 1;
   string msg = 2;
   Success data = 3;
 }
@@ -19,15 +19,15 @@ message Success {
 
 // 用户角色
 message AddRoleRequest {
-  int64 id = 1;
+  uint32 id = 1;
   string name = 2;        // 角色名称
   string remarks = 3;     // 角色备注
   IsShow.Kind is_show = 4;     // 是否启用
-  repeated int64 pasture_id = 5;    // 牧场id
-  repeated int64 menu_id = 6;       // 菜单id
-  repeated int64 mobile_id = 7;     // 移动端id
+  repeated uint32 pasture_id = 5;    // 牧场id
+  repeated uint32 menu_id = 6;       // 菜单id
+  repeated uint32 mobile_id = 7;     // 移动端id
   string create_user = 8;          // 创建用户
-  int64 created_at = 9;             // 创建时间
+  uint32 created_at = 9;             // 创建时间
   string created_at_format = 10;     // 创建时间格式化
 }
 
@@ -37,6 +37,12 @@ message SearchRoleRequest {
 }
 
 message SearchRoleResponse {
+  uint32 code = 1;
+  string msg = 2;
+  SearchRoleData data = 3;
+}
+
+message SearchRoleData {
   int32 page = 1;
   int32 total = 2;
   int32 page_size = 3;
@@ -45,14 +51,20 @@ message SearchRoleResponse {
 
 // 角色对应权限列表
 message RolePermissionsList {
-  repeated int64 mobile_list = 1;    // 移动端权限id
-  repeated int64 pasture_list = 2;    // 牧场端列表
-  repeated int64 menu_list = 3;      // 后端权限列表
+  int32 code = 1;
+  string msg = 2;
+  RolePermissionsData data = 3;
+}
+
+message RolePermissionsData {
+  repeated uint32 mobile_list = 1;    // 移动端权限id
+  repeated uint32 pasture_list = 2;    // 牧场端列表
+  repeated uint32 menu_list = 3;      // 后端权限列表
 }
 
 // 用户token
 message SystemToken {
-  int64 code =  1;
+  int32 code =  1;
   string msg = 2;
   TokenData data = 3;
 }
@@ -63,7 +75,7 @@ message TokenData {
 
 // 用户登录
 message UserAuth {
-  int64 code = 1;
+  int32 code = 1;
   string msg = 2;
   UserAuthData data = 3;
 }
@@ -77,19 +89,19 @@ message UserAuthData {
 }
 
 message UserRole {
-  int64 id = 1;      // 角色id
+  uint32 id = 1;      // 角色id
   string name = 2;   // 角色名称
 }
 
 message AddSystemUser {
-  int64 id = 1;                    // 用户id
+  uint32 id = 1;                    // 用户id
   string name = 2;                 // 用户名称
   string phone = 3;                // 用户手机号
   repeated UserRole roles = 4;      // 角色
   IsShow.Kind is_show = 5;         // 是否开启
   string employee_name = 6;        // 员工姓名
   string create_user = 7;          // 创建人
-  int64 created_at = 8;            // 创建时间
+  uint32 created_at = 8;            // 创建时间
   string created_at_format = 9;      // 创建时间格式化
   string role_name = 10;            // 角色名称
 }
@@ -99,8 +111,8 @@ message SearchUserRequest {
   string name = 1;               // 用户名称
   string employee_name = 2;       // 员工姓名
   IsShow.Kind is_show = 3;        // 是否启用
-  int64 created_start_time = 4;   // 开始时间
-  int64 created_end_time = 5;     // 结束时间
+  uint32 created_start_time = 4;   // 开始时间
+  uint32 created_end_time = 5;     // 结束时间
   PaginationModel pagination = 6; // 分页
 }
 
@@ -118,15 +130,15 @@ message SearchUserData  {
 }
 
 message IsShowSystemUserRequest {
-  int64 user_id = 1;  // 用户id
+  uint32 user_id = 1;  // 用户id
   IsShow.Kind is_show = 2;   // is_show
 }
 
 // 系统菜单权限
 message AddMenuRequest {
-  int64 id = 1;
+  uint32 id = 1;
   string name = 2;           // 名称
-  int64 parent_id = 3;       // 父id
+  uint32 parent_id = 3;       // 父id
   int32 menu_type = 4;       // 菜单类型 1 菜单 2 按钮
   string title = 5;          // 标题
   string path = 6;           // 路径 path
@@ -135,7 +147,7 @@ message AddMenuRequest {
   string icon = 9;           // 图标
   int32 sort = 10;           // 排序
   string redirect = 11;      // 重定向
-  int64 created_at = 12;     // 创建时间
+  uint32 created_at = 12;     // 创建时间
   string created_at_format = 13;      // 创建时间格式化
   int32 level = 14;                   // 菜单等级
   repeated AddMenuRequest children = 15;   // 子分类
@@ -144,7 +156,7 @@ message AddMenuRequest {
 }
 
 message IsShowSystemMenuRequest {
-  int64 menu_id = 1;  // 角色id
+  uint32 menu_id = 1;  // 角色id
   IsShow.Kind is_show = 2;   // is_show
 }
 
@@ -155,7 +167,7 @@ message SearchMenuRequest {
 }
 
 message SearchMenuResponse {
-  int64 code = 1;
+  int32 code = 1;
   string msg = 2;
   SearchMenuData data = 3;
 }
@@ -168,7 +180,7 @@ message SearchMenuData {
 
 // 系统用户权限相关
 message SystemUserMenuPermissions {
-  int64 code = 1;
+  int32 code = 1;
   string msg = 2;
   SystemUserMenuData data = 3;
 }
@@ -181,6 +193,6 @@ message SystemUserMenuData {
 
 // 移动端
 message AddMobileRequest {
-  int64 id = 1;     // id
+  uint32 id = 1;     // id
   string name = 2;  // 名称
 }

+ 1 - 10
go.mod

@@ -30,8 +30,6 @@ require (
 	github.com/xuri/excelize/v2 v2.7.1
 	go.uber.org/dig v1.15.0
 	go.uber.org/zap v1.21.0
-	golang.org/x/oauth2 v0.5.0
-	google.golang.org/api v0.107.0
 	google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef
 	google.golang.org/grpc v1.52.0
 	google.golang.org/protobuf v1.30.0
@@ -40,8 +38,6 @@ require (
 )
 
 require (
-	cloud.google.com/go/compute v1.14.0 // indirect
-	cloud.google.com/go/compute/metadata v0.2.3 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/bytedance/sonic v1.8.0 // indirect
 	github.com/cespare/xxhash/v2 v2.2.0 // indirect
@@ -54,10 +50,7 @@ require (
 	github.com/go-playground/validator/v10 v10.11.2 // indirect
 	github.com/go-sql-driver/mysql v1.7.0 // indirect
 	github.com/goccy/go-json v0.10.0 // indirect
-	github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
 	github.com/google/uuid v1.3.0 // indirect
-	github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
-	github.com/googleapis/gax-go/v2 v2.7.0 // indirect
 	github.com/hashicorp/hcl v1.0.0 // indirect
 	github.com/inconshreveable/mousetrap v1.1.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
@@ -75,7 +68,7 @@ require (
 	github.com/pelletier/go-toml/v2 v2.0.6 // indirect
 	github.com/pkg/errors v0.9.1 // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
-	github.com/prometheus/client_golang v1.15.1 // indirect
+	github.com/prometheus/client_golang v1.14.0 // indirect
 	github.com/prometheus/client_model v0.3.0 // indirect
 	github.com/prometheus/common v0.42.0 // indirect
 	github.com/prometheus/procfs v0.9.0 // indirect
@@ -90,7 +83,6 @@ require (
 	github.com/ugorji/go/codec v1.2.9 // indirect
 	github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect
 	github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect
-	go.opencensus.io v0.24.0 // indirect
 	go.uber.org/atomic v1.9.0 // indirect
 	go.uber.org/multierr v1.8.0 // indirect
 	golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
@@ -98,7 +90,6 @@ require (
 	golang.org/x/net v0.9.0 // indirect
 	golang.org/x/sys v0.7.0 // indirect
 	golang.org/x/text v0.9.0 // indirect
-	google.golang.org/appengine v1.6.7 // indirect
 	gopkg.in/ini.v1 v1.67.0 // indirect
 	gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect

+ 3 - 24
go.sum

@@ -17,20 +17,14 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb
 cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
 cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
 cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=
-cloud.google.com/go v0.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y=
 cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
 cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
 cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
 cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
 cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
 cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
-cloud.google.com/go/compute v1.14.0 h1:hfm2+FfxVmnRlh6LpB7cg1ZNU+5edAHmW679JePztk0=
-cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo=
-cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
-cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
 cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
 cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
-cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs=
 cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
 cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
 cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
@@ -129,8 +123,6 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
 github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
-github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
-github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
 github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
 github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
@@ -165,7 +157,6 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
 github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
@@ -188,12 +179,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
 github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/googleapis/enterprise-certificate-proxy v0.2.1 h1:RY7tHKZcRlk788d5WSo/e83gOyyy742E8GSs771ySpg=
-github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k=
 github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
 github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
-github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ=
-github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8=
 github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8=
@@ -231,8 +218,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
 github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
 github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
 github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
-github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -282,8 +269,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
 github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
-github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
+github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
+github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
 github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
 github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
 github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
@@ -357,8 +344,6 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
 go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
 go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
 go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
-go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
-go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
 go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
 go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
 go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
@@ -454,7 +439,6 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R
 golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
 golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
 golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
-golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
 golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
 golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
@@ -472,8 +456,6 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ
 golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
 golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
 golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
-golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s=
-golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I=
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -631,15 +613,12 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513
 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
 google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
 google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
-google.golang.org/api v0.107.0 h1:I2SlFjD8ZWabaIFOfeEDg3pf0BHJDh6iYQ1ic3Yu/UU=
-google.golang.org/api v0.107.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY=
 google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
 google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
 google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
 google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
-google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
 google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
 google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=

+ 21 - 10
http/handler/system/role.go

@@ -3,7 +3,7 @@ package system
 import (
 	"kpt-tmr-group/http/middleware"
 	"kpt-tmr-group/pkg/apierr"
-	"kpt-tmr-group/pkg/apiok"
+	"kpt-tmr-group/pkg/ginutil"
 	"kpt-tmr-group/pkg/valid"
 	operationPb "kpt-tmr-group/proto/go/backend/operation"
 	"net/http"
@@ -15,7 +15,7 @@ import (
 // AddSystemRole 添加角色
 func AddSystemRole(c *gin.Context) {
 	var req operationPb.AddRoleRequest
-	if err := c.BindJSON(&req); err != nil {
+	if err := ginutil.BindProto(c, &req); err != nil {
 		apierr.AbortBadRequest(c, http.StatusBadRequest, err)
 		return
 	}
@@ -34,13 +34,17 @@ func AddSystemRole(c *gin.Context) {
 		apierr.ClassifiedAbort(c, err)
 		return
 	}
-	c.JSON(http.StatusOK, apiok.CommonResponse(apiok.NewApiOk(true)))
+	ginutil.JSONResp(c, &operationPb.CommonOK{
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: &operationPb.Success{Success: true},
+	})
 }
 
 // EditSystemRole 编辑角色
 func EditSystemRole(c *gin.Context) {
 	var req operationPb.AddRoleRequest
-	if err := c.BindJSON(&req); err != nil {
+	if err := ginutil.BindProto(c, &req); err != nil {
 		apierr.AbortBadRequest(c, http.StatusBadRequest, err)
 		return
 	}
@@ -59,7 +63,11 @@ func EditSystemRole(c *gin.Context) {
 		apierr.ClassifiedAbort(c, err)
 		return
 	}
-	c.JSON(http.StatusOK, apiok.CommonResponse(apiok.NewApiOk(true)))
+	ginutil.JSONResp(c, &operationPb.CommonOK{
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: &operationPb.Success{Success: true},
+	})
 }
 
 // GetRolePermissions 获取角色对应的权限
@@ -78,7 +86,7 @@ func GetRolePermissions(c *gin.Context) {
 		return
 	}
 
-	c.JSON(http.StatusOK, apiok.CommonResponse(res))
+	ginutil.JSONResp(c, res)
 }
 
 // DeleteSystemRole 删除角色
@@ -96,13 +104,17 @@ func DeleteSystemRole(c *gin.Context) {
 		return
 	}
 
-	c.JSON(http.StatusOK, apiok.CommonResponse(apiok.NewApiOk(true)))
+	ginutil.JSONResp(c, &operationPb.CommonOK{
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: &operationPb.Success{Success: true},
+	})
 }
 
 // SearchSystemRoleList 角色列表
 func SearchSystemRoleList(c *gin.Context) {
 	var req operationPb.SearchRoleRequest
-	if err := c.BindJSON(&req); err != nil {
+	if err := ginutil.BindProto(c, &req); err != nil {
 		apierr.AbortBadRequest(c, http.StatusBadRequest, err)
 		return
 	}
@@ -118,6 +130,5 @@ func SearchSystemRoleList(c *gin.Context) {
 		apierr.ClassifiedAbort(c, err)
 		return
 	}
-	c.JSON(http.StatusOK, apiok.CommonResponse(res))
-	//ginutil.JSONResp(c, res)
+	ginutil.JSONResp(c, res)
 }

+ 4 - 4
model/cattle_category.go

@@ -38,13 +38,13 @@ func (c CattleCategorySlice) ToPB() []*operationPb.AddCattleCategoryRequest {
 	res := make([]*operationPb.AddCattleCategoryRequest, len(c))
 	for i, v := range c {
 		res[i] = &operationPb.AddCattleCategoryRequest{
-			Id:              v.Id,
+			Id:              uint32(v.Id),
 			Name:            v.Name,
 			ParentId:        v.ParentId,
 			ParentName:      v.ParentName,
 			Number:          v.Number,
 			IsShow:          v.IsShow,
-			CreatedAt:       v.CreatedAt,
+			CreatedAt:       uint32(v.CreatedAt),
 			CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
 		}
 	}
@@ -53,12 +53,12 @@ func (c CattleCategorySlice) ToPB() []*operationPb.AddCattleCategoryRequest {
 
 func (c *CattleCategory) ToPb() *operationPb.AddCattleCategoryRequest {
 	return &operationPb.AddCattleCategoryRequest{
-		Id:         c.Id,
+		Id:         uint32(c.Id),
 		Name:       c.Name,
 		Number:     c.Number,
 		ParentId:   c.ParentId,
 		ParentName: c.ParentName,
 		IsShow:     c.IsShow,
-		CreatedAt:  c.CreatedAt,
+		CreatedAt:  uint32(c.CreatedAt),
 	}
 }

+ 15 - 15
model/forage.go

@@ -38,18 +38,18 @@ func (c *Forage) TableName() string {
 func NewForage(req *operationPb.AddForageRequest) *Forage {
 	return &Forage{
 		Name:               req.Name,
-		CategoryId:         req.CategoryId,
+		CategoryId:         int64(req.CategoryId),
 		UniqueEncode:       req.UniqueEncode,
 		ForageSourceId:     req.ForageSourceId,
 		PlanTypeId:         req.PlanTypeId,
 		SmallMaterialScale: req.SmallMaterialScale,
-		AllowError:         req.AllowError,
-		PackageWeight:      req.PackageWeight,
-		Price:              req.Price,
-		JumpWeight:         req.JumpWeight,
+		AllowError:         int64(req.AllowError),
+		PackageWeight:      int64(req.PackageWeight),
+		Price:              int64(req.Price),
+		JumpWeight:         int64(req.JumpWeight),
 		JumpDelay:          req.JumpDelay,
 		ConfirmStart:       req.ConfirmStart,
-		RelayLocations:     req.RelayLocations,
+		RelayLocations:     int64(req.RelayLocations),
 		IsShow:             operationPb.IsShow_OK,
 		IsDelete:           operationPb.IsShow_OK,
 		Jmp:                req.Jmp,
@@ -65,23 +65,23 @@ func (f ForageSlice) ToPB() []*operationPb.AddForageRequest {
 	res := make([]*operationPb.AddForageRequest, len(f))
 	for i, v := range f {
 		res[i] = &operationPb.AddForageRequest{
-			Id:                 v.Id,
+			Id:                 uint32(v.Id),
 			Name:               v.Name,
-			CategoryId:         v.CategoryId,
-			MaterialType:       v.MaterialType,
+			CategoryId:         uint32(v.CategoryId),
+			MaterialType:       uint32(v.MaterialType),
 			UniqueEncode:       v.UniqueEncode,
 			ForageSourceId:     v.ForageSourceId,
 			PlanTypeId:         v.PlanTypeId,
 			SmallMaterialScale: v.SmallMaterialScale,
-			AllowError:         v.AllowError,
-			PackageWeight:      v.PackageWeight,
-			Price:              v.Price,
-			JumpWeight:         v.JumpWeight,
+			AllowError:         uint32(v.AllowError),
+			PackageWeight:      uint32(v.PackageWeight),
+			Price:              uint32(v.Price),
+			JumpWeight:         uint32(v.JumpWeight),
 			JumpDelay:          v.JumpDelay,
 			ConfirmStart:       v.ConfirmStart,
-			RelayLocations:     v.RelayLocations,
+			RelayLocations:     uint32(v.RelayLocations),
 			IsShow:             v.IsShow,
-			CreatedAt:          v.CreatedAt,
+			CreatedAt:          uint32(v.CreatedAt),
 			CreatedAtFormat:    time.Unix(v.CreatedAt, 0).Format(LayoutTime),
 		}
 	}

+ 4 - 4
model/forage_category.go

@@ -38,13 +38,13 @@ func (f ForageCategorySlice) ToPB() []*operationPb.AddForageCategoryRequest {
 	res := make([]*operationPb.AddForageCategoryRequest, len(f))
 	for i, v := range f {
 		res[i] = &operationPb.AddForageCategoryRequest{
-			Id:              v.Id,
+			Id:              uint32(v.Id),
 			Name:            v.Name,
 			ParentId:        v.ParentId,
 			ParentName:      v.ParentName,
 			Number:          v.Number,
 			IsShow:          v.IsShow,
-			CreatedAt:       v.CreatedAt,
+			CreatedAt:       uint32(v.CreatedAt),
 			CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
 		}
 	}
@@ -53,12 +53,12 @@ func (f ForageCategorySlice) ToPB() []*operationPb.AddForageCategoryRequest {
 
 func (c *ForageCategory) ToPb() *operationPb.AddForageCategoryRequest {
 	return &operationPb.AddForageCategoryRequest{
-		Id:         c.Id,
+		Id:         uint32(c.Id),
 		Name:       c.Name,
 		Number:     c.Number,
 		ParentId:   c.ParentId,
 		ParentName: c.ParentName,
 		IsShow:     c.IsShow,
-		CreatedAt:  c.CreatedAt,
+		CreatedAt:  uint32(c.CreatedAt),
 	}
 }

+ 4 - 4
model/group_pasture.go

@@ -45,13 +45,13 @@ func (g GroupPastureSlice) ToPB() []*operationPb.AddPastureRequest {
 	res := make([]*operationPb.AddPastureRequest, len(g))
 	for i, v := range g {
 		res[i] = &operationPb.AddPastureRequest{
-			Id:              v.Id,
+			Id:              uint32(v.Id),
 			Name:            v.Name,
 			ManagerUser:     v.ManagerUser,
 			ManagerPhone:    v.ManagerPhone,
 			Address:         v.Address,
 			IsShow:          v.IsShow,
-			CreatedAt:       v.CreatedAt,
+			CreatedAt:       uint32(v.CreatedAt),
 			CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
 		}
 	}
@@ -60,12 +60,12 @@ func (g GroupPastureSlice) ToPB() []*operationPb.AddPastureRequest {
 
 func (g *GroupPasture) ToPb() *operationPb.AddPastureRequest {
 	return &operationPb.AddPastureRequest{
-		Id:           g.Id,
+		Id:           uint32(g.Id),
 		Name:         g.Name,
 		ManagerUser:  g.ManagerUser,
 		ManagerPhone: g.ManagerPhone,
 		Address:      g.Address,
 		IsShow:       g.IsShow,
-		CreatedAt:    g.CreatedAt,
+		CreatedAt:    uint32(g.CreatedAt),
 	}
 }

+ 2 - 2
model/system_group_pasture_permissions.go

@@ -15,12 +15,12 @@ func (s *SystemGroupPasturePermissions) TableName() string {
 	return "system_group_pasture_permissions"
 }
 
-func NewSystemGroupPasturePermissions(roleID int64, pastureIds []int64) []*SystemGroupPasturePermissions {
+func NewSystemGroupPasturePermissions(roleID int64, pastureIds []uint32) []*SystemGroupPasturePermissions {
 	systemPasturePermissions := make([]*SystemGroupPasturePermissions, len(pastureIds))
 	for i, v := range pastureIds {
 		systemPasturePermissions[i] = &SystemGroupPasturePermissions{
 			RoleId:    roleID,
-			PastureId: v,
+			PastureId: int64(v),
 			IsShow:    operationPb.IsShow_OK,
 		}
 	}

+ 18 - 17
model/system_menu.go

@@ -44,7 +44,7 @@ func NewSystemMenu(req *operationPb.AddMenuRequest) *SystemMenu {
 		Icon:      req.Icon,
 		Sort:      req.Sort,
 		Redirect:  req.Redirect,
-		ParentId:  req.ParentId,
+		ParentId:  int64(req.ParentId),
 		IsShow:    operationPb.IsShow_OK,
 		IsDelete:  operationPb.IsShow_OK,
 	}
@@ -59,9 +59,9 @@ func (s SystemMenuSlice) ToPB() []*operationPb.AddMenuRequest {
 			level[menu.Level] = make([]*operationPb.AddMenuRequest, 0)
 		}
 		level[menu.Level] = append(level[menu.Level], &operationPb.AddMenuRequest{
-			Id:              menu.Id,
+			Id:              uint32(menu.Id),
 			Name:            menu.Name,
-			ParentId:        menu.ParentId,
+			ParentId:        uint32(menu.ParentId),
 			MenuType:        menu.MenuType,
 			Title:           menu.Title,
 			Path:            menu.Path,
@@ -70,7 +70,7 @@ func (s SystemMenuSlice) ToPB() []*operationPb.AddMenuRequest {
 			Icon:            menu.Icon,
 			Sort:            menu.Sort,
 			Redirect:        menu.Redirect,
-			CreatedAt:       menu.CreatedAt,
+			CreatedAt:       uint32(menu.CreatedAt),
 			CreatedAtFormat: time.Unix(menu.CreatedAt, 0).Format(LayoutTime),
 			Level:           menu.Level,
 			Affix:           true,
@@ -106,18 +106,19 @@ func (s SystemMenuSlice) ToPB() []*operationPb.AddMenuRequest {
 
 func (s *SystemMenu) ToPb() *operationPb.AddMenuRequest {
 	return &operationPb.AddMenuRequest{
-		Id:        s.Id,
-		Name:      s.Name,
-		MenuType:  s.MenuType,
-		Level:     s.Level,
-		Title:     s.Title,
-		Path:      s.Path,
-		Component: s.Component,
-		Icon:      s.Icon,
-		Sort:      s.Sort,
-		Redirect:  s.Redirect,
-		ParentId:  s.ParentId,
-		IsShow:    s.IsShow,
-		CreatedAt: s.CreatedAt,
+		Id:              uint32(s.Id),
+		Name:            s.Name,
+		MenuType:        s.MenuType,
+		Level:           s.Level,
+		Title:           s.Title,
+		Path:            s.Path,
+		Component:       s.Component,
+		Icon:            s.Icon,
+		Sort:            s.Sort,
+		Redirect:        s.Redirect,
+		ParentId:        uint32(s.ParentId),
+		IsShow:          s.IsShow,
+		CreatedAt:       uint32(s.CreatedAt),
+		CreatedAtFormat: time.Unix(s.CreatedAt, 0).Format(LayoutTime),
 	}
 }

+ 2 - 2
model/system_menu_permissions.go

@@ -15,12 +15,12 @@ func (s *SystemMenuPermissions) TableName() string {
 	return "system_menu_permissions"
 }
 
-func NewSystemMenuPermissions(roleID int64, menuIds []int64) []*SystemMenuPermissions {
+func NewSystemMenuPermissions(roleID int64, menuIds []uint32) []*SystemMenuPermissions {
 	systemMenuPermissions := make([]*SystemMenuPermissions, len(menuIds))
 	for i, v := range menuIds {
 		systemMenuPermissions[i] = &SystemMenuPermissions{
 			RoleId: roleID,
-			MenuId: v,
+			MenuId: int64(v),
 			IsShow: operationPb.IsShow_OK,
 		}
 	}

+ 2 - 2
model/system_mobile.go

@@ -23,9 +23,9 @@ func (s SystemMobileSlice) ToPB() []*operationPb.MobileData {
 	res := make([]*operationPb.MobileData, len(s))
 	for i, v := range s {
 		res[i] = &operationPb.MobileData{
-			Id:              v.Id,
+			Id:              uint32(v.Id),
 			Name:            v.Name,
-			CreatedAt:       v.CreatedAt,
+			CreatedAt:       uint32(v.CreatedAt),
 			CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
 		}
 	}

+ 2 - 2
model/system_mobile_permissions.go

@@ -15,12 +15,12 @@ func (s *SystemMobilePermissions) TableName() string {
 	return "system_mobile_permissions"
 }
 
-func NewSystemMobilePermissions(roleID int64, mobileIds []int64) []*SystemMobilePermissions {
+func NewSystemMobilePermissions(roleID int64, mobileIds []uint32) []*SystemMobilePermissions {
 	systemMobilePermissions := make([]*SystemMobilePermissions, len(mobileIds))
 	for i, v := range mobileIds {
 		systemMobilePermissions[i] = &SystemMobilePermissions{
 			RoleId:   roleID,
-			MobileId: v,
+			MobileId: int64(v),
 			IsShow:   operationPb.IsShow_OK,
 		}
 	}

+ 8 - 7
model/system_role.go

@@ -37,12 +37,12 @@ func (s SystemRoleSlice) ToPB() []*operationPb.AddRoleRequest {
 	res := make([]*operationPb.AddRoleRequest, len(s))
 	for i, v := range s {
 		res[i] = &operationPb.AddRoleRequest{
-			Id:              v.Id,
+			Id:              uint32(v.Id),
 			Name:            v.Name,
 			Remarks:         v.Remarks,
 			CreateUser:      v.CreateUser,
 			IsShow:          v.IsShow,
-			CreatedAt:       v.CreatedAt,
+			CreatedAt:       uint32(v.CreatedAt),
 			CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
 		}
 	}
@@ -51,10 +51,11 @@ func (s SystemRoleSlice) ToPB() []*operationPb.AddRoleRequest {
 
 func (s *SystemRole) ToPb() *operationPb.AddRoleRequest {
 	return &operationPb.AddRoleRequest{
-		Id:         s.Id,
-		Name:       s.Name,
-		CreateUser: s.CreateUser,
-		IsShow:     s.IsShow,
-		CreatedAt:  s.CreatedAt,
+		Id:              uint32(s.Id),
+		Name:            s.Name,
+		CreateUser:      s.CreateUser,
+		IsShow:          s.IsShow,
+		CreatedAt:       uint32(s.CreatedAt),
+		CreatedAtFormat: time.Unix(s.CreatedAt, 0).Format(LayoutTime),
 	}
 }

+ 5 - 5
model/system_user.go

@@ -31,7 +31,7 @@ func (s *SystemUser) SystemUserFormat(userRoles []*SystemRole) *operationPb.User
 	roles := make([]*operationPb.UserRole, len(userRoles))
 	for k, v := range userRoles {
 		roles[k] = &operationPb.UserRole{
-			Id:   v.Id,
+			Id:   uint32(v.Id),
 			Name: v.Name,
 		}
 	}
@@ -77,13 +77,13 @@ func (s SystemUserSlice) ToPB(roleList []*SystemRole) []*operationPb.AddSystemUs
 	res := make([]*operationPb.AddSystemUser, len(s))
 	for i, v := range s {
 		res[i] = &operationPb.AddSystemUser{
-			Id:              v.Id,
+			Id:              uint32(v.Id),
 			Name:            v.Name,
 			Phone:           v.Phone,
 			EmployeeName:    v.EmployeeName,
 			CreateUser:      v.CreateUser,
 			IsShow:          v.IsShow,
-			CreatedAt:       v.CreatedAt,
+			CreatedAt:       uint32(v.CreatedAt),
 			CreatedAtFormat: time.Unix(v.CreatedAt, 0).Format(LayoutTime),
 			RoleName:        strings.TrimRight(v.UserRoleFormat(roleList), ","),
 		}
@@ -107,12 +107,12 @@ func (s *SystemUser) UserRoleFormat(roleList []*SystemRole) string {
 
 func (s *SystemUser) ToPb() *operationPb.AddSystemUser {
 	return &operationPb.AddSystemUser{
-		Id:           s.Id,
+		Id:           uint32(s.Id),
 		Name:         s.Name,
 		Phone:        s.Phone,
 		CreateUser:   s.CreateUser,
 		EmployeeName: s.EmployeeName,
 		IsShow:       s.IsShow,
-		CreatedAt:    s.CreatedAt,
+		CreatedAt:    uint32(s.CreatedAt),
 	}
 }

+ 1 - 1
module/backend/interface.go

@@ -69,7 +69,7 @@ type Operation interface {
 	CreateForage(ctx context.Context, req *operationPb.AddForageRequest) error
 	EditForage(ctx context.Context, req *operationPb.AddForageRequest) error
 	SearchForageList(ctx context.Context, req *operationPb.SearchForageListRequest) (*operationPb.SearchForageListResponse, error)
-	ForageEnumList(ctx context.Context) *ForageEnumList
+	ForageEnumList(ctx context.Context) *operationPb.ForageEnumList
 	DeleteForageList(ctx context.Context, ids []int64) error
 	IsShowForage(ctx context.Context, req *operationPb.IsShowForage) error
 	ImportForage(ctx context.Context) error

+ 41 - 33
module/backend/pasture_service.go

@@ -50,15 +50,6 @@ var (
 	}
 )
 
-type ForageEnumList struct {
-	ForageSource         map[operationPb.ForageSource_Kind]string         `json:"forage_source"`
-	ForagePlanType       map[operationPb.ForagePlanType_Kind]string       `json:"forage_plan_type"`
-	JumpDelaType         map[operationPb.JumpDelaType_Kind]string         `json:"jump_dela_type"`
-	CattleParentCategory map[operationPb.CattleCategoryParent_Kind]string `json:"cattle_parent_category"`
-	ForageParentCategory map[operationPb.ForageCategoryParent_Kind]string `json:"forage_parent_category"`
-	IsShow               map[operationPb.IsShow_Kind]string               `json:"is_show"`
-}
-
 // CreateGroupPasture 创建集团牧场
 func (s *StoreEntry) CreateGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error {
 	pastureList := model.NewGroupPasture(req)
@@ -70,7 +61,7 @@ func (s *StoreEntry) CreateGroupPasture(ctx context.Context, req *operationPb.Ad
 
 // EditGroupPasture 创建集团牧场
 func (s *StoreEntry) EditGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error {
-	groupPasture := &model.GroupPasture{Id: req.Id}
+	groupPasture := &model.GroupPasture{Id: int64(req.Id)}
 	if err := s.DB.First(groupPasture).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在!")
@@ -150,7 +141,7 @@ func (s *StoreEntry) DeleteGroupPasture(ctx context.Context, pastureId int64) er
 
 func (s *StoreEntry) ResetPasswordGroupPasture(ctx context.Context, req *operationPb.RestPasswordGroupPasture) error {
 	groupPasture := &model.GroupPasture{
-		Id: req.PastureId,
+		Id: int64(req.PastureId),
 	}
 	if err := s.DB.First(groupPasture).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
@@ -167,7 +158,7 @@ func (s *StoreEntry) ResetPasswordGroupPasture(ctx context.Context, req *operati
 
 func (s *StoreEntry) IsShowGroupPasture(ctx context.Context, req *operationPb.IsShowGroupPasture) error {
 	groupPasture := &model.GroupPasture{
-		Id: req.PastureId,
+		Id: int64(req.PastureId),
 	}
 	if err := s.DB.First(groupPasture).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
@@ -198,7 +189,7 @@ func (s *StoreEntry) AddCattleCategory(ctx context.Context, req *operationPb.Add
 
 // EditCattleCategory 编辑畜牧分类
 func (s *StoreEntry) EditCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error {
-	cattleCategory := &model.CattleCategory{Id: req.Id}
+	cattleCategory := &model.CattleCategory{Id: int64(req.Id)}
 	if err := s.DB.First(cattleCategory).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在")
@@ -222,7 +213,7 @@ func (s *StoreEntry) EditCattleCategory(ctx context.Context, req *operationPb.Ad
 
 // IsShowCattleCategory 是否启用
 func (s *StoreEntry) IsShowCattleCategory(ctx context.Context, req *operationPb.IsShowCattleCategory) error {
-	cattleCategory := &model.CattleCategory{Id: req.CattleCategoryId}
+	cattleCategory := &model.CattleCategory{Id: int64(req.CattleCategoryId)}
 	if err := s.DB.First(cattleCategory).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在")
@@ -302,7 +293,7 @@ func (s *StoreEntry) AddForageCategory(ctx context.Context, req *operationPb.Add
 
 // EditForageCategory 编辑饲料分类
 func (s *StoreEntry) EditForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error {
-	forageCategory := &model.ForageCategory{Id: req.Id}
+	forageCategory := &model.ForageCategory{Id: int64(req.Id)}
 	if err := s.DB.First(forageCategory).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在")
@@ -326,7 +317,7 @@ func (s *StoreEntry) EditForageCategory(ctx context.Context, req *operationPb.Ad
 
 // IsShowForageCategory 是否启用
 func (s *StoreEntry) IsShowForageCategory(ctx context.Context, req *operationPb.IsShowForageCategory) error {
-	forageCategory := &model.ForageCategory{Id: req.ForageCategoryId}
+	forageCategory := &model.ForageCategory{Id: int64(req.ForageCategoryId)}
 	if err := s.DB.First(forageCategory).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在")
@@ -401,7 +392,7 @@ func (s *StoreEntry) CreateForage(ctx context.Context, req *operationPb.AddForag
 
 // EditForage 编辑饲料
 func (s *StoreEntry) EditForage(ctx context.Context, req *operationPb.AddForageRequest) error {
-	forage := model.Forage{Id: req.Id}
+	forage := model.Forage{Id: int64(req.Id)}
 	if err := s.DB.Where("is_delete = ?", operationPb.IsShow_OK).First(forage).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在")
@@ -411,18 +402,18 @@ func (s *StoreEntry) EditForage(ctx context.Context, req *operationPb.AddForageR
 
 	updateData := &model.Forage{
 		Name:               req.Name,
-		CategoryId:         req.CategoryId,
+		CategoryId:         int64(req.CategoryId),
 		UniqueEncode:       req.UniqueEncode,
 		ForageSourceId:     req.ForageSourceId,
 		PlanTypeId:         req.PlanTypeId,
 		SmallMaterialScale: req.SmallMaterialScale,
-		AllowError:         req.AllowError,
-		PackageWeight:      req.PackageWeight,
-		Price:              req.Price,
-		JumpWeight:         req.JumpWeight,
+		AllowError:         int64(req.AllowError),
+		PackageWeight:      int64(req.PackageWeight),
+		Price:              int64(req.Price),
+		JumpWeight:         int64(req.JumpWeight),
 		JumpDelay:          req.JumpDelay,
 		ConfirmStart:       req.ConfirmStart,
-		RelayLocations:     req.RelayLocations,
+		RelayLocations:     int64(req.RelayLocations),
 		Jmp:                req.Jmp,
 		Backup1:            req.Backup1,
 		Backup2:            req.Backup2,
@@ -486,15 +477,32 @@ func (s *StoreEntry) SearchForageList(ctx context.Context, req *operationPb.Sear
 	}, nil
 }
 
-func (s *StoreEntry) ForageEnumList(ctx context.Context) *ForageEnumList {
-	return &ForageEnumList{
-		JumpDelaType:         JumpDelaTypeMap,
-		ForageSource:         ForageSourceMap,
-		ForagePlanType:       ForagePlanTypeMap,
-		CattleParentCategory: CattleParentCategoryMap,
-		ForageParentCategory: ForageParentCategoryMap,
-		IsShow:               IsShowMap,
-	}
+func (s *StoreEntry) ForageEnumList(ctx context.Context) *operationPb.ForageEnumList {
+	res := &operationPb.ForageEnumList{
+		JumpDelaType:         make([]*operationPb.JumpDelaTypeEnum, 0),
+		ForageSource:         make([]*operationPb.ForageSourceEnum, 0),
+		ForagePlanType:       make([]*operationPb.ForagePlanTypeEnum, 0),
+		CattleParentCategory: make([]*operationPb.CattleParentCategoryEnum, 0),
+		ForageParentCategory: make([]*operationPb.ForageParentCategoryEnum, 0),
+		IsShow:               make([]*operationPb.IsShowEnum, 0),
+	}
+
+	// operationPb.JumpDelaType_INVALID: "禁用",
+	//		operationPb.JumpDelaType_THREE:   "3秒",
+	//		operationPb.JumpDelaType_SIX:     "6秒",
+	//		operationPb.JumpDelaType_NINE:    "9秒",
+	res.JumpDelaType = append(res.JumpDelaType, &operationPb.JumpDelaTypeEnum{
+		Value: operationPb.JumpDelaType_INVALID,
+		Label: "禁用",
+	}, &operationPb.JumpDelaTypeEnum{
+		Value: operationPb.JumpDelaType_THREE,
+		Label: "3秒",
+	}, &operationPb.JumpDelaTypeEnum{
+		Value: operationPb.JumpDelaType_SIX,
+		Label: "6秒",
+	})
+
+	return res
 }
 
 func (s *StoreEntry) DeleteForageList(ctx context.Context, ids []int64) error {
@@ -508,7 +516,7 @@ func (s *StoreEntry) DeleteForageList(ctx context.Context, ids []int64) error {
 }
 
 func (s *StoreEntry) IsShowForage(ctx context.Context, req *operationPb.IsShowForage) error {
-	forage := &model.Forage{Id: req.ForageId}
+	forage := &model.Forage{Id: int64(req.ForageId)}
 	if err := s.DB.First(forage).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在")

+ 15 - 11
module/backend/system_permissions.go

@@ -21,29 +21,33 @@ type SystemAllPermissionsList struct {
 
 func (s *StoreEntry) AllPermissionsListToRolePermissions(req *SystemAllPermissionsList) *operationPb.RolePermissionsList {
 	res := &operationPb.RolePermissionsList{
-		MobileList:  make([]int64, 0),
-		MenuList:    make([]int64, 0),
-		PastureList: make([]int64, 0),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: &operationPb.RolePermissionsData{
+			MobileList:  make([]uint32, 0),
+			MenuList:    make([]uint32, 0),
+			PastureList: make([]uint32, 0),
+		},
 	}
 	wg := sync.WaitGroup{}
 	wg.Add(3)
 	go func() {
 		for _, v := range req.MobileList {
-			res.MobileList = append(res.MobileList, v.MobileId)
+			res.Data.MobileList = append(res.Data.MobileList, uint32(v.MobileId))
 		}
 		wg.Done()
 	}()
 
 	go func() {
 		for _, v := range req.MenuList {
-			res.MenuList = append(res.MenuList, v.MenuId)
+			res.Data.MenuList = append(res.Data.MenuList, uint32(v.MenuId))
 		}
 		wg.Done()
 	}()
 
 	go func() {
 		for _, v := range req.PastureList {
-			res.PastureList = append(res.PastureList, v.PastureId)
+			res.Data.PastureList = append(res.Data.PastureList, uint32(v.PastureId))
 		}
 		wg.Done()
 	}()
@@ -82,7 +86,7 @@ func (s *StoreEntry) SystemPermissionsFormatPb(pastureList []*model.GroupPasture
 		for _, v := range pastureList {
 			systemUserMenuPermissions.Data.PastureList = append(systemUserMenuPermissions.Data.PastureList,
 				&operationPb.AddPastureRequest{
-					Id:   v.Id,
+					Id:   uint32(v.Id),
 					Name: v.Name,
 				},
 			)
@@ -98,9 +102,9 @@ func (s *StoreEntry) SystemPermissionsFormatPb(pastureList []*model.GroupPasture
 				level[menu.Level] = make([]*operationPb.AddMenuRequest, 0)
 			}
 			level[menu.Level] = append(level[menu.Level], &operationPb.AddMenuRequest{
-				Id:              menu.Id,
+				Id:              uint32(menu.Id),
 				Name:            menu.Name,
-				ParentId:        menu.ParentId,
+				ParentId:        uint32(menu.ParentId),
 				MenuType:        menu.MenuType,
 				Title:           menu.Title,
 				Path:            menu.Path,
@@ -109,7 +113,7 @@ func (s *StoreEntry) SystemPermissionsFormatPb(pastureList []*model.GroupPasture
 				Icon:            menu.Icon,
 				Sort:            menu.Sort,
 				Redirect:        menu.Redirect,
-				CreatedAt:       menu.CreatedAt,
+				CreatedAt:       uint32(menu.CreatedAt),
 				CreatedAtFormat: time.Unix(menu.CreatedAt, 0).Format(model.LayoutTime),
 				Level:           menu.Level,
 				Affix:           true,
@@ -148,7 +152,7 @@ func (s *StoreEntry) SystemPermissionsFormatPb(pastureList []*model.GroupPasture
 		for _, v := range mobileList {
 			systemUserMenuPermissions.Data.MobileList = append(systemUserMenuPermissions.Data.MobileList,
 				&operationPb.AddMobileRequest{
-					Id:   v.Id,
+					Id:   uint32(v.Id),
 					Name: v.Name,
 				},
 			)

+ 14 - 10
module/backend/system_service.go

@@ -135,7 +135,7 @@ func (s *StoreEntry) SearchSystemUserList(ctx context.Context, req *operationPb.
 
 // EditSystemUser 编辑用户
 func (s *StoreEntry) EditSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error {
-	systemUser := &model.SystemUser{Id: req.Id}
+	systemUser := &model.SystemUser{Id: int64(req.Id)}
 	if err := s.DB.First(systemUser).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在!")
@@ -181,7 +181,7 @@ func (s *StoreEntry) DeleteSystemUser(ctx context.Context, userId int64) error {
 // IsShowSystemUser 用户是否启用
 func (s *StoreEntry) IsShowSystemUser(ctx context.Context, req *operationPb.IsShowSystemUserRequest) error {
 	systemUser := &model.SystemUser{
-		Id: req.UserId,
+		Id: int64(req.UserId),
 	}
 	if err := s.DB.First(systemUser).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
@@ -296,7 +296,7 @@ func (s *StoreEntry) CreateSystemRole(ctx context.Context, req *operationPb.AddR
 
 // EditSystemRole 编辑角色
 func (s *StoreEntry) EditSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error {
-	role := &model.SystemRole{Id: req.Id}
+	role := &model.SystemRole{Id: int64(req.Id)}
 	if err := s.DB.First(role).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在")
@@ -348,10 +348,14 @@ func (s *StoreEntry) SearchSystemRoleList(ctx context.Context, req *operationPb.
 	}
 
 	return &operationPb.SearchRoleResponse{
-		Page:     req.Pagination.Page,
-		Total:    int32(count),
-		PageSize: req.Pagination.PageSize,
-		List:     model.SystemRoleSlice(systemRole).ToPB(),
+		Code: http.StatusOK,
+		Msg:  "ok",
+		Data: &operationPb.SearchRoleData{
+			Page:     req.Pagination.Page,
+			Total:    int32(count),
+			PageSize: req.Pagination.PageSize,
+			List:     model.SystemRoleSlice(systemRole).ToPB(),
+		},
 	}, nil
 }
 
@@ -402,7 +406,7 @@ func (s *StoreEntry) CreateSystemMenu(ctx context.Context, req *operationPb.AddM
 
 // EditSystemMenu 编辑系统菜单权限
 func (s *StoreEntry) EditSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error {
-	systemMenu := &model.SystemMenu{Id: req.Id}
+	systemMenu := &model.SystemMenu{Id: int64(req.Id)}
 	if err := s.DB.First(systemMenu).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在!")
@@ -419,7 +423,7 @@ func (s *StoreEntry) EditSystemMenu(ctx context.Context, req *operationPb.AddMen
 		Icon:      req.Icon,
 		Sort:      req.Sort,
 		Redirect:  req.Redirect,
-		ParentId:  req.ParentId,
+		ParentId:  int64(req.ParentId),
 	}
 
 	if err := s.DB.Model(new(model.SystemMenu)).Omit("is_show").
@@ -433,7 +437,7 @@ func (s *StoreEntry) EditSystemMenu(ctx context.Context, req *operationPb.AddMen
 
 // IsShowSystemMenu 菜单是否启用
 func (s *StoreEntry) IsShowSystemMenu(ctx context.Context, req *operationPb.IsShowSystemMenuRequest) error {
-	systemMenu := &model.SystemMenu{Id: req.MenuId}
+	systemMenu := &model.SystemMenu{Id: int64(req.MenuId)}
 	if err := s.DB.First(systemMenu).Error; err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return xerr.Custom("该数据不存在")

+ 0 - 1
pkg/jsonpb/encode.go

@@ -32,7 +32,6 @@ func MarshalBytes(pb proto.Message) ([]byte, error) {
 	buf := append([]byte(nil), e.Bytes()...)
 	e.Reset()
 	encodeStatePool.Put(e)
-
 	return buf, nil
 }
 

+ 9 - 9
proto/go/backend/operation/mobile.pb.go

@@ -80,7 +80,7 @@ type SearchMobileResponse struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Code int64             `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
+	Code int32             `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
 	Msg  string            `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
 	Data *SearchMobileData `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
 }
@@ -117,7 +117,7 @@ func (*SearchMobileResponse) Descriptor() ([]byte, []int) {
 	return file_backend_operation_mobile_proto_rawDescGZIP(), []int{1}
 }
 
-func (x *SearchMobileResponse) GetCode() int64 {
+func (x *SearchMobileResponse) GetCode() int32 {
 	if x != nil {
 		return x.Code
 	}
@@ -214,9 +214,9 @@ type MobileData struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Id              int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+	Id              uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
 	Name            string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
-	CreatedAt       int64  `protobuf:"varint,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+	CreatedAt       uint32 `protobuf:"varint,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
 	CreatedAtFormat string `protobuf:"bytes,4,opt,name=created_at_format,json=createdAtFormat,proto3" json:"created_at_format,omitempty"`
 }
 
@@ -252,7 +252,7 @@ func (*MobileData) Descriptor() ([]byte, []int) {
 	return file_backend_operation_mobile_proto_rawDescGZIP(), []int{3}
 }
 
-func (x *MobileData) GetId() int64 {
+func (x *MobileData) GetId() uint32 {
 	if x != nil {
 		return x.Id
 	}
@@ -266,7 +266,7 @@ func (x *MobileData) GetName() string {
 	return ""
 }
 
-func (x *MobileData) GetCreatedAt() int64 {
+func (x *MobileData) GetCreatedAt() uint32 {
 	if x != nil {
 		return x.CreatedAt
 	}
@@ -297,7 +297,7 @@ var file_backend_operation_mobile_proto_rawDesc = []byte{
 	0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69,
 	0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x75, 0x0a, 0x14, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
 	0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12,
-	0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f,
+	0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f,
 	0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
 	0x03, 0x6d, 0x73, 0x67, 0x12, 0x37, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01,
 	0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2e, 0x6f, 0x70, 0x65,
@@ -313,10 +313,10 @@ var file_backend_operation_mobile_proto_rawDesc = []byte{
 	0x64, 0x2e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x6f, 0x62, 0x69,
 	0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x7b, 0x0a, 0x0a,
 	0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
 	0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d,
 	0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01,
-	0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x2a, 0x0a,
+	0x28, 0x0d, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x2a, 0x0a,
 	0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x6d,
 	0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
 	0x64, 0x41, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x3b, 0x6f,

File diff suppressed because it is too large
+ 495 - 78
proto/go/backend/operation/pasture.pb.go


File diff suppressed because it is too large
+ 240 - 114
proto/go/backend/operation/system.pb.go


+ 1 - 1
service/sso/cache.go

@@ -26,7 +26,7 @@ func NewCache(cfg *config.AppConfig) *Cache {
 	}
 }
 
-func (c *Cache) Auth(userAuth *operationPb.UserAuth) (string, error) {
+func (c *Cache) Auth(userAuth *operationPb.UserAuthData) (string, error) {
 	return c.get(fmt.Sprintf("sso:auth:%s", tool.Md5String(fmt.Sprintf("%s-%s", userAuth.UserName, userAuth.Password))))
 }
 

+ 1 - 1
service/sso/sso.go

@@ -11,7 +11,7 @@ import (
 var Module = di.Provide(NewSSOClient)
 
 type ClientInterface interface {
-	Auth(userAuth *operationPb.UserAuth) (string, error)
+	Auth(userAuth *operationPb.UserAuthData) (string, error)
 	CacheAuth(token string, res interface{}) error
 	CacheSetAccount(token string, res interface{}) error
 	GetAccount(token string) (interface{}, error)

Some files were not shown because too many files changed in this diff