NAV Navbar
json

Introduction

这里是Video Link API接口文档,所有可使用的接口及其规范、使用方法应在这里写明,当接口更变时,应更改对应的文档信息。

Authentication

认证方式

Header

{"typ":"JWT","alg":"HS256"}

Payload

{"username":"admin","identity":0,"exp":1856370931,"id":3}

使用JWT进行身份认证。

Example

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxNjEyMjEzMSIsImV4cCI6MTg1NjM3MDkzMSwidXNlck5hbWUiOiLpg63lrZ_nhLYiLCJpYXQiOjE1NDUzMzA5MzF9.xmeHnjdFMj6sTDl9qJoJnRwUu-I1iUX2VXznQal9DL6kAw8CyGWoKsNDgIAejqPriOksy9Faee96tZkCeZ5W5w

no-auth

登录

HTTP Request

POST /login

该接口上传数据示例如下:

{
    "username": "admin",
    "password": "admin"
}

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxNjEyMjEzMSIsImV4cCI6MTg1NjM3MDkzMSwidXNlck5hbWUiOiLpg63lrZ_nhLYiLCJpYXQiOjE1NDUzMzA5MzF9.xmeHnjdFMj6sTDl9qJoJnRwUu-I1iUX2VXznQal9DL6kAw8CyGWoKsNDgIAejqPriOksy9Faee96tZkCeZ5W5w"
    }
}

获取最新已发布电影

HTTP Request

GET /published/movie/latest

该接口上传数据示例如下:

{
    "pageNo": 1,
    "pageSize": 3
}

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": {
        "count": 3,
        "movieList":[
            <MovieView>,
            <MovieView>,
            <MovieView>
        ],
    }
}
type MovieView struct {
    gorm.Model // 见下
    FileLocation  string      `json:"-"`
    CoverLocation string      `json:"-"`
    FilePath      string      `json:"filePath"`
    CoverPath     string      `json:"coverPath"`
    Hash          string      `json:"hash"`
    Status        MovieStatus `json:"status"`
    FailReason    string      `json:"failReason"`
    Title         string      `json:"title"`
    SourceName    string      `json:"sourceName"`
    SourceURL     string      `json:"sourceUrl"`
    ReleaseDate   time.Time   `json:"releaseDate"`
    Progress      uint8       `json:"progress"`
}

type MovieStatus uint8

const (
    MovieUploaded MovieStatus = iota
    MovieProcessing
    MovieReviewing
    MoviePublishing
    MoviePublished
)

// gorm.Model
type Model struct {
    ID        uint `gorm:"primarykey"`
    CreatedAt time.Time
    UpdatedAt time.Time
    DeletedAt DeletedAt `gorm:"index"`
}

获取最热门的已发布电影

HTTP Request

GET /published/movie/most_popular

该接口上传数据示例如下:

{
    "pageNo": 1,
    "pageSize": 3
}

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": {
        "count": 3,
        "movieList":[
            <MovieView>,
            <MovieView>,
            <MovieView>
        ],
    }
}

获取已发布电影的衣服列表

HTTP Request

GET /published/cloth/movie/:movieid

该接口上传数据示例如下:

{
    "pageNo": 1,
    "pageSize": 3
}

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": {
        "count": 3,
        "movieList":[
            <MovieView>,
            <MovieView>,
            <MovieView>
        ],
    }
}

upload

上传电影

HTTP Request

POST /upload/movie

该接口上传数据示例如下:

// file
// xxx.mp4

// file.Header
{
    "title": "送你一朵小红花",
    "sourceName": "Bilibili",
    "sourceURL": "https://bilibili.com/1213.html",
    "releaseDate": "2020-12-15T00:00:00Z08:00",
    "director": "韩延",
    "screenwriter": ["韩延","韩今谅","贾佳薇","于勇敢","李晗"],
    "actor": ["易洋千玺","刘浩存"]
}

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": <MovieView>
}
type MovieView struct {
    gorm.Model // 见下
    FileLocation  string      `json:"-"`
    CoverLocation string      `json:"-"`
    FilePath      string      `json:"filePath"`
    CoverPath     string      `json:"coverPath"`
    Hash          string      `json:"hash"`
    Status        MovieStatus `json:"status"`
    FailReason    string      `json:"failReason"`
    Title         string      `json:"title"`
    SourceName    string      `json:"sourceName"`
    SourceURL     string      `json:"sourceUrl"`
    ReleaseDate   time.Time   `json:"releaseDate"`
    Progress      uint8       `json:"progress"`
}

