Browse Source

feat:附件地址

wangshan 3 years ago
parent
commit
a6c2f97413

+ 1 - 2
api/etc/info-api.yaml

@@ -21,5 +21,4 @@ Consumer:
     Hosts:
       - 127.0.0.1:2379
     Key: consumer.rpc
-AppId: 10000
-OssUrl: https://jy-datafile.oss-cn-beijing.aliyuncs.com/
+AppId: 10000

+ 0 - 1
api/internal/config/config.go

@@ -16,5 +16,4 @@ type Config struct {
 	Common   zrpc.RpcClientConf
 	Manager  zrpc.RpcClientConf
 	Consumer zrpc.RpcClientConf
-	OssUrl   string
 }

+ 1 - 1
api/internal/logic/infodetaillogic.go

@@ -2,7 +2,7 @@ package logic
 
 import (
 	"context"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 
 	"app.yhyue.com/moapp/jybase/common"
 

+ 1 - 1
api/internal/logic/infoexaminelogic.go

@@ -2,7 +2,7 @@ package logic
 
 import (
 	"context"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 
 	"app.yhyue.com/moapp/jybase/common"
 

+ 1 - 1
api/internal/logic/infolistlogic.go

@@ -2,7 +2,7 @@ package logic
 
 import (
 	"context"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 
 	"app.yhyue.com/moapp/jybase/common"
 

+ 1 - 1
api/internal/logic/organfrozenlogic.go

@@ -2,7 +2,7 @@ package logic
 
 import (
 	"context"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 
 	"app.yhyue.com/moapp/jybase/common"
 

+ 1 - 0
entity/db.go

@@ -34,6 +34,7 @@ type OssStruct struct {
 	OssAccessKeyId     string `json:"ossAccessKeyId"`
 	OssAccessKeySecret string `json:"ossAccessKeySecret"`
 	OssBucketName      string `json:"ossBucketName"`
+	OssUrl             string `json:"ossUrl"`
 }
 
 // Sensitive

+ 5 - 38
rpc/common/common.go

@@ -3,71 +3,38 @@ package main
 import (
 	mc "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/endless"
-	"flag"
 	"fmt"
 	"jyInfo/rpc/util"
 	"log"
 
-	cf "jyInfo/rpc/common/internal/config"
+	IC "jyInfo/rpc/common/init"
 	"jyInfo/rpc/common/internal/server"
 	"jyInfo/rpc/common/internal/svc"
 	"jyInfo/rpc/common/type/common"
 
-	"jyInfo/rpc/model"
-
-	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"
 )
 
-var configFile = flag.String("f", "etc/common.yaml", "the config file")
-
-//
-func init() {
-	conf.MustLoad(*configFile, &cf.CommonConfig)
-	//初始化msyql
-	mm := cf.CommonConfig.MysqlMain
-	model.InitMysql(&mm)
-	//初始redis
-	rm := cf.CommonConfig.Redis
-	model.InitRedis(&rm)
-	//初始es
-	es := cf.CommonConfig.Es
-	model.InitEs(&es)
-
-	//初始Sensitive
-	ss := cf.CommonConfig.Sensitive
-	model.InitSensitive(&ss)
-
-	//初始化nsq
-	nsq := cf.CommonConfig.Nsq
-	model.InitNsqConfig(&nsq)
-	//定时任务
-	tk := cf.CommonConfig.Task
-	//日志清除
-	go util.NewTaskInit(tk.IsRun, tk.TaskInfoLog.Flag, tk.TaskInfoLog.Cron, tk.TaskInfoLog.EffectiveTime).Crontab()
-}
-
 //
 func main() {
 	//热重启
 	go func() {
-		err := endless.ListenAndServe(":"+mc.InterfaceToStr(cf.CommonConfig.Webrpcport), nil, func() {})
+		err := endless.ListenAndServe(":"+mc.InterfaceToStr(IC.C.Webrpcport), nil, func() {})
 		if err != nil {
 			log.Println("ListenAndServe: ", err)
 		}
 	}()
-	flag.Parse()
-	ctx := svc.NewServiceContext(cf.CommonConfig)
+	ctx := svc.NewServiceContext(IC.C)
 	srv := server.NewCommonServer(ctx)
 
-	s := zrpc.MustNewServer(cf.CommonConfig.RpcServerConf, func(grpcServer *grpc.Server) {
+	s := zrpc.MustNewServer(IC.C.RpcServerConf, func(grpcServer *grpc.Server) {
 		common.RegisterCommonServer(grpcServer, srv)
 	})
 	//日志记录
 	s.AddUnaryInterceptors(util.CustomInterceptors)
 	defer s.Stop()
 
-	fmt.Printf("Starting rpc server at %s...\n", cf.CommonConfig.ListenOn)
+	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	s.Start()
 }

+ 38 - 0
rpc/common/init/init.go

@@ -0,0 +1,38 @@
+package init
+
+import (
+	"flag"
+	"github.com/zeromicro/go-zero/core/conf"
+	"jyInfo/rpc/common/internal/config"
+	"jyInfo/rpc/model"
+	"jyInfo/rpc/util"
+)
+
+var configFile = flag.String("f", "etc/common.yaml", "the config file")
+var C config.Config
+
+//
+func init() {
+	conf.MustLoad(*configFile, &C)
+	//初始化msyql
+	mm := C.MysqlMain
+	model.InitMysql(&mm)
+	//初始redis
+	rm := C.Redis
+	model.InitRedis(&rm)
+	//初始es
+	es := C.Es
+	model.InitEs(&es)
+
+	//初始Sensitive
+	ss := C.Sensitive
+	model.InitSensitive(&ss)
+
+	//初始化nsq
+	nsq := C.Nsq
+	model.InitNsqConfig(&nsq)
+	//定时任务
+	tk := C.Task
+	//日志清除
+	go util.NewTaskInit(tk.IsRun, tk.TaskInfoLog.Flag, tk.TaskInfoLog.Cron, tk.TaskInfoLog.EffectiveTime).Crontab()
+}

+ 0 - 2
rpc/common/internal/config/config.go

@@ -23,5 +23,3 @@ type Config struct {
 	Sensitive entity.Sensitive
 	Nsq       entity.NsqStruct
 }
-
-var CommonConfig Config

+ 8 - 39
rpc/consumer/consumer.go

@@ -1,69 +1,38 @@
 package main
 
 import (
-	mc "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/endless"
-	"flag"
 	"fmt"
-	"jyInfo/rpc/consumer/internal/config"
+	IC "jyInfo/rpc/consumer/init"
 	"jyInfo/rpc/consumer/internal/server"
 	"jyInfo/rpc/consumer/internal/svc"
 	"jyInfo/rpc/consumer/type/consumer"
-	"jyInfo/rpc/model"
-	Oss "jyInfo/rpc/model/oss"
 	"jyInfo/rpc/util"
 	"log"
 
-	"github.com/zeromicro/go-zero/core/conf"
+	mc "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/endless"
 	"github.com/zeromicro/go-zero/core/service"
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/reflection"
 )
 
-var configFile = flag.String("f", "etc/consumer.yaml", "the config file")
-
-func init() {
-	conf.MustLoad(*configFile, &config.CommonConfig)
-	//初始化msyql
-	mm := config.CommonConfig.MysqlMain
-	model.InitMysql(&mm)
-	//初始redis
-	rm := config.CommonConfig.Redis
-	model.InitRedis(&rm)
-	//初始nsq
-	nm := config.CommonConfig.Nsq
-	model.InitNsqConfig(&nm)
-	//初始SupplyTotal
-	sm := config.CommonConfig.SupplyTotal
-	model.SupplyTotalConfig(sm)
-	//初始es
-	es := config.CommonConfig.Es
-	model.InitEs(&es)
-	//初始化oss
-	oss := config.CommonConfig.Oss
-	Oss.InitOss(oss.OssEndpoint, oss.OssAccessKeyId, oss.OssAccessKeySecret)
-}
-
 func main() {
 	//热重启
 	go func() {
-		err := endless.ListenAndServe(":"+mc.InterfaceToStr(config.CommonConfig.Webrpcport), nil, func() {})
+		err := endless.ListenAndServe(":"+mc.InterfaceToStr(IC.C.Webrpcport), nil, func() {})
 		if err != nil {
 			log.Println("ListenAndServe: ", err)
 		}
 	}()
-	flag.Parse()
 
-	var c config.Config
-	conf.MustLoad(*configFile, &c)
-	ctx := svc.NewServiceContext(c)
+	ctx := svc.NewServiceContext(IC.C)
 	svr := server.NewConsumerServer(ctx)
 
-	s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
+	s := zrpc.MustNewServer(IC.C.RpcServerConf, func(grpcServer *grpc.Server) {
 		consumer.RegisterConsumerServer(grpcServer, svr)
 
-		if c.Mode == service.DevMode || c.Mode == service.TestMode {
+		if IC.C.Mode == service.DevMode || IC.C.Mode == service.TestMode {
 			reflection.Register(grpcServer)
 		}
 	})
@@ -71,6 +40,6 @@ func main() {
 	s.AddUnaryInterceptors(util.CustomInterceptors)
 	defer s.Stop()
 
-	fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
+	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	s.Start()
 }

+ 1 - 0
rpc/consumer/consumer.proto

@@ -289,6 +289,7 @@ message InfoFileUploadData {
 	string ftype = 2;//附件类型
 	string fid = 3;//key
 	string size = 4;//单位KB
+	string ossurl = 5;//oss域名
 }
 //servie
 service consumer {

+ 2 - 1
rpc/consumer/etc/consumer.yaml

@@ -27,4 +27,5 @@ Oss:
   ossEndpoint: oss-cn-beijing.aliyuncs.com
   ossAccessKeyId: LTAI4G5x9aoZx8dDamQ7vfZi
   ossAccessKeySecret: Bk98FsbPYXcJe72n1bG3Ssf73acuNh
-  ossBucketName: jy-datafile
+  ossBucketName: jy-datafile
+  ossUrl: https://jy-datafile.oss-cn-beijing.aliyuncs.com/

+ 34 - 0
rpc/consumer/init/init.go

@@ -0,0 +1,34 @@
+package init
+
+import (
+	"flag"
+	"github.com/zeromicro/go-zero/core/conf"
+	"jyInfo/rpc/consumer/internal/config"
+	"jyInfo/rpc/model"
+	Oss "jyInfo/rpc/model/oss"
+)
+
+var configFile = flag.String("f", "etc/consumer.yaml", "the config file")
+var C config.Config
+
+func init() {
+	conf.MustLoad(*configFile, &C)
+	//初始化msyql
+	mm := C.MysqlMain
+	model.InitMysql(&mm)
+	//初始redis
+	rm := C.Redis
+	model.InitRedis(&rm)
+	//初始nsq
+	nm := C.Nsq
+	model.InitNsqConfig(&nm)
+	//初始SupplyTotal
+	sm := C.SupplyTotal
+	model.SupplyTotalConfig(sm)
+	//初始es
+	es := C.Es
+	model.InitEs(&es)
+	//初始化oss
+	oss := C.Oss
+	Oss.InitOss(oss.OssEndpoint, oss.OssAccessKeyId, oss.OssAccessKeySecret)
+}

+ 0 - 2
rpc/consumer/internal/config/config.go

@@ -16,5 +16,3 @@ type Config struct {
 	Es          entity.EsStruct
 	Oss         entity.OssStruct
 }
-
-var CommonConfig Config

+ 3 - 2
rpc/consumer/internal/logic/infofileuploadlogic.go

@@ -3,7 +3,7 @@ package logic
 import (
 	"bytes"
 	"context"
-	"jyInfo/rpc/consumer/internal/config"
+	IC "jyInfo/rpc/consumer/init"
 	model "jyInfo/rpc/model/oss"
 	"strings"
 
@@ -33,13 +33,14 @@ func (l *InfoFileUploadLogic) InfoFileUpload(in *consumer.InfoFileUploadReq) (*c
 	var resp consumer.InfoFileUploadResp
 	//model.InitOss()
 	key := model.GetHashKey(in.File) + model.TypeByExt(in.FileName)
-	b, err := model.OssPutObject(key, bytes.NewReader(in.File), mc.InterfaceToStr(config.CommonConfig.Oss.OssBucketName))
+	b, err := model.OssPutObject(key, bytes.NewReader(in.File), mc.InterfaceToStr(IC.C.Oss.OssBucketName))
 	fileSize := mc.InterfaceToStr(in.FileSize/1024) + "KB"
 	if err == nil && b {
 		var data consumer.InfoFileUploadData
 		data.Filename = in.FileName
 		data.Size = fileSize
 		data.Fid = key
+		data.Ossurl = IC.C.Oss.OssUrl
 		ftypes := strings.Split(in.FileName, ".")
 		var ftype string
 		if len(ftypes) > 0 && len(ftypes) == 2 {

+ 58 - 49
rpc/consumer/type/consumer/consumer.pb.go

@@ -2694,6 +2694,7 @@ type InfoFileUploadData struct {
 	Ftype    string `protobuf:"bytes,2,opt,name=ftype,proto3" json:"ftype,omitempty"`       //附件类型
 	Fid      string `protobuf:"bytes,3,opt,name=fid,proto3" json:"fid,omitempty"`           //key
 	Size     string `protobuf:"bytes,4,opt,name=size,proto3" json:"size,omitempty"`         //单位KB
+	Ossurl   string `protobuf:"bytes,5,opt,name=ossurl,proto3" json:"ossurl,omitempty"`     //oss域名
 }
 
 func (x *InfoFileUploadData) Reset() {
@@ -2756,6 +2757,13 @@ func (x *InfoFileUploadData) GetSize() string {
 	return ""
 }
 
+func (x *InfoFileUploadData) GetOssurl() string {
+	if x != nil {
+		return x.Ossurl
+	}
+	return ""
+}
+
 var File_consumer_proto protoreflect.FileDescriptor
 
 var file_consumer_proto_rawDesc = []byte{
@@ -3096,55 +3104,56 @@ var file_consumer_proto_rawDesc = []byte{
 	0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63,
 	0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x46, 0x69, 0x6c, 0x65,
 	0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
-	0x22, 0x6c, 0x0a, 0x12, 0x49, 0x6e, 0x66, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c, 0x6f,
-	0x61, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61,
-	0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61,
-	0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x05, 0x66, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x69, 0x64, 0x18,
-	0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x66, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69,
-	0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x32, 0xfc,
-	0x04, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0b, 0x50,
-	0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x63, 0x6f, 0x6e,
-	0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x49, 0x6e, 0x66,
-	0x6f, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e,
-	0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12,
-	0x3f, 0x0a, 0x0c, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12,
-	0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49,
-	0x64, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e,
-	0x49, 0x6e, 0x66, 0x6f, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70,
-	0x12, 0x3d, 0x0a, 0x0b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x12,
-	0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49,
-	0x64, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e,
-	0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12,
-	0x48, 0x0a, 0x0d, 0x4d, 0x79, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74,
-	0x12, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x4d, 0x79, 0x50, 0x75,
-	0x62, 0x6c, 0x69, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x63,
-	0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x4d, 0x79, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73,
-	0x68, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3f, 0x0a, 0x0a, 0x49, 0x6e, 0x66,
-	0x6f, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x17, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d,
-	0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71,
-	0x1a, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f,
-	0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x38, 0x0a, 0x0b, 0x53, 0x74,
-	0x61, 0x74, 0x75, 0x73, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
-	0x75, 0x6d, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x14,
-	0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x51, 0x0a, 0x10, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x6e,
-	0x66, 0x6f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75,
-	0x6d, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x65,
-	0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d,
-	0x65, 0x72, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x65, 0x61,
-	0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x47, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c,
-	0x79, 0x49, 0x6e, 0x66, 0x6f, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x13, 0x2e, 0x63, 0x6f,
-	0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
-	0x1a, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x70, 0x70,
-	0x6c, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70,
-	0x12, 0x4b, 0x0a, 0x0e, 0x49, 0x6e, 0x66, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c, 0x6f,
-	0x61, 0x64, 0x12, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e,
-	0x66, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x1a,
-	0x1c, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x46,
-	0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0c, 0x5a,
-	0x0a, 0x2e, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f,
-	0x74, 0x6f, 0x33,
+	0x22, 0x84, 0x01, 0x0a, 0x12, 0x49, 0x6e, 0x66, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c,
+	0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e,
+	0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e,
+	0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x05, 0x66, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x69, 0x64,
+	0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x66, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73,
+	0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12,
+	0x16, 0x0a, 0x06, 0x6f, 0x73, 0x73, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x06, 0x6f, 0x73, 0x73, 0x75, 0x72, 0x6c, 0x32, 0xfc, 0x04, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73,
+	0x75, 0x6d, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x49,
+	0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x50,
+	0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e,
+	0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68,
+	0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3f, 0x0a, 0x0c, 0x49, 0x6e, 0x66, 0x6f,
+	0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75,
+	0x6d, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e,
+	0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x79, 0x55,
+	0x73, 0x65, 0x72, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3d, 0x0a, 0x0b, 0x49, 0x6e, 0x66,
+	0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x12, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75,
+	0x6d, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e,
+	0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x6c,
+	0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x48, 0x0a, 0x0d, 0x4d, 0x79, 0x50, 0x75,
+	0x62, 0x6c, 0x69, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
+	0x75, 0x6d, 0x65, 0x72, 0x2e, 0x4d, 0x79, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4c, 0x69,
+	0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72,
+	0x2e, 0x4d, 0x79, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
+	0x73, 0x70, 0x12, 0x3f, 0x0a, 0x0a, 0x49, 0x6e, 0x66, 0x6f, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
+	0x12, 0x17, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f,
+	0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
+	0x75, 0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52,
+	0x65, 0x73, 0x70, 0x12, 0x38, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x51, 0x75, 0x65,
+	0x72, 0x79, 0x12, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x53, 0x74,
+	0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d,
+	0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x51, 0x0a,
+	0x10, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x65, 0x61, 0x72, 0x63,
+	0x68, 0x12, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x70,
+	0x70, 0x6c, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71,
+	0x1a, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x70, 0x70,
+	0x6c, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x47, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x44, 0x65,
+	0x74, 0x61, 0x69, 0x6c, 0x12, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e,
+	0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
+	0x75, 0x6d, 0x65, 0x72, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x44,
+	0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4b, 0x0a, 0x0e, 0x49, 0x6e, 0x66,
+	0x6f, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1b, 0x2e, 0x63, 0x6f,
+	0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x55,
+	0x70, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75,
+	0x6d, 0x65, 0x72, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c, 0x6f,
+	0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x63, 0x6f, 0x6e, 0x73,
+	0x75, 0x6d, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (

+ 11 - 10
rpc/manager/common/initMysql.go → rpc/manager/init/init.go

@@ -1,26 +1,27 @@
-package common
+package init
 
 import (
 	"flag"
 	"fmt"
-	cf "jyInfo/rpc/manager/internal/config"
+	"github.com/zeromicro/go-zero/core/conf"
+	"jyInfo/rpc/manager/internal/config"
 	"jyInfo/rpc/model"
 	"log"
 
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/jinzhu/gorm"
-	"github.com/zeromicro/go-zero/core/conf"
 )
 
 var configF = flag.String("ff", "etc/manager.yaml", "the config file")
 
+var C config.Config
 var DB *gorm.DB
 var err error
 
 func init() {
-	conf.MustLoad(*configF, &cf.CommonConfig)
+	conf.MustLoad(*configF, &C)
 	//初始化msyql
-	mm := cf.CommonConfig.MysqlMain
+	mm := C.MysqlMain
 	data_source := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=Local",
 		mm.UserName,
 		mm.PassWord,
@@ -36,15 +37,15 @@ func init() {
 	log.Println("初始化 mysql")
 
 	//初始redis
-	rm := cf.CommonConfig.Redis
+	rm := C.Redis
 	model.InitRedis(&rm)
 	model.InitMysql(&mm)
-	//初始redis
-	nm := cf.CommonConfig.Nsq
+	//初始NSQ
+	nm := C.Nsq
 	model.InitNsqConfig(&nm)
 
-	//初始redis
-	sm := cf.CommonConfig.Sensitive
+	//初始Sensitive
+	sm := C.Sensitive
 	model.InitSensitive(&sm)
 
 }

+ 0 - 2
rpc/manager/internal/config/config.go

@@ -14,5 +14,3 @@ type Config struct {
 	Nsq        entity.NsqStruct
 	Sensitive  entity.Sensitive
 }
-
-var CommonConfig Config

+ 1 - 1
rpc/manager/internal/logic/infodetaillogic.go

@@ -9,7 +9,7 @@ import (
 	"app.yhyue.com/moapp/jybase/common"
 
 	"jyInfo/rpc/manager/internal/svc"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 6 - 35
rpc/manager/internal/logic/infoexaminelogic.go

@@ -2,12 +2,10 @@ package logic
 
 import (
 	se "app.yhyue.com/moapp/jybase/encrypt"
-	//"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
-	//"bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/resource"
 	"context"
-	//"errors"
 	"fmt"
 	jycommon "jyInfo/rpc/manager/common"
+	IC "jyInfo/rpc/manager/init"
 	md "jyInfo/rpc/model"
 	model "jyInfo/rpc/model/es"
 	"jyInfo/rpc/util"
@@ -17,7 +15,7 @@ import (
 	"app.yhyue.com/moapp/jybase/redis"
 
 	"jyInfo/rpc/manager/internal/svc"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -52,14 +50,14 @@ func (l *InfoExamineLogic) InfoExamine(in *manager.InfoExamineReq) (*manager.Inf
 		upData["review_time"] = time.Now().Format("2006-01-02 15:04:05")
 		if in.MsgType == 1 || in.MsgType == 2 {
 			var info jycommon.Information
-			db := jycommon.DB.Where(query).First(&info).Update(upData)
+			db := IC.DB.Where(query).First(&info).Update(upData)
 			if db.Error != nil {
 				resp.ErrCode = -1
 				resp.ErrMsg = "审核不通过,更新数据失败"
 			}
 		} else if in.MsgType == 3 {
 			var info jycommon.SupplyInfo
-			db := jycommon.DB.Where(query).First(&info)
+			db := IC.DB.Where(query).First(&info)
 			if db.Error != nil {
 				resp.ErrCode = -1
 				resp.ErrMsg = "审核不通过,供应信息数据查询失败"
@@ -91,7 +89,7 @@ func (l *InfoExamineLogic) InfoExamine(in *manager.InfoExamineReq) (*manager.Inf
 		upData["review_time"] = time.Now().Format("2006-01-02 15:04:05")
 		if in.MsgType == 1 || in.MsgType == 2 {
 			var info jycommon.Information
-			db := jycommon.DB.Where(query).First(&info)
+			db := IC.DB.Where(query).First(&info)
 			if db.Error != nil {
 				fmt.Println(db.Error)
 				resp.ErrCode = -1
@@ -113,7 +111,7 @@ func (l *InfoExamineLogic) InfoExamine(in *manager.InfoExamineReq) (*manager.Inf
 			}
 		} else if in.MsgType == 3 {
 			var info jycommon.SupplyInfo
-			db := jycommon.DB.Where(query).First(&info)
+			db := IC.DB.Where(query).First(&info)
 			if db.Error != nil {
 				resp.ErrCode = -1
 				resp.ErrMsg = "人工审核通过,获取供应信息数据失败"
@@ -149,30 +147,3 @@ func (l *InfoExamineLogic) InfoExamine(in *manager.InfoExamineReq) (*manager.Inf
 	}
 	return &resp, nil
 }
-
-//
-//func ResourcePowerRelease(rc resource.Resource, eId, uId int64, funcCode, Appid string) error {
-//	res, err := rc.Deduction(context.Background(), &pb.DeductionReq{
-//		Appid:        Appid,
-//		EntId:        eId,
-//		UserId:       uId,
-//		FunctionCode: funcCode,
-//		Count:        1,
-//		Ids:          nil,
-//	})
-//	if err != nil {
-//		return err
-//	}
-//	//0:失败 1:成功 -1:不在有效期内 -2:数量不足 -3:没有授权
-//	switch res.Status {
-//	case 0:
-//		return errors.New(fmt.Sprintf("账户 eId:%d,uId:%d 释放业务%s权限失败", eId, uId, funcCode))
-//	case -1:
-//		return errors.New(fmt.Sprintf("账户 eId:%d,uId:%d 释放业务%s权限失败,权限已过期", eId, uId, funcCode))
-//	case -2:
-//		return errors.New(fmt.Sprintf("账户 eId:%d,uId:%d 释放业务%s权限失败,余额不足", eId, uId, funcCode))
-//	case -3:
-//		return errors.New(fmt.Sprintf("账户 eId:%d,uId:%d 释放业务%s权限失败", eId, uId, funcCode))
-//	}
-//	return nil
-//}

+ 1 - 1
rpc/manager/internal/logic/infolistlogic.go

@@ -5,7 +5,7 @@ import (
 	"context"
 	"fmt"
 	"jyInfo/rpc/manager/internal/svc"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 	"jyInfo/rpc/model"
 	"strings"
 

+ 1 - 1
rpc/manager/internal/logic/institutionsfreezelogic.go

@@ -5,7 +5,7 @@ import (
 	"jyInfo/rpc/model"
 
 	"jyInfo/rpc/manager/internal/svc"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 1 - 1
rpc/manager/internal/server/managerserver.go

@@ -8,7 +8,7 @@ import (
 
 	"jyInfo/rpc/manager/internal/logic"
 	"jyInfo/rpc/manager/internal/svc"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 )
 
 type ManagerServer struct {

+ 7 - 14
rpc/manager/manager.go

@@ -3,46 +3,39 @@ package main
 import (
 	mc "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/endless"
-	"flag"
 	"fmt"
 	"jyInfo/rpc/util"
 	"log"
 
-	"jyInfo/rpc/manager/internal/config"
+	IC "jyInfo/rpc/manager/init"
 	"jyInfo/rpc/manager/internal/server"
 	"jyInfo/rpc/manager/internal/svc"
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 
 	_ "jyInfo/rpc/manager/common"
 
-	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/service"
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/reflection"
 )
 
-var configFile = flag.String("f", "etc/manager.yaml", "the config file")
-
 func main() {
 	//热重启
 	go func() {
-		err := endless.ListenAndServe(":"+mc.InterfaceToStr(config.CommonConfig.Webrpcport), nil, func() {})
+		err := endless.ListenAndServe(":"+mc.InterfaceToStr(IC.C.Webrpcport), nil, func() {})
 		if err != nil {
 			log.Println("ListenAndServe: ", err)
 		}
 	}()
-	flag.Parse()
 
-	var c config.Config
-	conf.MustLoad(*configFile, &c)
-	ctx := svc.NewServiceContext(c)
+	ctx := svc.NewServiceContext(IC.C)
 	svr := server.NewManagerServer(ctx)
 
-	s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
+	s := zrpc.MustNewServer(IC.C.RpcServerConf, func(grpcServer *grpc.Server) {
 		manager.RegisterManagerServer(grpcServer, svr)
 
-		if c.Mode == service.DevMode || c.Mode == service.TestMode {
+		if IC.C.Mode == service.DevMode || IC.C.Mode == service.TestMode {
 			reflection.Register(grpcServer)
 		}
 	})
@@ -50,6 +43,6 @@ func main() {
 	s.AddUnaryInterceptors(util.CustomInterceptors)
 	defer s.Stop()
 
-	fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
+	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)
 	s.Start()
 }

+ 1 - 1
rpc/manager/manager/manager.go

@@ -6,7 +6,7 @@ package manager
 import (
 	"context"
 
-	"jyInfo/rpc/manager/types/manager"
+	"jyInfo/rpc/manager/type/manager"
 
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"

+ 0 - 0
rpc/manager/types/manager/manager.pb.go → rpc/manager/type/manager/manager.pb.go


+ 0 - 0
rpc/manager/types/manager/manager_grpc.pb.go → rpc/manager/type/manager/manager_grpc.pb.go