78 lines
2.0 KiB
Go
78 lines
2.0 KiB
Go
package web_app
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"videoweb/pub/common"
|
|
"videoweb/pub/common/log"
|
|
"videoweb/pub/common/srvdef"
|
|
"videoweb/pub/pubdef"
|
|
"videoweb/web/service/srv_app"
|
|
)
|
|
|
|
func AppSyncReq(c *gin.Context) {
|
|
var in srv_app.AppVideoInfoSyncReq
|
|
if err := c.ShouldBindJSON(&in); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, nil)
|
|
return
|
|
}
|
|
if in.AppId != pubdef.AppId {
|
|
common.ServerJSON(c, srvdef.APPIDError, nil)
|
|
}
|
|
data, err := srv_app.AppVideoInfoSync(c, &in)
|
|
if err != nil {
|
|
log.Error("AppSyncReq AppVideoInfoSyncReq Failed", log.Any("err", err))
|
|
common.ServerJSON(c, err.Code, "")
|
|
return
|
|
}
|
|
|
|
common.ServerJSON(c, srvdef.Success, data)
|
|
}
|
|
|
|
func AppCollectionSyncReq(c *gin.Context) {
|
|
var in srv_app.AppVideoCollectionSyncReq
|
|
if err := c.ShouldBindJSON(&in); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, nil)
|
|
return
|
|
}
|
|
if in.AppId != pubdef.AppId {
|
|
common.ServerJSON(c, srvdef.APPIDError, nil)
|
|
}
|
|
data, err := srv_app.AppVideoCollectionSync(c, &in)
|
|
if err != nil {
|
|
log.Error("AppCollectionSyncReq AppVideoCollectionSync Failed", log.Any("err", err))
|
|
common.ServerJSON(c, err.Code, "")
|
|
return
|
|
}
|
|
|
|
common.ServerJSON(c, srvdef.Success, data)
|
|
}
|
|
|
|
func AppGetVideoCategory(c *gin.Context) {
|
|
data, err := srv_app.AppCategoryList(c)
|
|
if err != nil {
|
|
log.Error("AppGetVideoCategory AppCategoryList Failed", log.Any("err", err))
|
|
common.ServerJSON(c, err.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, data)
|
|
}
|
|
|
|
func AppGetVideoCreator(c *gin.Context) {
|
|
data, err := srv_app.AppCreatorList(c)
|
|
if err != nil {
|
|
log.Error("AppGetVideoCreator AppCategoryList Failed", log.Any("err", err))
|
|
common.ServerJSON(c, err.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, data)
|
|
}
|
|
|
|
func AppGetVideoTag(c *gin.Context) {
|
|
data, err := srv_app.AppTagList(c)
|
|
if err != nil {
|
|
log.Error("AppGetVideoTag AppCategoryList Failed", log.Any("err", err))
|
|
common.ServerJSON(c, err.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, data)
|
|
} |