123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- package http
- import (
- "strconv"
- "go-common/app/interface/main/dm2/model"
- "go-common/library/ecode"
- bm "go-common/library/net/http/blademaster"
- "go-common/library/net/http/blademaster/binding"
- )
- func subtitleLanAdd(c *bm.Context) {
- var (
- err error
- v = new(struct {
- Code uint8 `form:"code" validate:"required"`
- Lan string `form:"lan" validate:"required"`
- DocEn string `form:"doc_en" validate:"required"`
- DocZh string `form:"doc_zh" validate:"required"`
- IsDelete bool `form:"is_delete"`
- })
- )
- if err = c.Bind(v); err != nil {
- return
- }
- c.JSON(nil, dmSvc.SubtitleLanOp(c, v.Code, v.Lan, v.DocZh, v.DocEn, v.IsDelete))
- }
- func subtitleFilter(c *bm.Context) {
- var (
- err error
- v = new(struct {
- Words string `form:"words" validate:"required"`
- })
- )
- if err = c.Bind(v); err != nil {
- return
- }
- c.JSON(dmSvc.SubtitleFilter(c, v.Words))
- }
- func draftSave(c *bm.Context) {
- var (
- v = new(struct {
- Oid int64 `form:"oid" validate:"required"`
- Type int32 `form:"type" validate:"required"`
- Aid int64 `form:"aid" validate:"required" `
- Lan string `form:"lan" validate:"required"`
- Submit bool `form:"submit"`
- Sign bool `form:"sign"`
- OriginSubtitleID int64 `form:"origin_subtitle_id"`
- Data string `form:"data" validate:"required"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(dmSvc.SaveSubtitleDraft(c, v.Aid, v.Oid, v.Type, mid.(int64), v.Lan, v.Submit, v.Sign, v.OriginSubtitleID, []byte(v.Data)))
- }
- func assitAudit(c *bm.Context) {
- var (
- v = new(struct {
- Oid int64 `form:"oid" validate:"required"`
- SubtitleID int64 `form:"subtitle_id" validate:"required"`
- Pass bool `form:"pass"`
- RejectComment string `form:"reject_comment"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(nil, dmSvc.AuditSubtitle(c, v.Oid, v.SubtitleID, mid.(int64), v.Pass, v.RejectComment))
- }
- func subtitleDel(c *bm.Context) {
- var (
- v = new(struct {
- Oid int64 `form:"oid" validate:"required"`
- SubtitleID int64 `form:"subtitle_id" validate:"required"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(nil, dmSvc.DelSubtitle(c, v.Oid, v.SubtitleID, mid.(int64)))
- }
- // 锁定发布字幕
- func subtitleLock(c *bm.Context) {
- var (
- v = new(struct {
- Oid int64 `form:"oid" validate:"required"`
- Type int32 `form:"type" validate:"required"`
- SubtitleID int64 `form:"subtitle_id" validate:"required"`
- Lock bool `form:"lock"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(nil, dmSvc.SubtitleLock(c, v.Oid, v.Type, mid.(int64), v.SubtitleID, v.Lock))
- }
- // 署名字幕
- func subtitleSign(c *bm.Context) {
- var (
- v = new(struct {
- Oid int64 `form:"oid" validate:"required"`
- Type int32 `form:"type" validate:"required"`
- SubtitleID int64 `form:"subtitle_id" validate:"required"`
- Sign bool `form:"sign"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(nil, dmSvc.SubtitleSign(c, v.Oid, v.Type, mid.(int64), v.SubtitleID, v.Sign))
- }
- func subtitleArchiveName(c *bm.Context) {
- var (
- v = new(struct {
- Aid int64 `form:"aid" validate:"required"`
- })
- )
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(dmSvc.ArchiveName(c, v.Aid))
- }
- // 查看字幕内容
- func subtitleShow(c *bm.Context) {
- var (
- v = new(struct {
- Oid int64 `form:"oid" validate:"required"`
- SubtitleID int64 `form:"subtitle_id" validate:"required"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(dmSvc.SubtitleShow(c, v.Oid, v.SubtitleID, mid.(int64)))
- }
- func subtitleLans(c *bm.Context) {
- var (
- v = new(struct {
- Oid int64 `form:"oid" validate:"required"`
- Type int32 `form:"type" validate:"required"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(dmSvc.SubtitleLans(c, v.Oid, v.Type, mid.(int64)))
- }
- func searchAssist(c *bm.Context) {
- var (
- v = new(struct {
- Oid int64 `form:"oid"`
- Type int32 `form:"type"`
- Aid int64 `form:"aid"`
- Status int32 `form:"status"`
- Page int32 `form:"page"`
- Size int32 `form:"size" validate:"max=100"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(dmSvc.SearchAssist(c, v.Aid, v.Oid, v.Type, mid.(int64), v.Status, v.Page, v.Size))
- }
- func authorList(c *bm.Context) {
- var (
- v = new(struct {
- Status int32 `form:"status"`
- Page int32 `form:"page"`
- Size int32 `form:"size" validate:"max=100"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(dmSvc.SearchAuthor(c, mid.(int64), v.Status, v.Page, v.Size))
- }
- func subtitlePermission(c *bm.Context) {
- var (
- v = new(struct {
- Aid int64 `form:"aid" validate:"required"`
- Oid int64 `form:"oid" validate:"required"`
- Type int32 `form:"type" validate:"required"`
- })
- )
- mid, _ := c.Get("mid")
- if err := c.Bind(v); err != nil {
- return
- }
- c.JSON(nil, dmSvc.SubtitlePermission(c, v.Aid, v.Oid, v.Type, mid.(int64)))
- }
- // waveForm .
- func waveForm(c *bm.Context) {
- var (
- err error
- v = new(struct {
- Aid int64 `form:"aid" validate:"required"`
- Oid int64 `form:"oid" validate:"required"`
- Type int32 `form:"type" validate:"required"`
- })
- )
- mid, _ := c.Get("mid")
- if err = c.Bind(v); err != nil {
- return
- }
- c.JSON(dmSvc.WaveForm(c, v.Aid, v.Oid, v.Type, mid.(int64)))
- }
- // waveFormCallBack .
- func waveFormCallBack(c *bm.Context) {
- var (
- oid int64
- err error
- v = new(struct {
- OK int32 `json:"ok"`
- Info string `json:"info"`
- })
- )
- if err = c.BindWith(v, binding.JSON); err != nil {
- return
- }
- if oid, err = strconv.ParseInt(c.Request.URL.Query().Get("oid"), 10, 64); err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(nil, dmSvc.WaveFormCallBack(c, oid, 1, v.OK, v.Info))
- }
- func subtitleReportAdd(c *bm.Context) {
- var (
- err error
- v = new(model.SubtitleReportAddParam)
- )
- mid, _ := c.Get("mid")
- if err = c.Bind(v); err != nil {
- return
- }
- c.JSON(nil, dmSvc.SubtitleReportAdd(c, mid.(int64), v))
- }
- func subtitleReportTag(c *bm.Context) {
- c.JSON(dmSvc.SubtitleReportList(c))
- }
|