Skip to content

Commit bbb5269

Browse files
committed
🎨 #2534 【小程序】代码提交审核接口新增部分参数
1 parent 61f1179 commit bbb5269

File tree

3 files changed

+178
-20
lines changed

3 files changed

+178
-20
lines changed

Diff for: weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/code/WxMaCategory.java

+12-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import lombok.Builder;
66
import lombok.Data;
77
import lombok.NoArgsConstructor;
8+
import lombok.experimental.Accessors;
89

910
import java.io.Serializable;
1011

@@ -18,8 +19,19 @@
1819
@Builder
1920
@NoArgsConstructor
2021
@AllArgsConstructor
22+
@Accessors(chain = true)
2123
public class WxMaCategory implements Serializable {
2224
private static final long serialVersionUID = -7663757440028175135L;
25+
26+
/**
27+
* 小程序的页面,可通过“获取小程序的第三方提交代码的页面配置”接口获得
28+
*/
29+
private String address;
30+
/**
31+
* 小程序的标签,多个标签用空格分隔,标签不能多于10个,标签长度不超过20
32+
*/
33+
private String tag;
34+
2335
/**
2436
* 一级类目名称
2537
*/
@@ -51,14 +63,6 @@ public class WxMaCategory implements Serializable {
5163
@SerializedName("third_id")
5264
private Long thirdId;
5365

54-
/**
55-
* 小程序的页面,可通过“获取小程序的第三方提交代码的页面配置”接口获得
56-
*/
57-
private String address;
58-
/**
59-
* 小程序的标签,多个标签用空格分隔,标签不能多于10个,标签长度不超过20
60-
*/
61-
private String tag;
6266
/**
6367
* 小程序页面的标题,标题长度不超过32
6468
*/

Diff for: weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/code/WxMaCodeSubmitAuditRequest.java

+87
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import lombok.Builder;
77
import lombok.Data;
88
import lombok.NoArgsConstructor;
9+
import lombok.experimental.Accessors;
910

1011
import java.io.Serializable;
1112
import java.util.List;
@@ -20,15 +21,101 @@
2021
@Builder
2122
@NoArgsConstructor
2223
@AllArgsConstructor
24+
@Accessors(chain = true)
2325
public class WxMaCodeSubmitAuditRequest implements Serializable {
2426
private static final long serialVersionUID = 8854979405505241314L;
27+
2528
/**
2629
* 提交审核项的一个列表(至少填写1项,至多填写5项)
2730
*/
2831
@SerializedName("item_list")
2932
private List<WxMaCategory> itemList;
3033

34+
/**
35+
* feedback_info String 否 反馈内容,至多 200 字
36+
*/
37+
@SerializedName("feedback_info")
38+
private String feedbackInfo;
39+
40+
/**
41+
* feedback_stuff String 否 用 | 分割的 media_id 列表,至多 5 张图片, 可以通过新增临时素材接口上传而得到
42+
*/
43+
@SerializedName("feedback_stuff")
44+
private String feedbackStuff;
45+
46+
/**
47+
* preview_info Object 否 预览信息(小程序页面截图和操作录屏)
48+
*/
49+
@SerializedName("preview_info")
50+
private PreviewInfo previewInfo;
51+
52+
/**
53+
* version_desc String 否 小程序版本说明和功能解释
54+
*/
55+
@SerializedName("version_desc")
56+
private String versionDesc;
57+
58+
/**
59+
* ugc_declare Object 否 用户生成内容场景(UGC)信息安全声明
60+
*/
61+
@SerializedName("ugc_declare")
62+
private UgcDeclare ugcDeclare;
63+
3164
public String toJson() {
3265
return WxMaGsonBuilder.create().toJson(this);
3366
}
67+
68+
@Data
69+
@Accessors(chain = true)
70+
public static class PreviewInfo implements Serializable {
71+
private static final long serialVersionUID = -3391652096859063951L;
72+
73+
/**
74+
* video_id_list String Array 否 录屏mediaid列表,可以通过提审素材上传接口获得
75+
*/
76+
@SerializedName("video_id_list")
77+
private List<String> videoIdList;
78+
79+
/**
80+
* pic_id_list String Array 否 截屏mediaid列表,可以通过提审素材上传接口获得
81+
*/
82+
@SerializedName("pic_id_list")
83+
private List<String> picIdList;
84+
}
85+
86+
@Data
87+
@Accessors(chain = true)
88+
public static class UgcDeclare implements Serializable {
89+
private static final long serialVersionUID = 201470564426848261L;
90+
91+
/**
92+
* scene Number Array 否 UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段
93+
*/
94+
@SerializedName("scene")
95+
private Integer[] scene;
96+
97+
/**
98+
* other_scene_desc String 否 当scene选其他时的说明,不超时256字
99+
*/
100+
@SerializedName("other_scene_desc")
101+
private String otherSceneDesc;
102+
103+
/**
104+
* method Number Array 否 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关
105+
*/
106+
@SerializedName("method")
107+
private Integer[] method;
108+
109+
/**
110+
* has_audit_team Number 否 是否有审核团队, 0.无,1.有,默认0
111+
*/
112+
@SerializedName("has_audit_team")
113+
private Integer hasAuditTeam;
114+
115+
/**
116+
* audit_desc String 否 说明当前对UGC内容的审核机制,不超过256字
117+
*/
118+
@SerializedName("audit_desc")
119+
private String auditDesc;
120+
}
34121
}
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,97 @@
11
package cn.binarywang.wx.miniapp.bean.code;
22

3+
import me.chanjar.weixin.common.util.json.GsonParser;
34
import org.testng.annotations.Test;
45

56
import java.util.Arrays;
67

8+
import static org.assertj.core.api.Assertions.assertThat;
9+
710
/**
811
* @author <a href="https://github.com/charmingoh">Charming</a>
912
* @since 2018-04-26 19:55
1013
*/
1114
public class WxMaCodeSubmitAuditRequestTest {
1215
@Test
1316
public void testToJson() {
14-
WxMaCodeSubmitAuditRequest request = WxMaCodeSubmitAuditRequest
15-
.builder()
17+
WxMaCodeSubmitAuditRequest request = WxMaCodeSubmitAuditRequest.builder()
1618
.itemList(Arrays.asList(
17-
WxMaCategory
18-
.builder()
19-
.address("pages/logs/logs")
20-
.tag("工具 效率")
21-
.firstClass("工具")
22-
.firstId(287L)
23-
.secondClass("效率")
24-
.secondId(616L)
19+
WxMaCategory.builder()
20+
.address("index")
21+
.tag("学习 生活")
22+
.firstClass("文娱")
23+
.firstId(1L)
24+
.secondClass("资讯")
25+
.secondId(2L)
26+
.title("首页")
27+
.build(),
28+
WxMaCategory.builder()
29+
.address("page/logs/logs")
30+
.tag("学习 工作")
31+
.firstClass("教育")
32+
.firstId(3L)
33+
.secondClass("学历教育")
34+
.secondId(4L)
35+
.thirdClass("高等")
36+
.thirdId(5L)
2537
.title("日志")
2638
.build()
27-
)).build();
28-
System.out.println(request.toJson());
39+
))
40+
.feedbackInfo("blablabla")
41+
.feedbackStuff("xx|yy|zz")
42+
.previewInfo(new WxMaCodeSubmitAuditRequest.PreviewInfo().setVideoIdList(Arrays.asList("xxxx"))
43+
.setPicIdList(Arrays.asList("xxxx", "yyyy", "zzzz")))
44+
.versionDesc("blablabla")
45+
.ugcDeclare(new WxMaCodeSubmitAuditRequest.UgcDeclare()
46+
.setAuditDesc("blablabla")
47+
.setHasAuditTeam(1)
48+
.setMethod(new Integer[]{1})
49+
.setScene(new Integer[]{1, 2})
50+
).build();
51+
52+
String expectedJson = "{\n" +
53+
"\t\"item_list\": [\n" +
54+
"\t{\n" +
55+
"\t\t\"address\":\"index\",\n" +
56+
"\t\t\"tag\":\"学习 生活\",\n" +
57+
"\t\t\"first_class\": \"文娱\",\n" +
58+
"\t\t\"second_class\": \"资讯\",\n" +
59+
"\t\t\"first_id\":1,\n" +
60+
"\t\t\"second_id\":2,\n" +
61+
"\t\t\"title\": \"首页\"\n" +
62+
"\t},\n" +
63+
"\t{\n" +
64+
"\t\t\"address\":\"page/logs/logs\",\n" +
65+
"\t\t\"tag\":\"学习 工作\",\n" +
66+
"\t\t\"first_class\": \"教育\",\n" +
67+
"\t\t\"second_class\": \"学历教育\",\n" +
68+
"\t\t\"third_class\": \"高等\",\n" +
69+
"\t\t\"first_id\":3,\n" +
70+
"\t\t\"second_id\":4,\n" +
71+
"\t\t\"third_id\":5,\n" +
72+
"\t\t\"title\": \"日志\"\n" +
73+
"\t}\n" +
74+
"\t],\n" +
75+
"\t\"feedback_info\": \"blablabla\",\n" +
76+
" \"feedback_stuff\": \"xx|yy|zz\",\n" +
77+
" \"preview_info\" : {\n" +
78+
" \"video_id_list\": [\"xxxx\"],\n" +
79+
" \"pic_id_list\": [\"xxxx\", \"yyyy\", \"zzzz\" ]\n" +
80+
" },\n" +
81+
" \"version_desc\":\"blablabla\",\n" +
82+
" \"ugc_declare\": {\n" +
83+
" \"scene\": [\n" +
84+
" 1,\n" +
85+
" 2\n" +
86+
" ],\n" +
87+
" \"method\": [\n" +
88+
" 1\n" +
89+
" ],\n" +
90+
" \"has_audit_team\": 1,\n" +
91+
" \"audit_desc\": \"blablabla\"\n" +
92+
" }\n" +
93+
"}\n" +
94+
"";
95+
assertThat(request.toJson().replace("\n", "")).isEqualTo(GsonParser.parse(expectedJson).toString());
2996
}
3097
}

0 commit comments

Comments
 (0)