475 lines
12 KiB
Go
475 lines
12 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"
|
|
)
|
|
|
|
// AutoRedApi 自动抢红包
|
|
func AutoRedApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
//确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.AutoRedRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealAutoRed(¶ms)
|
|
// 调用服务逻辑处理
|
|
result := service.AutoRedRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// TransferApi 自动接收转账
|
|
func TransferApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.AutoTransferRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealTransfer(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.TransferRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// DelayRedApi 延迟领取红包
|
|
func DelayRedApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.DelayRedRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealDelayRed(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.DelayRedRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// DelayTransferApi 延迟接收转账
|
|
func DelayTransferApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.DelayAutoTransferRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealDelayTransfer(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.DelayTransferRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// KeywordAvoidanceApi 关键字包不抢
|
|
func KeywordAvoidanceApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.KeywordAvoidanceRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealKeywordAvoidance(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.KeywordAvoidanceRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// AutoLikeApi 自动点赞
|
|
func AutoLikeApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.AutoLikeRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealAutoLike(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.AutoLikeRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// AutoForwardApi 朋友圈跟随转发
|
|
func AutoForwardApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.AutoForwardRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealAutoForward(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.AutoForwardRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// FavoriteForwardApi 朋友圈收藏转发
|
|
func FavoriteForwardApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.FavoriteForwardRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealFavoriteForward(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.FavoriteForwardRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// AutoCommentApi 朋友圈自动评论
|
|
func AutoCommentApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.AutoCommentRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealAutoComment(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.AutoCommentRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// MomentsApi 定时发朋友圈
|
|
func MomentsApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.MomentsRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealMoments(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.MomentsRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// MomentsPostApi 发大视频朋友圈
|
|
func MomentsPostApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.MomentsPostRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealMomentsPost(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.MomentsPostRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// WelcomeNewMemberApi 欢迎新人入群
|
|
func WelcomeNewMemberApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.WelcomeNewMemberRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealWelcomeNewMember(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.WelcomeNewMemberRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// KeywordKickApi 关键词自动踢人
|
|
func KeywordKickApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.KeywordKickRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealKeywordKick(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.KeywordKickRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// KeywordAutoReplyApi 关键词自动回复
|
|
func KeywordAutoReplyApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.KeywordAutoReplyRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealKeywordAutoReply(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.KeywordAutoReplyRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// MessageForwardingApi 万群同步
|
|
func MessageForwardingApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
// 确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.MessageForwardingRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealMessageForwarding(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.MessageForwardingRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|
|
|
|
// AutoApproveApi 自动通过好友
|
|
func AutoApproveApi(ctx *gin.Context) {
|
|
queryKey, isExist := ctx.GetQuery("key")
|
|
if !isExist || strings.Trim(queryKey, "") == "" || strings.Trim(queryKey, "") == "null" {
|
|
//确保每次都有Key
|
|
ctx.JSON(http.StatusOK, vo.NewFailUUId(""))
|
|
return
|
|
}
|
|
|
|
// 定义请求模型并绑定参数
|
|
var params req.AutoApproveRequestModel
|
|
if err := ctx.ShouldBindJSON(¶ms); err != nil {
|
|
ctx.JSON(http.StatusBadRequest, gin.H{
|
|
"message": "参数解析错误",
|
|
"error": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 参数完整性、安全性处理
|
|
req.DealAutoApprove(¶ms)
|
|
|
|
// 调用服务逻辑处理
|
|
result := service.AutoApproveRequestService(queryKey, params)
|
|
|
|
// 返回处理结果
|
|
ctx.JSON(http.StatusOK, result)
|
|
}
|