basePath: /api/v1 definitions: admin.AuthBody: properties: password: type: string username: type: string required: - password - username type: object admin.PostForm: properties: content: type: string discount: type: integer head_images: items: type: integer type: array introduction: type: string medias: items: type: integer type: array price: type: integer status: $ref: '#/definitions/fields.PostStatus' title: type: string type: object admin.PostItem: properties: assets: $ref: '#/definitions/types.JSONType-array_fields_MediaAsset' bought_count: type: integer content: type: string created_at: type: string deleted_at: $ref: '#/definitions/gorm.DeletedAt' description: type: string discount: type: integer head_images: $ref: '#/definitions/types.JSONType-array_int64' id: type: integer likes: type: integer medias: items: $ref: '#/definitions/models.Media' type: array price: type: integer status: $ref: '#/definitions/fields.PostStatus' tags: $ref: '#/definitions/types.JSONType-array_string' title: type: string updated_at: type: string views: type: integer type: object admin.PostUploadedForm: properties: md5: type: string mimeType: type: string originalName: type: string size: type: integer type: object admin.PreCheckResp: properties: exists: type: boolean pre_sign: $ref: '#/definitions/oss.PresignResult' type: object admin.StatisticsResponse: properties: amount: type: integer media: type: integer order: type: integer post_draft: type: integer post_published: type: integer user: type: integer type: object admin.TokenResponse: properties: token: type: string type: object admin.UserBalance: properties: balance: type: integer type: object fields.OrderStatus: enum: - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 format: int32 type: integer x-enum-varnames: - OrderStatusPending - OrderStatusPaid - OrderStatusRefundSuccess - OrderStatusRefundClosed - OrderStatusRefundProcessing - OrderStatusRefundAbnormal - OrderStatusCancelled - OrderStatusCompleted fields.PostStatus: enum: - 0 - 1 format: int32 type: integer x-enum-varnames: - PostStatusDraft - PostStatusPublished fields.UserStatus: enum: - 0 - 1 - 2 format: int32 type: integer x-enum-varnames: - UserStatusOk - UserStatusBanned - UserStatusBlocked gorm.DeletedAt: properties: time: type: string valid: description: Valid is true if Time is not NULL type: boolean type: object http.PlayUrl: properties: url: type: string type: object http.PostItem: properties: bought: type: boolean content: type: string description: type: string discount: type: integer head_images: items: type: string type: array id: type: integer likes: type: integer price: type: integer recharge_wechat: type: string tags: items: type: string type: array title: type: string views: type: integer type: object http.ProfileForm: properties: username: type: string required: - username type: object http.UserInfo: properties: avatar: type: string balance: type: integer created_at: type: string id: type: integer username: type: string type: object models.Media: properties: created_at: type: string hash: type: string id: type: integer metas: $ref: '#/definitions/types.JSONType-fields_MediaMetas' mime_type: type: string name: type: string path: type: string size: type: integer type: object models.Post: properties: assets: $ref: '#/definitions/types.JSONType-array_fields_MediaAsset' content: type: string created_at: type: string deleted_at: $ref: '#/definitions/gorm.DeletedAt' description: type: string discount: type: integer head_images: $ref: '#/definitions/types.JSONType-array_int64' id: type: integer likes: type: integer price: type: integer status: $ref: '#/definitions/fields.PostStatus' tags: $ref: '#/definitions/types.JSONType-array_string' title: type: string updated_at: type: string views: type: integer type: object models.User: properties: auth_token: $ref: '#/definitions/types.JSONType-fields_UserAuthToken' avatar: type: string balance: type: integer created_at: type: string deleted_at: $ref: '#/definitions/gorm.DeletedAt' id: type: integer metas: $ref: '#/definitions/types.JSONType-fields_UserMetas' open_id: type: string status: $ref: '#/definitions/fields.UserStatus' updated_at: type: string username: type: string type: object oss.PresignResult: properties: expiration: type: string method: type: string signedHeaders: additionalProperties: type: string type: object url: type: string type: object requests.Pager: properties: items: {} limit: type: integer page: type: integer total: type: integer type: object services.OrderListItem: properties: created_at: type: string currency: type: string discount: type: integer id: type: integer meta: $ref: '#/definitions/types.JSONType-fields_OrderMeta' order_no: type: string payment_method: type: string post_id: type: integer post_title: type: string price: type: integer refund_transaction_id: type: string status: $ref: '#/definitions/fields.OrderStatus' sub_order_no: type: string transaction_id: type: string updated_at: type: string user_id: type: integer username: type: string type: object types.JSONType-array_fields_MediaAsset: type: object types.JSONType-array_int64: type: object types.JSONType-array_string: type: object types.JSONType-fields_MediaMetas: type: object types.JSONType-fields_OrderMeta: type: object types.JSONType-fields_UserAuthToken: type: object types.JSONType-fields_UserMetas: type: object v1.ResponseItem: type: object wechat.JSAPIPayParams: properties: appId: type: string nonceStr: type: string package: type: string paySign: type: string signType: type: string timeStamp: type: string type: object externalDocs: description: OpenAPI url: https://swagger.io/resources/open-api/ host: localhost:8080 info: contact: email: support@swagger.io name: UserName url: http://www.swagger.io/support description: This is a sample server celler server. license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html termsOfService: http://swagger.io/terms/ title: ApiDoc version: "1.0" paths: /admin/auth: post: consumes: - application/json parameters: - description: 请求体 in: body name: body required: true schema: $ref: '#/definitions/admin.AuthBody' produces: - application/json responses: "200": description: 成功 schema: $ref: '#/definitions/admin.TokenResponse' summary: 管理员登录 tags: - Admin Auth /admin/medias: get: parameters: - in: query name: limit type: integer - in: query name: page type: integer - in: query name: keyword type: string produces: - application/json responses: "200": description: 成功 schema: allOf: - $ref: '#/definitions/requests.Pager' - properties: items: $ref: '#/definitions/models.Media' type: object summary: 媒体列表 tags: - Admin Medias /admin/medias/{id}: delete: parameters: - description: 媒体 ID format: int64 in: path name: id required: true type: integer produces: - application/json responses: "204": description: 成功 schema: {} summary: 删除媒体 tags: - Admin Medias get: parameters: - description: 媒体 ID format: int64 in: path name: id required: true type: integer responses: "302": description: 跳转 schema: type: string summary: 媒体预览(跳转到签名 URL) tags: - Admin Medias /admin/orders: get: parameters: - in: query name: limit type: integer - in: query name: page type: integer - in: query name: orderNumber type: string - in: query name: userID type: integer produces: - application/json responses: "200": description: 成功 schema: allOf: - $ref: '#/definitions/requests.Pager' - properties: items: $ref: '#/definitions/services.OrderListItem' type: object summary: 订单列表 tags: - Admin Orders /admin/orders/{id}/refund: post: parameters: - description: 订单 ID format: int64 in: path name: id required: true type: integer produces: - application/json responses: "200": description: 成功 schema: {} summary: 订单退款 tags: - Admin Orders /admin/posts: get: parameters: - in: query name: limit type: integer - in: query name: page type: integer - in: query name: keyword type: string produces: - application/json responses: "200": description: 成功 schema: allOf: - $ref: '#/definitions/requests.Pager' - properties: items: $ref: '#/definitions/admin.PostItem' type: object summary: 作品列表 tags: - Admin Posts post: consumes: - application/json parameters: - description: 请求体 in: body name: form required: true schema: $ref: '#/definitions/admin.PostForm' produces: - application/json responses: "200": description: 成功 schema: {} summary: 创建作品 tags: - Admin Posts /admin/posts/{id}: delete: parameters: - description: 作品 ID format: int64 in: path name: id required: true type: integer produces: - application/json responses: "204": description: 成功 schema: {} summary: 删除作品 tags: - Admin Posts get: parameters: - description: 作品 ID format: int64 in: path name: id required: true type: integer produces: - application/json responses: "200": description: 成功 schema: $ref: '#/definitions/admin.PostItem' summary: 作品详情 tags: - Admin Posts put: consumes: - application/json parameters: - description: 作品 ID format: int64 in: path name: id required: true type: integer - description: 请求体 in: body name: form required: true schema: $ref: '#/definitions/admin.PostForm' produces: - application/json responses: "200": description: 成功 schema: {} summary: 更新作品 tags: - Admin Posts /admin/posts/{id}/send-to/{userId}: post: parameters: - description: 作品 ID format: int64 in: path name: id required: true type: integer - description: 用户 ID format: int64 in: path name: userId required: true type: integer produces: - application/json responses: "200": description: 成功 schema: {} summary: 赠送作品给用户 tags: - Admin Posts /admin/statistics: get: produces: - application/json responses: "200": description: 成功 schema: $ref: '#/definitions/admin.StatisticsResponse' summary: 仪表盘统计 tags: - Admin Statistics /admin/uploads/post-uploaded-action: post: consumes: - application/json parameters: - description: 请求体 in: body name: body required: true schema: $ref: '#/definitions/admin.PostUploadedForm' produces: - application/json responses: "200": description: 成功 schema: {} summary: 上传完成回调处理 tags: - Admin Uploads /admin/uploads/pre-uploaded-check/{md5}.{ext}: get: parameters: - description: 文件 MD5 in: path name: md5 required: true type: string - description: 文件扩展名(不含点) in: path name: ext required: true type: string - description: 文件 MIME 类型 in: query name: mime required: true type: string produces: - application/json responses: "200": description: 成功 schema: $ref: '#/definitions/admin.PreCheckResp' summary: 预上传检查 tags: - Admin Uploads /admin/users: get: parameters: - in: query name: limit type: integer - in: query name: page type: integer - in: query name: keyword type: string produces: - application/json responses: "200": description: 成功 schema: allOf: - $ref: '#/definitions/requests.Pager' - properties: items: $ref: '#/definitions/models.User' type: object summary: 用户列表 tags: - Admin Users /admin/users/{id}: get: parameters: - description: 用户 ID format: int64 in: path name: id required: true type: integer produces: - application/json responses: "200": description: 成功 schema: $ref: '#/definitions/models.User' summary: 用户详情 tags: - Admin Users /admin/users/{id}/articles: get: parameters: - description: 用户 ID format: int64 in: path name: id required: true type: integer - in: query name: limit type: integer - in: query name: page type: integer produces: - application/json responses: "200": description: 成功 schema: allOf: - $ref: '#/definitions/requests.Pager' - properties: items: $ref: '#/definitions/models.Post' type: object summary: 用户已购作品 tags: - Admin Users /admin/users/{id}/balance: post: consumes: - application/json parameters: - description: 用户 ID format: int64 in: path name: id required: true type: integer - description: 请求体 in: body name: balance required: true schema: $ref: '#/definitions/admin.UserBalance' produces: - application/json responses: "200": description: 成功 schema: {} summary: 调整用户余额 tags: - Admin Users /posts: get: parameters: - in: query name: limit type: integer - in: query name: page type: integer - in: query name: keyword type: string produces: - application/json responses: "200": description: 成功 schema: allOf: - $ref: '#/definitions/requests.Pager' - properties: items: $ref: '#/definitions/http.PostItem' type: object summary: 作品列表 tags: - Posts /posts/{id}/buy: post: parameters: - description: 作品 ID format: int64 in: path name: id required: true type: integer produces: - application/json responses: "200": description: 成功(余额支付返回 AppId=balance) schema: $ref: '#/definitions/wechat.JSAPIPayParams' summary: 购买作品 tags: - Posts /posts/{id}/play: get: parameters: - description: 作品 ID format: int64 in: path name: id required: true type: integer produces: - application/json responses: "200": description: 成功 schema: $ref: '#/definitions/http.PlayUrl' summary: 获取播放地址 tags: - Posts /posts/{id}/show: get: parameters: - description: 作品 ID format: int64 in: path name: id required: true type: integer produces: - application/json responses: "200": description: 成功 schema: $ref: '#/definitions/http.PostItem' summary: 作品详情 tags: - Posts /posts/mine: get: parameters: - in: query name: limit type: integer - in: query name: page type: integer - in: query name: keyword type: string produces: - application/json responses: "200": description: 成功 schema: allOf: - $ref: '#/definitions/requests.Pager' - properties: items: $ref: '#/definitions/http.PostItem' type: object summary: 我的已购作品 tags: - Posts /users/profile: get: produces: - application/json responses: "200": description: 成功 schema: $ref: '#/definitions/http.UserInfo' summary: 获取个人信息 tags: - Users /users/username: put: consumes: - application/json parameters: - description: 请求体 in: body name: form required: true schema: $ref: '#/definitions/http.ProfileForm' produces: - application/json responses: "200": description: 成功 schema: {} summary: 修改用户名 tags: - Users /v1/medias/{id}: post: consumes: - multipart/form-data parameters: - description: ID in: path name: id required: true type: integer - in: query name: limit type: integer - in: query name: page type: integer - description: 搜索关键词 in: query name: search type: string - description: 内容类型 in: header name: Content-Type type: string - description: 上传到指定文件夹 in: formData name: folder type: string - description: 上传文件 in: formData name: file required: true type: file produces: - application/json responses: "200": description: 成功 schema: allOf: - $ref: '#/definitions/requests.Pager' - properties: items: $ref: '#/definitions/v1.ResponseItem' type: object summary: 演示接口 tags: - Demo securityDefinitions: BasicAuth: type: basic swagger: "2.0"