You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.3 KiB
Go

package service
import (
"github.com/exhibition-main/api/account"
appconfig "github.com/exhibition-main/internal/config"
"github.com/exhibition-main/internal/msg"
"github.com/exhibition-main/internal/response"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
)
// OnlySend 用户登录操作
func OnlySend(c *gin.Context) {
var req account.SendMsgRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
response.ResponseQuickMsg(c, msg.Fail, msg.INVALID_PARAMS, nil)
return
}
req.Domain = appconfig.Data.System.Domain
req.Scope = "exhibition"
res, err := AccountProvider.OnlySendMsg(c, &req)
if err != nil {
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
return
}
response.ResponseQuickMsg(c, msg.Ok, msg.SUCCESS, res)
return
}
// OnlyCheck 检测
func OnlyCheck(c *gin.Context) {
var req account.CheckMsgRequest
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
response.ResponseQuickMsg(c, msg.Fail, msg.INVALID_PARAMS, nil)
return
}
req.Domain = appconfig.Data.System.Domain
req.Scope = "exhibition"
res, err := AccountProvider.OnlyCheckMsg(c, &req)
if err != nil {
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
return
}
response.ResponseQuickMsg(c, msg.Ok, msg.SUCCESS, res)
return
}