60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
package controller
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
"xiawan/wx/api/req"
|
|
"xiawan/wx/api/service"
|
|
"xiawan/wx/api/vo"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// GetFinderSearchApi 视频号搜索
|
|
func GetFinderSearchApi(ctx *gin.Context) {
|
|
reqModel := new(req.FinderSearchModel)
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
//确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
if !validateData(ctx, &reqModel) {
|
|
return
|
|
}
|
|
result := service.GetFinderSearchService(queryKey, *reqModel)
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// FinderUserPrepareApi 视频号中心
|
|
func FinderUserPrepareApi(ctx *gin.Context) {
|
|
reqModel := new(req.FinderUserPrepareModel)
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
//确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
if !validateData(ctx, &reqModel) {
|
|
return
|
|
}
|
|
result := service.FinderUserPrepareService(queryKey, *reqModel)
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// FinderFollowApi 关注取消
|
|
func FinderFollowApi(ctx *gin.Context) {
|
|
reqModel := new(req.FinderFollowModel)
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
//确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
if !validateData(ctx, &reqModel) {
|
|
return
|
|
}
|
|
result := service.FinderFollowService(queryKey, *reqModel)
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|