Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
2d974f2e03 | |
|
|
b7e9ab8bcf |
|
|
@ -138,7 +138,7 @@ eino_tools:
|
|||
# == 通用工具 ==
|
||||
# 表格转图片
|
||||
excel2pic:
|
||||
base_url: "http://excel2pic:8000/api/v1/convert"
|
||||
base_url: "http://192.168.6.109:8010/api/v1/convert"
|
||||
|
||||
dingtalk:
|
||||
api_key: "dingsbbntrkeiyazcfdg"
|
||||
|
|
|
|||
|
|
@ -332,7 +332,9 @@ func (d *DingTalkBotBiz) HandleStreamRes(ctx context.Context, data *chatbot.BotC
|
|||
}
|
||||
|
||||
func (d *DingTalkBotBiz) SendReport(ctx context.Context, groupInfo *model.AiBotGroup, report *bbxt.ReportRes) (err error) {
|
||||
|
||||
if report == nil {
|
||||
return errors.New("report is nil")
|
||||
}
|
||||
reportChan := make(chan string, 10)
|
||||
defer close(reportChan)
|
||||
reportChan <- report.Title
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package biz
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_report(t *testing.T) {
|
||||
run()
|
||||
chatId, err := groupConfigBiz.GetReportLists(context.Background(), nil)
|
||||
t.Log(chatId, err)
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import (
|
|||
"ai_scheduler/internal/pkg/l_request"
|
||||
"ai_scheduler/internal/tools/bbxt"
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -111,6 +112,10 @@ func (q *QywxAppBiz) SendReport(ctx context.Context, groupInfo *model.AiBotGroup
|
|||
|
||||
// SendReportV2 发送到货易通指定的群聊
|
||||
func (q *QywxAppBiz) SendReportHYT(ctx context.Context, groupInfo *model.AiBotGroupQywx, report *bbxt.ReportRes) (err error) {
|
||||
|
||||
if report == nil {
|
||||
return fmt.Errorf("report is nil")
|
||||
}
|
||||
// 文本消息
|
||||
err = q.sendReportHYT(groupInfo, &bbxt.ReportRes{
|
||||
Title: report.Title,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,17 @@ package biz
|
|||
|
||||
import (
|
||||
"ai_scheduler/internal/biz/handle/qywx"
|
||||
"ai_scheduler/internal/biz/tools_regis"
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/data/impl"
|
||||
"ai_scheduler/internal/domain/component"
|
||||
"ai_scheduler/internal/domain/component/callback"
|
||||
"ai_scheduler/internal/domain/repo"
|
||||
"ai_scheduler/internal/domain/workflow"
|
||||
"ai_scheduler/internal/pkg"
|
||||
"ai_scheduler/internal/pkg/lsxd"
|
||||
"ai_scheduler/internal/pkg/utils_ollama"
|
||||
"ai_scheduler/internal/pkg/utils_oss"
|
||||
"ai_scheduler/utils"
|
||||
"context"
|
||||
"testing"
|
||||
|
|
@ -16,8 +25,9 @@ func Test_InitGroup(t *testing.T) {
|
|||
}
|
||||
|
||||
var (
|
||||
configConfig *config.Config
|
||||
qywxAppBiz *QywxAppBiz
|
||||
configConfig *config.Config
|
||||
qywxAppBiz *QywxAppBiz
|
||||
groupConfigBiz *GroupConfigBiz
|
||||
)
|
||||
|
||||
func run() {
|
||||
|
|
@ -28,6 +38,21 @@ func run() {
|
|||
botGroupQywxImpl := impl.NewBotGroupQywxImpl(db)
|
||||
qywxAuth := qywx.NewAuth(configConfig, rdb)
|
||||
group := qywx.NewGroup(botGroupQywxImpl, qywxAuth)
|
||||
sessionImpl := impl.NewSessionImpl(db)
|
||||
other := qywx.NewOther(qywxAuth)
|
||||
repos := repo.NewRepos(sessionImpl, configConfig, rdb)
|
||||
pkgRdb := pkg.NewRdb(configConfig)
|
||||
redisManager := callback.NewRedisManager(pkgRdb)
|
||||
login := lsxd.NewLogin(configConfig, rdb)
|
||||
components := component.NewComponents(redisManager, login)
|
||||
repos = repo.NewRepos(sessionImpl, configConfig, rdb)
|
||||
botToolsImpl := impl.NewBotToolsImpl(db)
|
||||
toolRegis := tools_regis.NewToolsRegis(botToolsImpl)
|
||||
utils_ossClient, _ := utils_oss.NewClient(configConfig)
|
||||
client, _, _ := utils_ollama.NewClient(configConfig)
|
||||
|
||||
registry := workflow.NewRegistry(configConfig, client, repos, components)
|
||||
botGroupConfigImpl := impl.NewBotGroupConfigImpl(db)
|
||||
qywxAppBiz = NewQywxAppBiz(configConfig, botGroupQywxImpl, group, other)
|
||||
groupConfigBiz = NewGroupConfigBiz(toolRegis, utils_ossClient, botGroupConfigImpl, registry, configConfig)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ func (c *CronServer) InitJobs(ctx context.Context) {
|
|||
c.jobs = []*cronJob{
|
||||
{
|
||||
Func: c.cronService.CronReportSendDingTalk,
|
||||
Name: "直连天下报表推送",
|
||||
Schedule: "0 12,18,23 * * *",
|
||||
Name: "直连天下报表推送(钉钉)",
|
||||
Schedule: "20 12,18,23 * * *",
|
||||
},
|
||||
{
|
||||
Func: c.cronService.CronReportSendQywx,
|
||||
Name: "直连天下报表推送",
|
||||
Schedule: "0 12,18,23 * * *",
|
||||
Name: "直连天下报表推送(微信)",
|
||||
Schedule: "20 12,18,23 * * *",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func Test_StatisOursProductLossSumApiTotal(t *testing.T) {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
o, err := NewBbxtTools()
|
||||
o, err := NewBbxtTools(nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ func Test_StatisOursProductLossSumApiTotal(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_StatisOursProductLossSum(t *testing.T) {
|
||||
o, err := NewBbxtTools()
|
||||
o, err := NewBbxtTools(nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ func Test_StatisOursProductLossSum(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_GetProfitRankingSum(t *testing.T) {
|
||||
o, err := NewBbxtTools()
|
||||
o, err := NewBbxtTools(nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -56,20 +56,21 @@ func Test_GetProfitRankingSum(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_GetStatisOfficialProductSumDecline(t *testing.T) {
|
||||
o, err := NewBbxtTools()
|
||||
o, err := NewBbxtTools(nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
s := "官方--腾讯-周卡,官方--腾讯-月卡,官方--腾讯-季卡,官方--腾讯-年卡,官方--优酷周卡,官方--优酷月卡,官方--优酷季卡,官方--优酷年卡,官方--爱奇艺-周卡,官方--爱奇艺-月卡,官方--爱奇艺-季卡,官方--爱奇艺-年卡,官方--芒果-PC周卡,官方--芒果-PC月卡,官方--芒果-PC季卡,官方--美团外卖红包5元,官方--美团外卖红包10元,官方--QQ音乐-绿钻月卡,官方--饿了么超级会员月卡,官方--网易云黑胶vip月卡,官方--喜马拉雅巅峰会员月卡"
|
||||
//s := "官方--QQ音乐-绿钻月卡"
|
||||
report, err := o.GetStatisOfficialProductSumDecline(time.Now(), 1000, strings.Split(s, ","), -150)
|
||||
now := time.Now()
|
||||
report, err := o.GetStatisOfficialProductSumDecline(time.Date(now.Year(), now.Month(), now.Day(), 12, 0, 0, 0, now.Location()), 1000, strings.Split(s, ","), -150)
|
||||
|
||||
t.Log(report, err)
|
||||
|
||||
}
|
||||
|
||||
func Test_GetStatisOfficialProductSum(t *testing.T) {
|
||||
o, err := NewBbxtTools()
|
||||
o, err := NewBbxtTools(nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue