Compare commits
No commits in common. "master" and "feature/fzy/hyt-express" have entirely different histories.
master
...
feature/fz
|
|
@ -6,8 +6,6 @@ import (
|
||||||
"ai_scheduler/internal/services"
|
"ai_scheduler/internal/services"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -103,51 +101,6 @@ func SetupRoutes(app *fiber.App, ChatService *services.ChatService, sessionServi
|
||||||
|
|
||||||
// 外部系统支持
|
// 外部系统支持
|
||||||
r.Post("/support/address/ingest/:platform", supportService.AddressIngest) // 通用收获地址提取
|
r.Post("/support/address/ingest/:platform", supportService.AddressIngest) // 通用收获地址提取
|
||||||
|
|
||||||
// 转发Python服务
|
|
||||||
r.All("/proxy/fingerprint", forwardToPythonService)
|
|
||||||
}
|
|
||||||
|
|
||||||
func forwardToPythonService(c *fiber.Ctx) error {
|
|
||||||
targetURL := "http://192.168.6.115:10086/fingerprint"
|
|
||||||
|
|
||||||
req, err := http.NewRequest(c.Method(), targetURL, c.Context().Request.BodyStream())
|
|
||||||
if err != nil {
|
|
||||||
return c.Status(fiber.StatusInternalServerError).SendString(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
c.Request().Header.VisitAll(func(key, value []byte) {
|
|
||||||
req.Header.Add(string(key), string(value))
|
|
||||||
})
|
|
||||||
|
|
||||||
if c.Context().QueryArgs().Len() > 0 {
|
|
||||||
q := req.URL.Query()
|
|
||||||
c.Context().QueryArgs().VisitAll(func(key, value []byte) {
|
|
||||||
q.Add(string(key), string(value))
|
|
||||||
})
|
|
||||||
req.URL.RawQuery = q.Encode()
|
|
||||||
}
|
|
||||||
|
|
||||||
client := &http.Client{}
|
|
||||||
resp, err := client.Do(req)
|
|
||||||
if err != nil {
|
|
||||||
return c.Status(fiber.StatusBadGateway).SendString(err.Error())
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
for key, values := range resp.Header {
|
|
||||||
for _, value := range values {
|
|
||||||
c.Set(key, value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c.Status(resp.StatusCode)
|
|
||||||
body, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return c.Status(fiber.StatusInternalServerError).SendString(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.Send(body)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func routerSocket(app *fiber.App, chatService *services.ChatService) {
|
func routerSocket(app *fiber.App, chatService *services.ChatService) {
|
||||||
|
|
|
||||||
|
|
@ -368,13 +368,7 @@ func (b *BbxtTools) GetProfitRankingSum(now time.Time) (report *ReportRes, err e
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(data.List) == 0 {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
maxLen := 20
|
|
||||||
if len(data.List) < maxLen {
|
|
||||||
maxLen = len(data.List)
|
|
||||||
}
|
|
||||||
//排序
|
//排序
|
||||||
sort.Slice(data.List, func(i, j int) bool {
|
sort.Slice(data.List, func(i, j int) bool {
|
||||||
return data.List[i].HistoryOneDiff > data.List[j].HistoryOneDiff
|
return data.List[i].HistoryOneDiff > data.List[j].HistoryOneDiff
|
||||||
|
|
@ -382,7 +376,7 @@ func (b *BbxtTools) GetProfitRankingSum(now time.Time) (report *ReportRes, err e
|
||||||
//取前20和后20
|
//取前20和后20
|
||||||
var (
|
var (
|
||||||
total [][]string
|
total [][]string
|
||||||
top = data.List[:maxLen]
|
top = data.List[:20]
|
||||||
bottom = data.List[len(data.List)-20:]
|
bottom = data.List[len(data.List)-20:]
|
||||||
)
|
)
|
||||||
//合并前20和后20
|
//合并前20和后20
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue