68 lines
1.7 KiB
Go
68 lines
1.7 KiB
Go
package video_activity_ctrl
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"91porn-server/common"
|
|
"91porn-server/common/log"
|
|
"91porn-server/common/stderr"
|
|
"91porn-server/web/service/video_activity_service"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// Submit 提交
|
|
func Submit(c *gin.Context) {
|
|
var in *video_activity_service.SubmitCond
|
|
if err := c.ShouldBind(&in); err != nil {
|
|
common.ServeJSON(c, stderr.ErrParamError, "web video_activity Submit arg error "+err.Error())
|
|
return
|
|
}
|
|
if code := video_activity_service.Submit(in); code != stderr.Success {
|
|
common.ServeJSON(c, code, nil)
|
|
return
|
|
}
|
|
common.ServeJSON(c, stderr.Success, "success")
|
|
}
|
|
|
|
// Edit 修改
|
|
func Edit(c *gin.Context) {
|
|
var in *video_activity_service.EditCond
|
|
if err := c.ShouldBind(&in); err != nil {
|
|
common.ServeJSON(c, stderr.ErrParamError, "web video_activity Edit arg error "+err.Error())
|
|
return
|
|
}
|
|
if code := video_activity_service.Edit(in); code != stderr.Success {
|
|
common.ServeJSON(c, code, nil)
|
|
return
|
|
}
|
|
common.ServeJSON(c, stderr.Success, "success")
|
|
}
|
|
|
|
// QueryAll 查询
|
|
func QueryAll(c *gin.Context) {
|
|
var in *video_activity_service.QueryAllCond
|
|
log.Info("进入这里")
|
|
if err := c.ShouldBindQuery(&in); err != nil {
|
|
common.ServeJSON(c, stderr.ErrParamError, "web video_activity QueryAll arg error "+err.Error())
|
|
return
|
|
}
|
|
data, code := video_activity_service.QueryAll(in)
|
|
if code != stderr.Success {
|
|
log.Info(fmt.Sprintf("%v\n%d", data, code))
|
|
common.ServeJSON(c, code, nil)
|
|
return
|
|
}
|
|
log.Info(fmt.Sprintf("%v\n%d", data, code))
|
|
common.ServeJSON(c, code, data)
|
|
}
|
|
|
|
func Box(c *gin.Context) {
|
|
data, code := video_activity_service.Box()
|
|
if code != stderr.Success {
|
|
common.ServeJSON(c, code, nil)
|
|
return
|
|
}
|
|
common.ServeJSON(c, code, data)
|
|
}
|