Skip to content

Commit

Permalink
🎨 #2534 【小程序】代码提交审核接口新增部分参数
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Mar 6, 2022
1 parent 61f1179 commit bbb5269
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

Expand All @@ -18,8 +19,19 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class WxMaCategory implements Serializable {
private static final long serialVersionUID = -7663757440028175135L;

/**
* 小程序的页面,可通过“获取小程序的第三方提交代码的页面配置”接口获得
*/
private String address;
/**
* 小程序的标签,多个标签用空格分隔,标签不能多于10个,标签长度不超过20
*/
private String tag;

/**
* 一级类目名称
*/
Expand Down Expand Up @@ -51,14 +63,6 @@ public class WxMaCategory implements Serializable {
@SerializedName("third_id")
private Long thirdId;

/**
* 小程序的页面,可通过“获取小程序的第三方提交代码的页面配置”接口获得
*/
private String address;
/**
* 小程序的标签,多个标签用空格分隔,标签不能多于10个,标签长度不超过20
*/
private String tag;
/**
* 小程序页面的标题,标题长度不超过32
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;
Expand All @@ -20,15 +21,101 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class WxMaCodeSubmitAuditRequest implements Serializable {
private static final long serialVersionUID = 8854979405505241314L;

/**
* 提交审核项的一个列表(至少填写1项,至多填写5项)
*/
@SerializedName("item_list")
private List<WxMaCategory> itemList;

/**
* feedback_info String 否 反馈内容,至多 200 字
*/
@SerializedName("feedback_info")
private String feedbackInfo;

/**
* feedback_stuff String 否 用 | 分割的 media_id 列表,至多 5 张图片, 可以通过新增临时素材接口上传而得到
*/
@SerializedName("feedback_stuff")
private String feedbackStuff;

/**
* preview_info Object 否 预览信息(小程序页面截图和操作录屏)
*/
@SerializedName("preview_info")
private PreviewInfo previewInfo;

/**
* version_desc String 否 小程序版本说明和功能解释
*/
@SerializedName("version_desc")
private String versionDesc;

/**
* ugc_declare Object 否 用户生成内容场景(UGC)信息安全声明
*/
@SerializedName("ugc_declare")
private UgcDeclare ugcDeclare;

public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}

@Data
@Accessors(chain = true)
public static class PreviewInfo implements Serializable {
private static final long serialVersionUID = -3391652096859063951L;

/**
* video_id_list String Array 否 录屏mediaid列表,可以通过提审素材上传接口获得
*/
@SerializedName("video_id_list")
private List<String> videoIdList;

/**
* pic_id_list String Array 否 截屏mediaid列表,可以通过提审素材上传接口获得
*/
@SerializedName("pic_id_list")
private List<String> picIdList;
}

@Data
@Accessors(chain = true)
public static class UgcDeclare implements Serializable {
private static final long serialVersionUID = 201470564426848261L;

/**
* scene Number Array 否 UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段
*/
@SerializedName("scene")
private Integer[] scene;

/**
* other_scene_desc String 否 当scene选其他时的说明,不超时256字
*/
@SerializedName("other_scene_desc")
private String otherSceneDesc;

/**
* method Number Array 否 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关
*/
@SerializedName("method")
private Integer[] method;

/**
* has_audit_team Number 否 是否有审核团队, 0.无,1.有,默认0
*/
@SerializedName("has_audit_team")
private Integer hasAuditTeam;

/**
* audit_desc String 否 说明当前对UGC内容的审核机制,不超过256字
*/
@SerializedName("audit_desc")
private String auditDesc;
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,97 @@
package cn.binarywang.wx.miniapp.bean.code;

import me.chanjar.weixin.common.util.json.GsonParser;
import org.testng.annotations.Test;

import java.util.Arrays;

import static org.assertj.core.api.Assertions.assertThat;

/**
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-26 19:55
*/
public class WxMaCodeSubmitAuditRequestTest {
@Test
public void testToJson() {
WxMaCodeSubmitAuditRequest request = WxMaCodeSubmitAuditRequest
.builder()
WxMaCodeSubmitAuditRequest request = WxMaCodeSubmitAuditRequest.builder()
.itemList(Arrays.asList(
WxMaCategory
.builder()
.address("pages/logs/logs")
.tag("工具 效率")
.firstClass("工具")
.firstId(287L)
.secondClass("效率")
.secondId(616L)
WxMaCategory.builder()
.address("index")
.tag("学习 生活")
.firstClass("文娱")
.firstId(1L)
.secondClass("资讯")
.secondId(2L)
.title("首页")
.build(),
WxMaCategory.builder()
.address("page/logs/logs")
.tag("学习 工作")
.firstClass("教育")
.firstId(3L)
.secondClass("学历教育")
.secondId(4L)
.thirdClass("高等")
.thirdId(5L)
.title("日志")
.build()
)).build();
System.out.println(request.toJson());
))
.feedbackInfo("blablabla")
.feedbackStuff("xx|yy|zz")
.previewInfo(new WxMaCodeSubmitAuditRequest.PreviewInfo().setVideoIdList(Arrays.asList("xxxx"))
.setPicIdList(Arrays.asList("xxxx", "yyyy", "zzzz")))
.versionDesc("blablabla")
.ugcDeclare(new WxMaCodeSubmitAuditRequest.UgcDeclare()
.setAuditDesc("blablabla")
.setHasAuditTeam(1)
.setMethod(new Integer[]{1})
.setScene(new Integer[]{1, 2})
).build();

String expectedJson = "{\n" +
"\t\"item_list\": [\n" +
"\t{\n" +
"\t\t\"address\":\"index\",\n" +
"\t\t\"tag\":\"学习 生活\",\n" +
"\t\t\"first_class\": \"文娱\",\n" +
"\t\t\"second_class\": \"资讯\",\n" +
"\t\t\"first_id\":1,\n" +
"\t\t\"second_id\":2,\n" +
"\t\t\"title\": \"首页\"\n" +
"\t},\n" +
"\t{\n" +
"\t\t\"address\":\"page/logs/logs\",\n" +
"\t\t\"tag\":\"学习 工作\",\n" +
"\t\t\"first_class\": \"教育\",\n" +
"\t\t\"second_class\": \"学历教育\",\n" +
"\t\t\"third_class\": \"高等\",\n" +
"\t\t\"first_id\":3,\n" +
"\t\t\"second_id\":4,\n" +
"\t\t\"third_id\":5,\n" +
"\t\t\"title\": \"日志\"\n" +
"\t}\n" +
"\t],\n" +
"\t\"feedback_info\": \"blablabla\",\n" +
" \"feedback_stuff\": \"xx|yy|zz\",\n" +
" \"preview_info\" : {\n" +
" \"video_id_list\": [\"xxxx\"],\n" +
" \"pic_id_list\": [\"xxxx\", \"yyyy\", \"zzzz\" ]\n" +
" },\n" +
" \"version_desc\":\"blablabla\",\n" +
" \"ugc_declare\": {\n" +
" \"scene\": [\n" +
" 1,\n" +
" 2\n" +
" ],\n" +
" \"method\": [\n" +
" 1\n" +
" ],\n" +
" \"has_audit_team\": 1,\n" +
" \"audit_desc\": \"blablabla\"\n" +
" }\n" +
"}\n" +
"";
assertThat(request.toJson().replace("\n", "")).isEqualTo(GsonParser.parse(expectedJson).toString());
}
}

0 comments on commit bbb5269

Please sign in to comment.