27 lines
749 B
Go
27 lines
749 B
Go
package api
|
|
|
|
import (
|
|
"SciencesServer/app/api/website/controller"
|
|
"SciencesServer/app/basic/api"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Message struct{}
|
|
|
|
// Launch 留言发起
|
|
func (*Message) Launch(c *gin.Context) {
|
|
form := &struct {
|
|
Name string `json:"name" form:"name" binding:"required"`
|
|
Mobile string `json:"mobile" form:"mobile" binding:"required"`
|
|
Email string `json:"email" form:"email"`
|
|
Company string `json:"company" form:"company"`
|
|
Content string `json:"content" form:"content" binding:"required"`
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
err := controller.NewMessage()().Form(form.Name, form.Mobile, form.Email, form.Company, form.Content)
|
|
api.APIResponse(err)(c)
|
|
}
|