79 lines
2.0 KiB
Go
79 lines
2.0 KiB
Go
|
package api
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"github.com/goWxHook/goWxHook/core"
|
||
|
"github.com/goWxHook/goWxHook/utils"
|
||
|
)
|
||
|
|
||
|
// getCollectList
|
||
|
//
|
||
|
// @Summary 获取收藏列表
|
||
|
// @Description 获取收藏列表接口
|
||
|
// @Tags 收藏
|
||
|
// @Accept json
|
||
|
// @Produce json
|
||
|
// @Response 200 {object} CommonStringResponse{Data=core.GetCollectListResponseData} "{\"code\":0, ....}
|
||
|
// @Router /api/v1/collect/list [get]
|
||
|
func (w *WebApi) getCollectList(c *gin.Context) {
|
||
|
list, err := w.WxApi.GetCollectList()
|
||
|
if err != nil {
|
||
|
utils.ResponseError(c, err.Error(), nil)
|
||
|
return
|
||
|
}
|
||
|
utils.ResponseOK(c, "success", list)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// sendCollect
|
||
|
//
|
||
|
// @Summary 发送收藏(旧)
|
||
|
// @Description 发送收藏(旧)接口
|
||
|
// @Tags 收藏
|
||
|
// @Accept json
|
||
|
// @Produce json
|
||
|
// @Param body body core.SendCollectRequest true "收藏信息"
|
||
|
// @Response 200 {object} CommonStringResponse "{\"code\":0, ....}
|
||
|
// @Router /api/v1/collect/send [post]
|
||
|
func (w *WebApi) sendCollect(c *gin.Context) {
|
||
|
var form core.SendCollectRequest
|
||
|
err := c.ShouldBindJSON(&form)
|
||
|
if err != nil {
|
||
|
utils.ResponseError(c, err.Error(), nil)
|
||
|
return
|
||
|
}
|
||
|
err = w.WxApi.SendCollect(form)
|
||
|
if err != nil {
|
||
|
utils.ResponseError(c, err.Error(), nil)
|
||
|
return
|
||
|
}
|
||
|
utils.ResponseOK(c, "success", nil)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// sendCollectMsgByMsgId
|
||
|
//
|
||
|
// @Summary 收藏指定消息(旧)
|
||
|
// @Description 收藏指定消息(旧)接口
|
||
|
// @Tags 收藏
|
||
|
// @Accept json
|
||
|
// @Produce json
|
||
|
// @Param body body core.SendCollectMsgByMsgIdRequest true "消息"
|
||
|
// @Response 200 {object} CommonStringResponse "{\"code\":0, ....}
|
||
|
// @Router /api/v1/collect/send/msgid [post]
|
||
|
func (w *WebApi) sendCollectMsgByMsgId(c *gin.Context) {
|
||
|
var form core.SendCollectMsgByMsgIdRequest
|
||
|
err := c.ShouldBindJSON(&form)
|
||
|
if err != nil {
|
||
|
utils.ResponseError(c, err.Error(), nil)
|
||
|
return
|
||
|
}
|
||
|
err = w.WxApi.SendCollectMsgByMsgId(form)
|
||
|
if err != nil {
|
||
|
utils.ResponseError(c, err.Error(), nil)
|
||
|
return
|
||
|
}
|
||
|
utils.ResponseOK(c, "success", nil)
|
||
|
return
|
||
|
}
|