From a45323164a234c4c9b8d6be9f8e14a9ffff49748 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 21 May 2024 23:29:59 +0800 Subject: [PATCH 1/3] by Robin at 20240521 --- api/proto/zone_third_partner/proto/zone_third_partner_vo_api.go | 1 + app/mix/service/apiservice.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/api/proto/zone_third_partner/proto/zone_third_partner_vo_api.go b/api/proto/zone_third_partner/proto/zone_third_partner_vo_api.go index 120e5c02..c7c6af74 100644 --- a/api/proto/zone_third_partner/proto/zone_third_partner_vo_api.go +++ b/api/proto/zone_third_partner/proto/zone_third_partner_vo_api.go @@ -8,4 +8,5 @@ import ( type ZoneThirdPartnerApiVO struct { *dbstruct.ZoneThirdPartner Account *accountproto.ApiListOthersVO `json:"third_partner_account"` + IsHided int64 `json:"is_hided"` } diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 0d48d966..e6d96b0b 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3064,6 +3064,7 @@ func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_p ThirdPartnerMid: nil, SharingRatio: nil, }, + IsHided: consts.IsHided_Yes, } return } @@ -3101,6 +3102,7 @@ func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_p vo = &zone_third_partner_proto.ZoneThirdPartnerApiVO{ ZoneThirdPartner: zoneThirdPartner, Account: acctVO, + IsHided: consts.IsHided_No, } return -- 2.41.0 From 8d36ca1d374dec29aca45c4b9cc5630458f35251 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Thu, 23 May 2024 17:11:14 +0800 Subject: [PATCH 2/3] by Robin at 20240523 --- app/mix/cmd/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/mix/cmd/main.go b/app/mix/cmd/main.go index 44a9ed00..87ceaa7b 100644 --- a/app/mix/cmd/main.go +++ b/app/mix/cmd/main.go @@ -9,6 +9,7 @@ import ( "service/api/consts" "service/app/mix/conf" "service/app/mix/controller" + "service/app/mix/mediafiller" "service/app/mix/service" "service/library/apollo" "service/library/configcenter" @@ -78,6 +79,8 @@ func main() { msg := fmt.Sprintf("Service init fail, err: %v", err) PrintAndExit(msg) } + // 初始化媒体填充服务 + mediafiller.Init(cfg.ServerInfo) // 初始化http server router := httpengine.NewRouter() -- 2.41.0 From 124dd84c83fd3c6ecfb5446bee13b446658ae3e6 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Thu, 23 May 2024 22:39:37 +0800 Subject: [PATCH 3/3] by Robin at 20240523 --- app/mix/cmd_offline/main.go | 18 ++++++++++++++++-- app/mix/conf/cfg.go | 1 + app/mix/controller/init.go | 5 ----- app/mix/controller/init_offline.go | 20 ++++++++++++++++++++ etc/mix/mix-prod.yaml | 19 ++++++++++++++++--- etc/mix/mix-test.yaml | 17 +++++++++++++++-- 6 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 app/mix/controller/init_offline.go diff --git a/app/mix/cmd_offline/main.go b/app/mix/cmd_offline/main.go index 41f2afb3..11a6ad56 100644 --- a/app/mix/cmd_offline/main.go +++ b/app/mix/cmd_offline/main.go @@ -3,10 +3,12 @@ package main import ( "fmt" "net" + "net/http" "os" "runtime" "service/api/consts" "service/app/mix/conf" + "service/app/mix/controller" "service/app/mix/mediafiller" "service/app/mix/service" "service/library/apollo" @@ -15,9 +17,12 @@ import ( "service/library/contentaudit/textaudit" videomoderation "service/library/contentaudit/video_moderation" "service/library/dingtalk" + "service/library/httpengine" + "service/library/httpserver" "service/library/logger" "service/library/redis" "service/library/sms" + "service/library/validator" "strings" "time" ) @@ -52,7 +57,7 @@ func main() { } // 初始化日志 - logger.InitLogger(cfg.Log) + logger.InitLogger(cfg.OfflineServer.Log) // 初始化短信服务 err = sms.Init(cfg.Dysmsapi) @@ -100,7 +105,16 @@ func main() { // 初始化媒体填充服务 mediafiller.Init(cfg.ServerInfo) - exec.Run() + // 初始化http server + go exec.Run() + router := httpengine.NewRouter() + validator.InitDefaultNotNullValidator() + controller.InitOffline(router) + srv := &http.Server{ + Addr: fmt.Sprintf("%s:%d", GetIp(), cfg.App.Port), + Handler: router, + } + httpserver.StartHttpServer(srv, cfg.OfflineServer) } func PrintAndExit(msg string) { diff --git a/app/mix/conf/cfg.go b/app/mix/conf/cfg.go index 0d6f77da..0e976526 100644 --- a/app/mix/conf/cfg.go +++ b/app/mix/conf/cfg.go @@ -22,4 +22,5 @@ type ConfigSt struct { DingTalkRobot *configcenter.DingTalkRobotConfig `json:"ding_talk_robot" yaml:"ding_talk_robot"` // 钉钉机器人 VideoModeration *configcenter.VideoModerationConfig `json:"video_moderation" yaml:"video_moderation"` // 视频审核 ElasticSearch *configcenter.ElasticSearchConfig `json:"elastic_search" yaml:"elastic_search"` // es + OfflineServer *configcenter.DefaultConfig `json:"offline_server" yaml:"offline_server"` } diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index 6033048c..09e5065e 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -7,7 +7,6 @@ import ( "net/http" imageaudittaskproto "service/api/proto/imageaudittask/proto" mediaproto "service/api/proto/media/proto" - video_moderation_proto "service/api/proto/video_moderation/proto" zonesessionproto "service/api/proto/zonesession/proto" "service/library/logger" "service/library/middleware" @@ -523,10 +522,6 @@ func Init(r *gin.Engine) { // 空间相关每日报表 opDailyStatementZoneInfoGroup := r.Group("/op/daily_statement_zone_info", PrepareOp()) opDailyStatementZoneInfoGroup.POST("list", middleware.JSONParamValidator(daily_statement_zone_info_proto.OpListReq{}), middleware.JwtAuthenticator(), OpGetDailyStatementZoneInfoList) - - // 视频审核callback - extVideoModerationGroup := r.Group("/ext/video_moderation") - extVideoModerationGroup.POST("callback", middleware.FORMParamValidator(video_moderation_proto.ExtVideoModerationReq{}), VideoModerationCallback) } func ServeFile(ctx *gin.Context) { diff --git a/app/mix/controller/init_offline.go b/app/mix/controller/init_offline.go new file mode 100644 index 00000000..119c1b01 --- /dev/null +++ b/app/mix/controller/init_offline.go @@ -0,0 +1,20 @@ +package controller + +import ( + video_moderation_proto "service/api/proto/video_moderation/proto" + "service/library/middleware" + + "github.com/gin-gonic/gin" +) + +func InitOffline(r *gin.Engine) { + r.HandleMethodNotAllowed = true + + // websocket长链接 + r.GET("/", ServeFile) + r.GET("/ws", HandleWs) + + // 视频审核callback + extVideoModerationGroup := r.Group("/offline_ext/video_moderation") + extVideoModerationGroup.POST("callback", middleware.FORMParamValidator(video_moderation_proto.ExtVideoModerationReq{}), VideoModerationCallback) +} diff --git a/etc/mix/mix-prod.yaml b/etc/mix/mix-prod.yaml index a1b66eb1..663c9eed 100644 --- a/etc/mix/mix-prod.yaml +++ b/etc/mix/mix-prod.yaml @@ -104,7 +104,7 @@ textaudit: video_moderation: access_key_id: "LTAI5tQBGFS9BNiTHdbAAM74" access_key_secret: "vsV42N0ZCtJTQNwFLheCaV8oQn69hQ" - notify_url: "https://api.tiefen.fun/ext/video_moderation/callback" + notify_url: "https://offlineserver.wishpal.cn/offline_ext/video_moderation/callback" ali_acct_id: "1501583627133461" seed: "23XSkaZsMTz3xdnKtTmx229ZaJ3VS7e" @@ -129,7 +129,7 @@ server_info: xxl_job: server_addr: "http://172.16.0.186:9800/xxl-job-admin" access_token: "default_token" - executor_ip: "172.16.0.185" + executor_ip: "172.31.37.66" executor_port: "9801" registry_key: "golang-jobs-executor" log_path: "/app/ironfan/log/xxl_job/" @@ -142,4 +142,17 @@ elastic_search: uri: "http://172.31.37.67:9200" username: "elastic" password: "Wishpal@2024" - sniff: false \ No newline at end of file + sniff: false + +offline_server: + log: + stdout_enable: true + stdout_level: "trace" + file_enable: true + file_level: "trace" + file_abs_path: "/app/ironfan/log/offline-server/" + + app: + app_name: "offline-server" + ip: "127.0.0.1" + port: 9998 \ No newline at end of file diff --git a/etc/mix/mix-test.yaml b/etc/mix/mix-test.yaml index 32145498..8bdca2cf 100644 --- a/etc/mix/mix-test.yaml +++ b/etc/mix/mix-test.yaml @@ -105,7 +105,7 @@ textaudit: video_moderation: access_key_id: "LTAI5tQBGFS9BNiTHdbAAM74" access_key_secret: "vsV42N0ZCtJTQNwFLheCaV8oQn69hQ" - notify_url: "https://api.wishpal.cn/ext/video_moderation/callback" + notify_url: "https://api.wishpal.cn/offline_ext/video_moderation/callback" ali_acct_id: "1501583627133461" seed: "23XSkaZsMTz3xdnKtTmx229ZaJ3VS7e" @@ -143,4 +143,17 @@ elastic_search: uri: "http://127.0.0.1:9200" username: "elastic" password: "Wishpal@2024" - sniff: false \ No newline at end of file + sniff: false + +offline_server: + log: + stdout_enable: true + stdout_level: "trace" + file_enable: true + file_level: "trace" + file_abs_path: "/app/ironfan/log/offline-server/" + + app: + app_name: "offline-server" + ip: "127.0.0.1" + port: 9998 \ No newline at end of file -- 2.41.0