type MovieStatus uint8

const (
    MovieUploaded MovieStatus = iota
    MovieProcessing
    MovieReviewing
    MoviePublishing
    MoviePublished
)

// gorm.Model
type Model struct {
    ID        uint `gorm:"primarykey"`
    CreatedAt time.Time
    UpdatedAt time.Time
    DeletedAt DeletedAt `gorm:"index"`
}

上传电影封面

HTTP Request

POST /cover/movie/:movieid

该接口上传数据示例如下:

// file
// xxx.png

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": null
}

获取指定状态的电影列表

接口实现返回指定状态的电影列表

HTTP Requset

GET /movie/status/:status

其中:status<MovieStatus>枚举值,见上。

该接口上传数据示例如下:

// 

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": {
        "count": 3,
        "movieList":[
            <MovieView>,
            <MovieView>,
            <MovieView>
        ],

    }
}

check

获取明星列表

接口实现返回某电影中的明星

HTTP Requset

GET /star/movie/:movieid

该接口上传数据示例如下: json // 无

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": {
        "count": 2,
        "starList":[ "易洋千玺", "刘浩存" ]
    }
}

获取颜色列表 [暂未实现]

接口实现返回某电影中的衣服颜色

HTTP Requset

GET /check/color

该接口上传数据示例如下: json { "movieId": 1 }

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": {
        "count": 2,
        "colorList":[ "黑色", "白色" ],
    }
}

Query Parameters

Parameter Description
movieId int, 电影Id

Get Parameters

Parameter Description
count int, 颜色数量
colorList list[string], 颜色列表

获取衣服类型列表

接口实现返回某电影中的衣服类型

HTTP Requset

GET /type/cloth/movie/:movieid

该接口上传数据示例如下: json // 无

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": {
        "count": 2,
        "typeList":[ "upper", "l-coat" ],
    }
}

获取衣服列表

接口实现获取指定电影的衣服

HTTP Request

GET /cloth/movie/:movieid

该接口上传数据示例如下:

{
    "pageNo": 1,
    "pageSize": 12,
    "clothStatus": 0,
    "star": ["刘浩存", "易洋千玺"],
    "clothType": ["s-coat", "upper"],
    "color": ["黄色", "红色", "黑色"] //暂未实现
}

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": {
        "pageNo": 1,
        "pageSize": 3,
        "totalCount": 30,
        "totalPage": 10,
        "clothList": [
            <ClothView>,
            <ClothView>,
            <ClothView>
        ]
    }
}
type ClothView struct {
    gorm.Model
    Type           string              `json:"type"`//衣服类别
    StarID         uint                `json:"starId"`
    MovieID        uint                `json:"movieId"`
    FrameIndex     uint32              `json:"frameIndex"`//帧索引
    BodyIndex      uint32              `json:"bodyIndex"`//人体索引,一个帧中检测到的的第几个人体
    Hot            uint                `json:"hot"`//热度,社交属性
    CheckingStatus ClothCheckingStatus `json:"checkingStatus"`
    Star           string              `json:"star"`//明星名称
    ClothPicture   string              `json:"clothPicture"`//衣服URL
    FramePicture   string              `json:"framePicture"`//帧URL
    BodyPicture    string              `json:"bodyPicture"`//人体URL
}

type ClothCheckingStatus uint8

const (
    ClothCheckingWaiting ClothCheckingStatus = iota
    ClothCheckingPass
    ClothCheckingOut
)

修改电影状态

HTTP Request

PUT /movie/:movieid/status/:status

其中:status<MovieStatus>枚举值,见上。

该接口上传数据示例如下:

// 

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": null
}

修改衣服状态

HTTP Request

PUT /cloth/:clothid/status/:status

其中:status<ClothCheckingStatus>枚举值,见上。

该接口上传数据示例如下:

// 

该接口返回数据示例如下:

{
    "code": "SUCCESS",
    "message": null,
    "data": null
}

commit

Errors

The API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid. 1、语义有误,当前请求无法被服务器理解。除非进行修改,否则客户端不应该重复提交这个请求。2、请求参数有误。
401 Unauthorized -- Your JWT is wrong.
403 Forbidden -- The result requested is hidden for administrators only.
404 Not Found -- The specified result could not be found.
405 Method Not Allowed -- You tried to access with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
408 Timeout. 请求超时。客户端没有在服务器预备等待的时间内完成一个请求的发送。客户端可以随时再次提交这一请求而无需进行任何更改。
410 Gone -- The reuslt requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too frequently! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.