From 39776dfcce3ccc0e832c6e51a1b0a30a003fb6f6 Mon Sep 17 00:00:00 2001 From: fuzhongyun <15339891972@163.com> Date: Wed, 31 Dec 2025 17:01:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E6=89=93=E5=BC=80=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/server/main.go | 2 +- deploy.sh | 1 + internal/biz/ding_talk_bot.go | 14 +++++++++++++- .../recharge/statistics_ours_product/types.go | 14 +++++++------- .../workflow/recharge/statistics_ours_product.go | 8 ++++---- internal/tools/bbxt/bbxt.go | 2 +- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index c0ff4c8..baca30d 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -29,6 +29,6 @@ func main() { //钉钉机器人 app.DingBotServer.Run(ctx, *onBot) //定时任务 - //app.Cron.Run(ctx) + app.Cron.Run(ctx) log.Fatal(app.HttpServer.Listen(fmt.Sprintf(":%d", bc.Server.Port))) } diff --git a/deploy.sh b/deploy.sh index 2e1e972..3a829de 100644 --- a/deploy.sh +++ b/deploy.sh @@ -36,6 +36,7 @@ docker run -itd \ -e "OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434}" \ -e "MODE=${MODE}" \ -p 8090:8090 \ + -v ./cache:/app/cache \ "${CONTAINER_NAME}" ./server --config "./${CONFIG_FILE}" --bot "${BOT}" docker logs -f ${CONTAINER_NAME} \ No newline at end of file diff --git a/internal/biz/ding_talk_bot.go b/internal/biz/ding_talk_bot.go index 40f99fb..0475021 100644 --- a/internal/biz/ding_talk_bot.go +++ b/internal/biz/ding_talk_bot.go @@ -629,7 +629,11 @@ func (d *DingTalkBotBiz) GetReportLists(ctx context.Context, group *model.AiBotG } // 追加电商充值系统统计 - 返回统一使用 []*bbxt.ReportRes - rechargeReports, err := d.rechargeDailyReport(ctx, time.Now(), []string{"官方-爱奇艺-星钻季卡", "官方-爱奇艺-星钻半年卡", "官方--腾讯-年卡", "官方--爱奇艺-月卡"}, d.ossClient) + rechargeReports, err := d.rechargeDailyReport(ctx, time.Now(), product, d.ossClient) + if err != nil || len(rechargeReports) == 0 { + return + } + reports = append(reports, rechargeReports...) return @@ -637,6 +641,12 @@ func (d *DingTalkBotBiz) GetReportLists(ctx context.Context, group *model.AiBotG // rechargeDailyReport 获取电商充值系统统计报告 func (d *DingTalkBotBiz) rechargeDailyReport(ctx context.Context, now time.Time, productNames []string, ossClient *utils_oss.Client) (reports []*bbxt.ReportRes, err error) { + defer func() { + if err := recover(); err != nil { + log.Error(err) + } + }() + workflowId := recharge.WorkflowIDStatisticsOursProduct args := &runtime.WorkflowArgs{ Args: map[string]any{ @@ -649,6 +659,8 @@ func (d *DingTalkBotBiz) rechargeDailyReport(ctx context.Context, now time.Time, return } + log.Infof("imgUrl: %s", res["url"].(string)) + reports = []*bbxt.ReportRes{ { ReportName: "我们的商品统计(电商充值系统)", diff --git a/internal/domain/tools/recharge/statistics_ours_product/types.go b/internal/domain/tools/recharge/statistics_ours_product/types.go index 624406b..3d8e86d 100644 --- a/internal/domain/tools/recharge/statistics_ours_product/types.go +++ b/internal/domain/tools/recharge/statistics_ours_product/types.go @@ -19,12 +19,12 @@ type StatisticsOursProductResponse struct { type StatisticsOursProductItem struct { OursProductId int `json:"ours_product_id"` ResellerId int `json:"reseller_id"` - TotalPrice string `json:"total_price"` - Count string `json:"count"` - SuccessCount string `json:"success_count"` - SuccessPrice string `json:"success_price"` - FailCount string `json:"fail_count"` - FailPrice string `json:"fail_price"` - Profit string `json:"profit"` + TotalPrice any `json:"total_price"` + Count any `json:"count"` + SuccessCount any `json:"success_count"` + SuccessPrice any `json:"success_price"` + FailCount any `json:"fail_count"` + FailPrice any `json:"fail_price"` + Profit any `json:"profit"` OursProductName string `json:"ours_product_name"` } diff --git a/internal/domain/workflow/recharge/statistics_ours_product.go b/internal/domain/workflow/recharge/statistics_ours_product.go index b3917f4..8ca32c2 100644 --- a/internal/domain/workflow/recharge/statistics_ours_product.go +++ b/internal/domain/workflow/recharge/statistics_ours_product.go @@ -182,13 +182,13 @@ func (w *statisticsOursProduct) convertDataToExcelFormat(data []statistics_ours_ row := []string{ item.OursProductName, // fmt.Sprintf("%d", item.OursProductId), - item.Count, + fmt.Sprintf("%v", item.Count), // item.TotalPrice, // item.SuccessCount, - item.SuccessPrice, + fmt.Sprintf("%v", item.SuccessPrice), // item.FailCount, - // item.FailPrice, - item.Profit, + // item.FailPrice + fmt.Sprintf("%v", item.Profit), } result = append(result, row) diff --git a/internal/tools/bbxt/bbxt.go b/internal/tools/bbxt/bbxt.go index cb3ebba..9bc400e 100644 --- a/internal/tools/bbxt/bbxt.go +++ b/internal/tools/bbxt/bbxt.go @@ -21,7 +21,7 @@ var resellerBlackList = []string{ "悦跑", "电商-独立", "蓝星严选连续包月", - "通钱", + "通钱-2025年12月", } type BbxtTools struct {