mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🆕 #3115【小程序】增加短剧媒资管理相关接口支持
This commit is contained in:
parent
d433191115
commit
deeb83f3d2
@ -542,4 +542,10 @@ public interface WxMaService extends WxService {
|
||||
* @return getWxMaOpenApiService
|
||||
*/
|
||||
WxMaOpenApiService getWxMaOpenApiService();
|
||||
/**
|
||||
* 小程序短剧管理
|
||||
*
|
||||
* @return getWxMaVodService
|
||||
*/
|
||||
WxMaVodService getWxMaVodService();
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package cn.binarywang.wx.miniapp.api;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.vod.*;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface WxMaVodService {
|
||||
List<WxMaVodMediaInfo> listMedia(WxMaVodListMediaRequest request) throws WxErrorException;
|
||||
|
||||
List<WxMaVodDramaInfo> listDrama(WxMaVodListDramaRequest request) throws WxErrorException;
|
||||
|
||||
WxMaVodMediaPlaybackInfo getMediaLink(WxMaVodGetMediaLinkRequest request) throws WxErrorException;
|
||||
|
||||
WxMaVodMediaInfo getMedia(WxMaVodGetMediaRequest request) throws WxErrorException;
|
||||
|
||||
boolean deleteMedia(WxMaVodDeleteMediaRequest request) throws WxErrorException;
|
||||
|
||||
WxMaVodDramaInfo getDrama(WxMaVodGetDramaRequest request) throws WxErrorException;
|
||||
|
||||
Integer auditDrama(WxMaVodAuditDramaRequest request) throws WxErrorException;
|
||||
|
||||
}
|
@ -89,6 +89,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
private final WxMaOrderShippingService wxMaOrderShippingService = new WxMaOrderShippingServiceImpl(this);
|
||||
|
||||
private final WxMaOpenApiService wxMaOpenApiService = new WxMaOpenApiServiceImpl(this);
|
||||
private final WxMaVodService wxMaVodService = new WxMaVodServiceImpl(this);
|
||||
|
||||
private Map<String, WxMaConfig> configMap = new HashMap<>();
|
||||
private int retrySleepMillis = 1000;
|
||||
@ -664,4 +665,9 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
public WxMaOpenApiService getWxMaOpenApiService() {
|
||||
return this.wxMaOpenApiService;
|
||||
}
|
||||
@Override
|
||||
public WxMaVodService getWxMaVodService() {
|
||||
return this.wxMaVodService;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,127 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaVodService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.bean.vod.*;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Vod.*;
|
||||
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WxMaVodServiceImpl implements WxMaVodService {
|
||||
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public List<WxMaVodMediaInfo> listMedia(WxMaVodListMediaRequest mediaRequest) throws WxErrorException {
|
||||
String responseContent = this.service.post(LIST_MEDIA_URL, mediaRequest.toJson());
|
||||
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
boolean hasMediaInfoList = jsonObject.has("media_info_list");
|
||||
if (hasMediaInfoList) {
|
||||
return WxMaGsonBuilder.create().fromJson(jsonObject.getAsJsonArray("media_info_list"),
|
||||
new TypeToken<List<WxMaVodMediaInfo>>() {
|
||||
}.getType());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<WxMaVodDramaInfo> listDrama(WxMaVodListDramaRequest mediaRequest) throws WxErrorException {
|
||||
String responseContent = this.service.post(LIST_DRAMAS_URL, mediaRequest.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
boolean hasMediaInfoList = jsonObject.has("drama_info_list");
|
||||
if (hasMediaInfoList) {
|
||||
return WxMaGsonBuilder.create().fromJson(jsonObject.getAsJsonArray("drama_info_list"),
|
||||
new TypeToken<List<WxMaVodDramaInfo>>() {
|
||||
}.getType());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WxMaVodMediaPlaybackInfo getMediaLink(WxMaVodGetMediaLinkRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(GET_MEDIA_LINK_URL, request.toJson());
|
||||
WxMaVodGetMediaLinkResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodGetMediaLinkResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return getDetailResponse.getMediaInfo();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WxMaVodMediaInfo getMedia(WxMaVodGetMediaRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(GET_MEDIA_URL, request.toJson());
|
||||
WxMaVodGetMediaResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodGetMediaResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return getDetailResponse.getMediaInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMedia(WxMaVodDeleteMediaRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(DELETE_MEDIA_URL, request.toJson());
|
||||
WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaBaseResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaVodDramaInfo getDrama(WxMaVodGetDramaRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(GET_DRAMA_URL, request.toJson());
|
||||
WxMaVodGetDramaResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodGetDramaResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return getDetailResponse.getDramaInfo();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer auditDrama(WxMaVodAuditDramaRequest request) throws WxErrorException {
|
||||
String responseContent = this.service.post(AUDIT_DRAMA_URL, request.toJson());
|
||||
WxMaVodAuditDramaResponse getDetailResponse = WxMaGsonBuilder.create()
|
||||
.fromJson(responseContent, WxMaVodAuditDramaResponse.class);
|
||||
|
||||
if (getDetailResponse.getErrcode() != 0) {
|
||||
throw new WxErrorException(
|
||||
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
|
||||
}
|
||||
|
||||
return getDetailResponse.getDramaId();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodAuditDramaRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("drama_id")
|
||||
private Integer dramaId;
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("media_count")
|
||||
private Long mediaCount;
|
||||
@SerializedName("media_id_list")
|
||||
private List<Integer> mediaIdList;
|
||||
@SerializedName("producer")
|
||||
private String producer;
|
||||
@SerializedName("cover_material_id")
|
||||
private String coverMaterialId;
|
||||
@SerializedName("authorized_material_id")
|
||||
private String authorizedMaterialId;
|
||||
@SerializedName("registration_number")
|
||||
private String registrationNumber;
|
||||
@SerializedName("publish_license")
|
||||
private String publishLicense;
|
||||
@SerializedName("publish_license_material_id")
|
||||
private String publishLicenseMaterialId;
|
||||
@SerializedName("expedited")
|
||||
private Long expedited;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodAuditDramaResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("drama_id")
|
||||
private Integer dramaId;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodDeleteMediaRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WxMaVodDramaInfo implements Serializable {
|
||||
private static final long serialVersionUID = -7663757440028175135L;
|
||||
|
||||
private String name;
|
||||
private String producer;
|
||||
private String playwright;
|
||||
|
||||
@SerializedName("drama_id")
|
||||
private Integer dramaId;
|
||||
@SerializedName("create_time")
|
||||
private Long createTime;
|
||||
@SerializedName("cover_url")
|
||||
private String coverUrl;
|
||||
@SerializedName("media_count")
|
||||
private Long mediaCount;
|
||||
@SerializedName("expedited")
|
||||
private Long expedited;
|
||||
@SerializedName("production_license")
|
||||
private String productionLicense;
|
||||
@SerializedName("description")
|
||||
private String description;
|
||||
|
||||
@SerializedName("audit_detail")
|
||||
private DramaAuditDetail auditDetail;
|
||||
@SerializedName("media_list")
|
||||
private List<DramaMediaInfo> mediaList;
|
||||
|
||||
@Data
|
||||
public static class DramaAuditDetail {
|
||||
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("create_time")
|
||||
private Long createTime;
|
||||
@SerializedName("audit_time")
|
||||
private Long auditTime;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DramaMediaInfo {
|
||||
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetDramaRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("drama_id")
|
||||
private Integer dramaId;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetDramaResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("drama_info")
|
||||
private WxMaVodDramaInfo dramaInfo;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetMediaLinkRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
@SerializedName("t")
|
||||
private Long t;
|
||||
|
||||
@SerializedName("expr")
|
||||
private Long expr;
|
||||
@SerializedName("rlimit")
|
||||
private Long rlimit;
|
||||
|
||||
@SerializedName("us")
|
||||
private String us;
|
||||
@SerializedName("whref")
|
||||
private String whRef;
|
||||
@SerializedName("bkref")
|
||||
private String bkRef;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetMediaLinkResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("media_info")
|
||||
private WxMaVodMediaPlaybackInfo mediaInfo;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetMediaRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetMediaResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("media_info")
|
||||
private WxMaVodMediaInfo mediaInfo;
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetTaskRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("task_id")
|
||||
private Integer taskId;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodGetTaskResponse extends WxMaBaseResponse implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
@SerializedName("task_info")
|
||||
private TaskInfo taskInfo;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class TaskInfo {
|
||||
|
||||
@SerializedName("task_type")
|
||||
private Integer taskType;
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("errcode")
|
||||
private Integer errCode;
|
||||
@SerializedName("errmsg")
|
||||
private String errMsg;
|
||||
@SerializedName("create_time")
|
||||
private Long createTime;
|
||||
@SerializedName("finish_time")
|
||||
private Long finish_time;
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodListDramaRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
|
||||
@SerializedName("offset")
|
||||
private Integer offset;
|
||||
@SerializedName("limit")
|
||||
private Integer limit;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaVodListMediaRequest implements Serializable {
|
||||
private static final long serialVersionUID = 7495157056049312108L;
|
||||
|
||||
@SerializedName("drama_id")
|
||||
private Integer dramaId;
|
||||
@SerializedName("media_name")
|
||||
private String mediaName;
|
||||
|
||||
@SerializedName("start_time")
|
||||
private Long startTime;
|
||||
@SerializedName("end_time")
|
||||
private Long endTime;
|
||||
|
||||
@SerializedName("offset")
|
||||
private Integer offset;
|
||||
@SerializedName("limit")
|
||||
private Integer limit;
|
||||
|
||||
public String toJson() {
|
||||
return WxMaGsonBuilder.create().toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序帐号的可选类目,其中 address / tag / title 是提交审核会用到的
|
||||
* <p>
|
||||
* media_id number 媒资文件id。
|
||||
* create_time number 上传时间,时间戳。
|
||||
* expire_time number 过期时间,时间戳。
|
||||
* drama_id number 所属剧目id。
|
||||
* file_size string 媒资文件大小,单位:字节。
|
||||
* duration number 播放时长,单位:秒。
|
||||
* name string 媒资文件名。
|
||||
* description string 描述。
|
||||
* cover_url string 封面图临时链接。
|
||||
* original_url string 原始视频临时链接。
|
||||
* mp4_url string mp4格式临时链接 。
|
||||
* hls_url string hls格式临时链接。
|
||||
* audit_detail MediaAuditDetail 审核信息。
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WxMaVodMediaInfo implements Serializable {
|
||||
private static final long serialVersionUID = -7663757440028175135L;
|
||||
private String name;
|
||||
private String description;
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
@SerializedName("drama_id")
|
||||
private Integer dramaId;
|
||||
@SerializedName("create_time")
|
||||
private Long createTime;
|
||||
@SerializedName("file_size")
|
||||
private String fileSize;
|
||||
@SerializedName("duration")
|
||||
private Long duration;
|
||||
@SerializedName("expire_time")
|
||||
private Long expireTime;
|
||||
@SerializedName("cover_url")
|
||||
private String coverUrl;
|
||||
@SerializedName("original_url")
|
||||
private String originalUrl;
|
||||
@SerializedName("mp4_url")
|
||||
private String mp4Url;
|
||||
@SerializedName("hls_url")
|
||||
private String hlsUrl;
|
||||
@SerializedName("audit_detail")
|
||||
private MediaAuditDetail auditDetail;
|
||||
|
||||
@Data
|
||||
public static class MediaAuditDetail {
|
||||
|
||||
@SerializedName("status")
|
||||
private Integer status;
|
||||
@SerializedName("create_time")
|
||||
private Long createTime;
|
||||
@SerializedName("audit_time")
|
||||
private Long auditTime;
|
||||
@SerializedName("reason")
|
||||
private String reason;
|
||||
@SerializedName("evidence_material_id_list")
|
||||
private List<String> evidenceMaterialIdList;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.binarywang.wx.miniapp.bean.vod;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WxMaVodMediaPlaybackInfo implements Serializable {
|
||||
private static final long serialVersionUID = -7663757440028175135L;
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
@SerializedName("media_id")
|
||||
private Integer mediaId;
|
||||
@SerializedName("duration")
|
||||
private Long duration;
|
||||
|
||||
@SerializedName("cover_url")
|
||||
private String coverUrl;
|
||||
@SerializedName("mp4_url")
|
||||
private String mp4Url;
|
||||
@SerializedName("hls_url")
|
||||
private String hlsUrl;
|
||||
|
||||
}
|
@ -830,4 +830,24 @@ public class WxMaApiUrlConstants {
|
||||
String SET_MSG_JUMP_PATH = "https://api.weixin.qq.com/wxa/sec/order/set_msg_jump_path";
|
||||
|
||||
}
|
||||
|
||||
public interface Vod {
|
||||
String LIST_MEDIA_URL = "https://api.weixin.qq.com/wxa/sec/vod/listmedia";
|
||||
String GET_MEDIA_URL = "https://api.weixin.qq.com/wxa/sec/vod/getmedia";
|
||||
String GET_MEDIA_LINK_URL = "https://api.weixin.qq.com/wxa/sec/vod/getmedialink";
|
||||
String DELETE_MEDIA_URL = "https://api.weixin.qq.com/wxa/sec/vod/deletemedia";
|
||||
String AUDIT_DRAMA_URL = "https://api.weixin.qq.com/wxa/sec/vod/auditdrama";
|
||||
String LIST_DRAMAS_URL = "https://api.weixin.qq.com/wxa/sec/vod/listdramas";
|
||||
String GET_DRAMA_URL = "https://api.weixin.qq.com/wxa/sec/vod/getdrama";
|
||||
String SINGLE_FILE_UPLOAD_URL = "https://api.weixin.qq.com/wxa/sec/vod/singlefileupload";
|
||||
String PULL_UPLOAD_URL = "https://api.weixin.qq.com/wxa/sec/vod/pullupload";
|
||||
String GET_TASK_URL = "https://api.weixin.qq.com/wxa/sec/vod/gettask";
|
||||
String APPLY_UPLOAD_URL = "https://api.weixin.qq.com/wxa/sec/vod/applyupload";
|
||||
String UPLOAD_PART_URL = "https://api.weixin.qq.com/wxa/sec/vod/uploadpart";
|
||||
String COMMIT_UPLOAD_URL = "https://api.weixin.qq.com/wxa/sec/vod/commitupload";
|
||||
String GET_CDN_USAGE_DATA_URL = "https://api.weixin.qq.com/wxa/sec/vod/getcdnusagedata";
|
||||
String GET_CDN_LOGS_URL = "https://api.weixin.qq.com/wxa/sec/vod/getcdnlogs";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -181,4 +181,41 @@ public class WxMaConstants {
|
||||
*/
|
||||
public static final String ZH_TW = "zh_TW";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static final class AuditStatus {
|
||||
public static final int INVALID = 0;
|
||||
public static final int ONGOING = 1;
|
||||
public static final int REJECTED = 2;
|
||||
public static final int APPROVED = 3;
|
||||
public static final int RECOMMIT = 4;
|
||||
}
|
||||
|
||||
|
||||
@UtilityClass
|
||||
public static final class ExpeditedType {
|
||||
|
||||
/**
|
||||
* 非加急
|
||||
*/
|
||||
public static final int NORMAL = 0;
|
||||
|
||||
/**
|
||||
* 加急
|
||||
*/
|
||||
public static final int HIGH_PRIORITY = 1;
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static final class UploadTaskType {
|
||||
public static final int PULL_UPLOAD = 1;
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static final class UploadTaskStatus {
|
||||
public static final int WAITING = 1;
|
||||
public static final int WORKING = 2;
|
||||
public static final int DONE = 3;
|
||||
public static final int FAILED = 4;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,87 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.vod.*;
|
||||
import cn.binarywang.wx.miniapp.test.ApiTestModule;
|
||||
import com.google.inject.Inject;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
@Test
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxMaVodServiceImplTest {
|
||||
@Inject
|
||||
private WxMaService wxService;
|
||||
|
||||
@Test
|
||||
public void testListMedia() throws Exception {
|
||||
WxMaVodListMediaRequest request = WxMaVodListMediaRequest.builder()
|
||||
.dramaId(100000)
|
||||
.offset(0)
|
||||
.limit(100)
|
||||
.build();
|
||||
List<WxMaVodMediaInfo> response = this.wxService.getWxMaVodService().listMedia(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListDrama() throws Exception {
|
||||
WxMaVodListDramaRequest request = WxMaVodListDramaRequest.builder()
|
||||
.offset(0)
|
||||
.limit(100)
|
||||
.build();
|
||||
List<WxMaVodDramaInfo> response = this.wxService.getWxMaVodService().listDrama(request);
|
||||
assertNotNull(response);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMediaLink() throws Exception {
|
||||
WxMaVodGetMediaLinkRequest request = WxMaVodGetMediaLinkRequest.builder()
|
||||
.mediaId(10000)
|
||||
.build();
|
||||
WxMaVodMediaPlaybackInfo response = this.wxService.getWxMaVodService().getMediaLink(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMedia() throws Exception {
|
||||
WxMaVodGetMediaRequest request = WxMaVodGetMediaRequest.builder()
|
||||
.mediaId(0)
|
||||
.build();
|
||||
WxMaVodMediaInfo response = this.wxService.getWxMaVodService().getMedia(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteMedia() throws Exception {
|
||||
WxMaVodDeleteMediaRequest request = WxMaVodDeleteMediaRequest.builder()
|
||||
.mediaId(0)
|
||||
.build();
|
||||
boolean response = this.wxService.getWxMaVodService().deleteMedia(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDrama() throws Exception {
|
||||
WxMaVodGetDramaRequest request = WxMaVodGetDramaRequest.builder()
|
||||
.dramaId(0)
|
||||
.build();
|
||||
WxMaVodDramaInfo response = this.wxService.getWxMaVodService().getDrama(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAuditDrama() throws Exception {
|
||||
WxMaVodAuditDramaRequest request = WxMaVodAuditDramaRequest.builder()
|
||||
.dramaId(0)
|
||||
.name("name")
|
||||
.build();
|
||||
Integer response = this.wxService.getWxMaVodService().auditDrama(request);
|
||||
assertNotNull(response);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user