+114
@@ -0,0 +1,114 @@
|
||||
package ai_image_to_video_ctrl
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/ai_image_to_video_ser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/log"
|
||||
"91porn-server/common/stderr"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// List doc
|
||||
//
|
||||
// @Summary 获取AI图生视频列表列表接口
|
||||
// @Description 获取AI图生视频列表列表
|
||||
// @Tags 移动端-AI图生视频列表
|
||||
// @Accept mpfd,json
|
||||
// @Produce json
|
||||
// @Param q query ai_image_to_video_ser.AppQueryListReq false "请求参数"
|
||||
// @Success 200 object ai_image_to_video_ser.AppListRes "成功"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/app/ai/imagetovideo/list [get]
|
||||
func List(ctx *gin.Context) {
|
||||
p := &ai_image_to_video_ser.AppQueryListReq{}
|
||||
if err := ctx.ShouldBind(&p); err != nil {
|
||||
log.Error(fmt.Sprintf("imagetovideo param err:%v", err))
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 获取用户当前配置
|
||||
var err error
|
||||
p.UID, err = common.GetUID(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
list, err := p.GetList()
|
||||
if err != nil {
|
||||
log.Error(fmt.Sprintf("imagetovideo get list err:%v, uid:%v", err, p.UID))
|
||||
common.ServeJSON(ctx, stderr.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, list)
|
||||
}
|
||||
|
||||
// Generate doc
|
||||
// @Summary 生成AI换脸记录
|
||||
// @Description 生成AI换脸记录
|
||||
// @Tags 移动端-AI图生视频列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param q body ai_image_to_video_ser.GenerateReq false "请求参数"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/app/ai/imagetovideo/generate [post]
|
||||
func Generate(ctx *gin.Context) {
|
||||
uid, err := common.GetUID(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, err)
|
||||
return
|
||||
}
|
||||
|
||||
in := ai_image_to_video_ser.GenerateReq{}
|
||||
if err = ctx.ShouldBind(&in); err != nil {
|
||||
log.Error(fmt.Sprintf("imagetovideo Generate param err:%v\n", err))
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
in.UID = uid
|
||||
ua, _ := common.GetUA(ctx)
|
||||
ip := common.GetIP(ctx)
|
||||
code, err := in.Generate(ua, ip)
|
||||
if err != nil {
|
||||
log.Error(fmt.Sprintf("imagetovideo Generate err:%v\n", err))
|
||||
common.ServeJSON(ctx, code, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, stderr.Success.Msg())
|
||||
}
|
||||
|
||||
// Hide doc
|
||||
// @Summary 删除AI换脸记录
|
||||
// @Description 删除AI换脸记录
|
||||
// @Tags 移动端-AI图生视频列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param q body ai_image_to_video_ser.HideReq false "请求参数"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/app/ai/imagetovideo/hide [post]
|
||||
func Hide(ctx *gin.Context) {
|
||||
uid, err := common.GetUID(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrNoToken, err)
|
||||
return
|
||||
}
|
||||
in := ai_image_to_video_ser.HideReq{}
|
||||
if err = ctx.ShouldBind(&in); err != nil {
|
||||
log.Error(fmt.Sprintf("imagetovideo hide param err:%v\n", err))
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
in.UID = uid
|
||||
err = in.Hide()
|
||||
if err != nil {
|
||||
log.Error(fmt.Sprintf("imagetovideo hide err:%v\n", err))
|
||||
common.ServeJSON(ctx, stderr.Failure, err)
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, stderr.Success.Msg())
|
||||
}
|
||||
Reference in New Issue
Block a user