From d843145c0e9f1f4e001adb2a95cf097345ef1c3e Mon Sep 17 00:00:00 2001 From: workabee <2950914812@qq.com> Date: Mon, 19 Feb 2024 10:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/dev/config.yaml | 12 ++--- conf/dev/dubbogo.yaml | 8 ++-- conf/prod/config.yaml | 12 ++--- conf/prod/dubbogo.yaml | 8 ++-- conf/test/config.yaml | 12 ++--- conf/test/dubbogo.yaml | 90 ++++++++++++++++++------------------ pkg/service/common/common.go | 16 +++---- 7 files changed, 82 insertions(+), 76 deletions(-) diff --git a/conf/dev/config.yaml b/conf/dev/config.yaml index 4b911f9..3d9ffd4 100644 --- a/conf/dev/config.yaml +++ b/conf/dev/config.yaml @@ -26,10 +26,10 @@ jwt: key: "3Ei*^!a6^6$w^wgK" expire: 24 bos: - Ak: "ALTAKxrqOQHnAN525Tb2GX4Bhe" - Sk: "d2ecaa9d75114d3b9f42b99014198306" + AccessKeyId: "ALTAKxrqOQHnAN525Tb2GX4Bhe" + AccessKeySecret: "d2ecaa9d75114d3b9f42b99014198306" BucketName: "dci-file-new" - BosUrl: ".bj.bcebos.com" - BosBaseDir: "fonchain-main" - BosHttp: "https://" - BosDomain: "cdns.fontree.cn" \ No newline at end of file + Endpoint: ".bj.bcebos.com" + BosBaseDir: "exhibition" + Host: "https://bj.bcebos.com" + CdnHost: "https://cdns.fontree.cn" \ No newline at end of file diff --git a/conf/dev/dubbogo.yaml b/conf/dev/dubbogo.yaml index 057c77c..e53ca1d 100644 --- a/conf/dev/dubbogo.yaml +++ b/conf/dev/dubbogo.yaml @@ -13,16 +13,18 @@ dubbo: references: AccountClientImpl: protocol: tri - interface: com.fontree.microservices.common.Account - filter: cshutdown,sign,fonDomainFilter,fonValidateFilter - timeout: 15s retries: 0 + interface: com.fontree.microservices.common.Account + filter: cshutdown,sign params: .accessKeyId: "Accountksl" .secretAccessKey: "BSDY-FDF1-Fontree_account" ExhibitionClientImpl: protocol: tri interface: com.fontree.microservices.common.Exhibition + ArtistClientImpl: + protocol: tri + interface: com.fontree.microservices.common.Artist logger: zap-config: level: error # 日志级别 diff --git a/conf/prod/config.yaml b/conf/prod/config.yaml index 36f257e..b16f94a 100644 --- a/conf/prod/config.yaml +++ b/conf/prod/config.yaml @@ -26,10 +26,10 @@ jwt: key: "tP0xXGErz4~" expire: 24 bos: - Ak: "ALTAKxrqOQHnAN525Tb2GX4Bhe" - Sk: "d2ecaa9d75114d3b9f42b99014198306" + AccessKeyId: "ALTAKxrqOQHnAN525Tb2GX4Bhe" + AccessKeySecret: "d2ecaa9d75114d3b9f42b99014198306" BucketName: "dci-file-new" - BosUrl: ".bj.bcebos.com" - BosBaseDir: "fonchain-main" - BosHttp: "https://" - BosDomain: "cdns.fontree.cn" \ No newline at end of file + Endpoint: ".bj.bcebos.com" + BosBaseDir: "exhibition" + Host: "https://bj.bcebos.com" + CdnHost: "https://cdns.fontree.cn" \ No newline at end of file diff --git a/conf/prod/dubbogo.yaml b/conf/prod/dubbogo.yaml index 1d54c41..0e9ed69 100644 --- a/conf/prod/dubbogo.yaml +++ b/conf/prod/dubbogo.yaml @@ -13,16 +13,18 @@ dubbo: references: AccountClientImpl: protocol: tri - interface: com.fontree.microservices.common.Account - filter: cshutdown,sign,fonDomainFilter,fonValidateFilter - timeout: 15s retries: 0 + interface: com.fontree.microservices.common.Account + filter: cshutdown,sign params: .accessKeyId: "Accountksl" .secretAccessKey: "BSDY-FDF1-Fontree_account" ExhibitionClientImpl: protocol: tri interface: com.fontree.microservices.common.Exhibition + ArtistClientImpl: + protocol: tri + interface: com.fontree.microservices.common.Artist logger: zap-config: level: error # 日志级别 diff --git a/conf/test/config.yaml b/conf/test/config.yaml index 0e3e09c..d322c86 100644 --- a/conf/test/config.yaml +++ b/conf/test/config.yaml @@ -26,10 +26,10 @@ jwt: key: "SxjwBuEcHg42t73" expire: 24 bos: - Ak: "ALTAKxrqOQHnAN525Tb2GX4Bhe" - Sk: "d2ecaa9d75114d3b9f42b99014198306" + AccessKeyId: "ALTAKxrqOQHnAN525Tb2GX4Bhe" + AccessKeySecret: "d2ecaa9d75114d3b9f42b99014198306" BucketName: "dci-file-new" - BosUrl: ".bj.bcebos.com" - BosBaseDir: "fonchain-main" - BosHttp: "https://" - BosDomain: "cdns.fontree.cn" \ No newline at end of file + Endpoint: ".bj.bcebos.com" + BosBaseDir: "exhibition" + Host: "https://bj.bcebos.com" + CdnHost: "https://cdns.fontree.cn" \ No newline at end of file diff --git a/conf/test/dubbogo.yaml b/conf/test/dubbogo.yaml index 989668b..716dd0d 100644 --- a/conf/test/dubbogo.yaml +++ b/conf/test/dubbogo.yaml @@ -13,54 +13,56 @@ dubbo: references: AccountClientImpl: protocol: tri - interface: com.fontree.microservices.common.Account - filter: cshutdown,sign,fonDomainFilter,fonValidateFilter - timeout: 15s retries: 0 + interface: com.fontree.microservices.common.Account + filter: cshutdown,sign params: .accessKeyId: "Accountksl" .secretAccessKey: "BSDY-FDF1-Fontree_account" ExhibitionClientImpl: protocol: tri interface: com.fontree.microservices.common.Exhibition -# logger: -# zap-config: -# level: error # 日志级别 -# development: false -# disableCaller: false -# disableStacktrace: false -# encoding: "json" -# # zap encoder 配置 -# encoderConfig: -# messageKey: "message" -# levelKey: "level" -# timeKey: "time" -# nameKey: "logger" -# callerKey: "caller" -# stacktraceKey: "stacktrace" -# lineEnding: "" -# levelEncoder: "capitalColor" -# timeEncoder: "iso8601" -# durationEncoder: "seconds" -# callerEncoder: "short" -# nameEncoder: "" -# EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"), -# EncodeDuration: zapcore.SecondsDurationEncoder, -# outputPaths: -# - "stderr" -# errorOutputPaths: -# - "stderr" -# lumberjack-config: -# # 写日志的文件名称 -# filename: "runtime/exhibition-main.log" -# # 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB -# maxSize: 5 -# # 日志保留的最大天数(只保留最近多少天的日志) -# maxAge: 30 -# # 只保留最近多少个日志文件,用于控制程序总日志的大小 -# maxBackups: 30 -# # 是否使用本地时间,默认使用 UTC 时间 -# localTime: true -# # 是否压缩日志文件,压缩方法 gzip -# compress: false -# + ArtistClientImpl: + protocol: tri + interface: com.fontree.microservices.common.Artist + logger: + zap-config: + level: error # 日志级别 + development: false + disableCaller: false + disableStacktrace: false + encoding: "json" + # zap encoder 配置 + encoderConfig: + messageKey: "message" + levelKey: "level" + timeKey: "time" + nameKey: "logger" + callerKey: "caller" + stacktraceKey: "stacktrace" + lineEnding: "" + levelEncoder: "capitalColor" + timeEncoder: "iso8601" + durationEncoder: "seconds" + callerEncoder: "short" + nameEncoder: "" + EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"), + EncodeDuration: zapcore.SecondsDurationEncoder, + outputPaths: + - "stderr" + errorOutputPaths: + - "stderr" + lumberjack-config: + # 写日志的文件名称 + filename: "runtime/exhibition-main.log" + # 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB + maxSize: 5 + # 日志保留的最大天数(只保留最近多少天的日志) + maxAge: 30 + # 只保留最近多少个日志文件,用于控制程序总日志的大小 + maxBackups: 30 + # 是否使用本地时间,默认使用 UTC 时间 + localTime: true + # 是否压缩日志文件,压缩方法 gzip + compress: false + diff --git a/pkg/service/common/common.go b/pkg/service/common/common.go index 10ed065..6f2d87e 100644 --- a/pkg/service/common/common.go +++ b/pkg/service/common/common.go @@ -212,7 +212,7 @@ func GetSnapshot(videoPath, snapshotPath string, frameNum int) (snapshotName str } func PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) { - BOSClient, err := objstorage.NewBOS(config.BosAk, config.BosSk, objstorage.BOS_BJ) + BOSClient, err := objstorage.NewBOS(config.Data.Bos.AccessKeyId, config.Data.Bos.AccessKeySecret, objstorage.BOS_BJ) if err != nil { logger.Errorf("PutBos NewBOS err ", err) err = errors.New(msg.ErrorUploadBos) @@ -235,15 +235,15 @@ func PutBos(filePath string, mediaType string, needRemove bool) (url string, err } } filePath = strings.Replace(filePath, "./runtime", "", 1) - var objectName string = fmt.Sprintf("%s/%s%s", config.BosBaseDir, config.Env, filePath) - _, err = BOSClient.PutObjectFromBytes(config.BosBucketName, objectName, fileBytes) + var objectName string = fmt.Sprintf("%s/%s%s", config.Data.Bos.BosBaseDir, config.Data.System.Mode, filePath) + _, err = BOSClient.PutObjectFromBytes(config.Data.Bos.BucketName, objectName, fileBytes) if err != nil { logger.Errorf("PutBos PutObject err %+v", err.Error()) err = errors.New(msg.ErrorUploadBos) return } //url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName) - url = fmt.Sprintf("%s%s/%s", config.BosHttp, config.BosDomain, objectName) + url = fmt.Sprintf("%s/%s", config.Data.Bos.CdnHost, objectName) return } @@ -258,15 +258,15 @@ func quickBos(file *multipart.FileHeader, mediaType string, mask string, source return } } - var objectName string = fmt.Sprintf("%s/%s/%s", config.BosBaseDir, config.Env, filePath) - BOSClient, _ := objstorage.NewBOS(config.BosAk, config.BosSk, objstorage.BOS_BJ) - _, err = BOSClient.PutObjectFromBytes(config.BosBucketName, objectName, fileBytes) + var objectName string = fmt.Sprintf("%s/%s/%s", config.Data.Bos.BosBaseDir, config.Data.System.Mode, filePath) + BOSClient, _ := objstorage.NewBOS(config.Data.Bos.AccessKeyId, config.Data.Bos.AccessKeySecret, objstorage.BOS_BJ) + _, err = BOSClient.PutObjectFromBytes(config.Data.Bos.BucketName, objectName, fileBytes) if err != nil { logger.Errorf("quickBos err", err) return } //url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName) - url = fmt.Sprintf("%s%s/%s", config.BosHttp, config.BosDomain, objectName) + url = fmt.Sprintf("%s/%s", config.Data.Bos.CdnHost, objectName) return }