1
0
mirror of https://github.com/IceWhaleTech/CasaOS.git synced 2025-07-06 23:37:26 +02:00
Files
CasaOS/route/v1/other.go

29 lines
967 B
Go
Raw Normal View History

package v1
import (
"fmt"
"github.com/IceWhaleTech/CasaOS/model"
"github.com/IceWhaleTech/CasaOS/pkg/utils/common_err"
"github.com/IceWhaleTech/CasaOS/service"
2024-06-04 14:14:55 +08:00
"github.com/labstack/echo/v4"
)
2024-06-04 14:14:55 +08:00
func GetSearchResult(ctx echo.Context) error {
2023-02-23 10:38:48 +08:00
json := make(map[string]string)
2024-06-04 14:14:55 +08:00
ctx.Bind(&json)
2023-02-23 10:38:48 +08:00
url := json["url"]
if url == "" {
2024-06-04 14:14:55 +08:00
return ctx.JSON(common_err.CLIENT_ERROR, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS), Data: "key is empty"})
}
2024-06-04 14:14:55 +08:00
// data, err := service.MyService.Other().Search(key)
2023-02-23 10:38:48 +08:00
data, err := service.MyService.Other().AgentSearch(url)
if err != nil {
fmt.Println(err)
2024-06-04 14:14:55 +08:00
return ctx.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.SERVICE_ERROR, Message: common_err.GetMsg(common_err.SERVICE_ERROR), Data: err.Error()})
}
2024-06-04 14:14:55 +08:00
return ctx.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: data})
}