Compare commits
No commits in common. "21b9501be625a399570c63c6f70e6c60828bdac0" and "f1346a604c7314dd4d5cb23b4f02e91dfcf3fc6a" have entirely different histories.
21b9501be6
...
f1346a604c
|
|
@ -165,7 +165,7 @@ qywx:
|
||||||
chat_id_len: 16
|
chat_id_len: 16
|
||||||
default_config_id: 1
|
default_config_id: 1
|
||||||
bot_group_id:
|
bot_group_id:
|
||||||
bbxt: 37
|
bbxt: 23
|
||||||
|
|
||||||
default_prompt:
|
default_prompt:
|
||||||
img_recognize:
|
img_recognize:
|
||||||
|
|
|
||||||
|
|
@ -148,17 +148,6 @@ dingtalk:
|
||||||
bot_group_id:
|
bot_group_id:
|
||||||
bbxt: 23
|
bbxt: 23
|
||||||
|
|
||||||
qywx:
|
|
||||||
corp_id: "ww48151f694fb8ec67"
|
|
||||||
app_secret: "uYqtdwdtdH4Uv_P4is2AChuGzBCoB6cQDyRvpbW0Vmk"
|
|
||||||
token: "zJdukry6"
|
|
||||||
aes_key: "4VLH47qRGUogc2d3QLWuUhvJlk8Y0YuRjXzeBquBq8B"
|
|
||||||
init_account: "les.,FuZhongYun"
|
|
||||||
chat_id_len: 16
|
|
||||||
default_config_id: 1
|
|
||||||
bot_group_id:
|
|
||||||
bbxt: 36
|
|
||||||
|
|
||||||
|
|
||||||
default_prompt:
|
default_prompt:
|
||||||
img_recognize:
|
img_recognize:
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ qywx:
|
||||||
chat_id_len: 16
|
chat_id_len: 16
|
||||||
default_config_id: 1
|
default_config_id: 1
|
||||||
bot_group_id:
|
bot_group_id:
|
||||||
bbxt: 36
|
bbxt: 35
|
||||||
|
|
||||||
default_prompt:
|
default_prompt:
|
||||||
img_recognize:
|
img_recognize:
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,11 @@ package biz
|
||||||
import (
|
import (
|
||||||
"ai_scheduler/internal/biz/handle/qywx"
|
"ai_scheduler/internal/biz/handle/qywx"
|
||||||
"ai_scheduler/internal/data/constants"
|
"ai_scheduler/internal/data/constants"
|
||||||
errors "ai_scheduler/internal/data/error"
|
|
||||||
"ai_scheduler/internal/data/impl"
|
"ai_scheduler/internal/data/impl"
|
||||||
"ai_scheduler/internal/data/model"
|
"ai_scheduler/internal/data/model"
|
||||||
"ai_scheduler/internal/pkg"
|
"ai_scheduler/internal/pkg"
|
||||||
"ai_scheduler/internal/pkg/l_request"
|
|
||||||
"ai_scheduler/internal/tools/bbxt"
|
"ai_scheduler/internal/tools/bbxt"
|
||||||
"context"
|
"context"
|
||||||
"log"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -108,59 +105,3 @@ func (q *QywxAppBiz) SendReport(ctx context.Context, groupInfo *model.AiBotGroup
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendReportV2 发送到货易通指定的群聊
|
|
||||||
func (q *QywxAppBiz) SendReportHYT(ctx context.Context, groupInfo *model.AiBotGroupQywx, report *bbxt.ReportRes) (err error) {
|
|
||||||
// 文本消息
|
|
||||||
err = q.sendReportHYT(groupInfo, &bbxt.ReportRes{
|
|
||||||
Title: report.Title,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
time.Sleep(1 * time.Second) // 等待1秒,避免被频控
|
|
||||||
|
|
||||||
// 图片消息
|
|
||||||
err = q.sendReportHYT(groupInfo, &bbxt.ReportRes{
|
|
||||||
ReportName: report.ReportName,
|
|
||||||
Url: report.Url,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
time.Sleep(1 * time.Second) // 等待1秒,避免被频控
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *QywxAppBiz) sendReportHYT(groupInfo *model.AiBotGroupQywx, report *bbxt.ReportRes) (err error) {
|
|
||||||
req := l_request.Request{
|
|
||||||
Method: "POST",
|
|
||||||
Url: "https://hyt.86698.cn/admin_upload/api/v1/sendWxCommon",
|
|
||||||
Headers: map[string]string{
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
Json: map[string]interface{}{
|
|
||||||
"room_id": groupInfo.ChatID, // 群ID
|
|
||||||
"oss_url": report.Url, // 图片URL
|
|
||||||
"file_type": 2, // 文件类型,2:图片
|
|
||||||
"file_name": report.ReportName, // 文件名称
|
|
||||||
"content": report.Title, // 输入文本,此处有值就走文本发送,没有就走文件发送
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := req.Send()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if resp.StatusCode != 200 {
|
|
||||||
return errors.SysErrf("发送到货易通群聊失败,状态码:%d", resp.StatusCode)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 记录相应结果日志
|
|
||||||
log.Printf("发送到货易通群聊成功,状态码:%d, 响应体:%s", resp.StatusCode, resp.Text)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,5 @@ func run() {
|
||||||
botGroupQywxImpl := impl.NewBotGroupQywxImpl(db)
|
botGroupQywxImpl := impl.NewBotGroupQywxImpl(db)
|
||||||
qywxAuth := qywx.NewAuth(configConfig, rdb)
|
qywxAuth := qywx.NewAuth(configConfig, rdb)
|
||||||
group := qywx.NewGroup(botGroupQywxImpl, qywxAuth)
|
group := qywx.NewGroup(botGroupQywxImpl, qywxAuth)
|
||||||
other := qywx.NewOther(qywxAuth)
|
qywxAppBiz = NewQywxAppBiz(configConfig, botGroupQywxImpl, group)
|
||||||
qywxAppBiz = NewQywxAppBiz(configConfig, botGroupQywxImpl, group, other)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,7 @@ func (d *CronService) CronReportSendQywx(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, report := range reports {
|
for _, report := range reports {
|
||||||
// err = d.qywxAppBiz.SendReport(ctx, &groupInfo, report)
|
err = d.qywxAppBiz.SendReport(ctx, &groupInfo, report)
|
||||||
err = d.qywxAppBiz.SendReportHYT(ctx, &groupInfo, report)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue