diff --git a/go.mod b/go.mod index 042adbe..62c78fe 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module haitao_watcher go 1.22.2 require ( - gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240513121252-d83795b6d236 + gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240514123648-99c3e85dbc18 github.com/go-resty/resty/v2 v2.13.1 github.com/gofiber/fiber/v3 v3.0.0-beta.2 github.com/golang/glog v1.2.1 diff --git a/go.sum b/go.sum index 85d72f1..b59ed3d 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240513121252-d83795b6d236 h1:1t5dh6l20cexlTqmGesIY2ClqrLBqy+OE8LAVp//JC8= gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240513121252-d83795b6d236/go.mod h1:jQhygETzidSqipdL3N77SJBJVEcvKYxdNDUPfIuHdL8= +gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240514123648-99c3e85dbc18 h1:lTARBVopKcR47VJGzumhNDTmxc0QUpzHnk9AuD/6kfs= +gitea.timerzz.com/kedaya_haitao/common v0.0.0-20240514123648-99c3e85dbc18/go.mod h1:cgLy4gB0z2UZD3kBp1IAemt28dkaKNdt4RC0LNkE1I8= github.com/3andne/restls-client-go v0.1.6 h1:tRx/YilqW7iHpgmEL4E1D8dAsuB0tFF3uvncS+B6I08= github.com/3andne/restls-client-go v0.1.6/go.mod h1:iEdTZNt9kzPIxjIGSMScUFSBrUH6bFRNg0BWlP4orEY= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= diff --git a/pkg/model/response.go b/pkg/model/response.go deleted file mode 100644 index d7e223b..0000000 --- a/pkg/model/response.go +++ /dev/null @@ -1,6 +0,0 @@ -package model - -type ListResponse[E any] struct { - Total int64 `json:"total"` - List []E `json:"list"` -} diff --git a/pkg/pusher/controller.go b/pkg/pusher/controller.go index c29e16d..9c1fc2b 100644 --- a/pkg/pusher/controller.go +++ b/pkg/pusher/controller.go @@ -3,6 +3,7 @@ package pusher import ( "context" "fmt" + "gitea.timerzz.com/kedaya_haitao/common/pkg/web" "github.com/golang/glog" "gorm.io/gorm" "gorm.io/gorm/schema" @@ -93,7 +94,7 @@ type ListPusherInfoRequest struct { All bool `query:"all"` } -func (c *Controller) List(req ListPusherInfoRequest) (resp model.ListResponse[model.Pusher[*options.AnPushOption]], err error) { +func (c *Controller) List(req ListPusherInfoRequest) (resp web.ListResponse[model.Pusher[*options.AnPushOption]], err error) { tx := c.db if req.Keyword != "" { tx = tx.Where("name LIKE ? or remark LIKE ?", fmt.Sprintf("%%%s%%", req.Keyword), fmt.Sprintf("%%%s%%", req.Keyword)) diff --git a/pkg/watcher/controller.go b/pkg/watcher/controller.go index b75eb33..20b0292 100644 --- a/pkg/watcher/controller.go +++ b/pkg/watcher/controller.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "gitea.timerzz.com/kedaya_haitao/common/pkg/proxy" + "gitea.timerzz.com/kedaya_haitao/common/pkg/web" "github.com/golang/glog" "gorm.io/gorm" "gorm.io/gorm/clause" @@ -103,7 +104,7 @@ type ListWatcherInfoRequest struct { Size int `query:"size"` } -func (c *Controller) List(req ListWatcherInfoRequest) (resp model.ListResponse[model.Product], err error) { +func (c *Controller) List(req ListWatcherInfoRequest) (resp web.ListResponse[model.Product], err error) { tx := c.db if req.Keyword != "" { tx = tx.Where("name LIKE ? or remark LIKE ?", fmt.Sprintf("%%%s%%", req.Keyword), fmt.Sprintf("%%%s%%", req.Keyword))