From 2226693f595b069a464a7ad1bf0ad9060f23a7ca Mon Sep 17 00:00:00 2001 From: zhuangzibin <53577469+zhuangzibin@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:35:32 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20#3356=E3=80=90=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7=E3=80=91=E8=8D=89=E7=A8=BF=E7=AE=B1=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=8D=89=E7=A8=BF/=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=8D=89=E7=A8=BF=E6=8E=A5=E5=8F=A3=E8=A1=A5=E5=85=85=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/mp/bean/draft/WxMpDraftArticles.java | 12 ++++++++++++ .../mp/api/impl/WxMpDraftServiceImplTest.java | 13 +++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/draft/WxMpDraftArticles.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/draft/WxMpDraftArticles.java index f9dcb2324..80a7d37d4 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/draft/WxMpDraftArticles.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/draft/WxMpDraftArticles.java @@ -79,6 +79,18 @@ public class WxMpDraftArticles implements ToJson, Serializable { @SerializedName("thumb_url") private String thumbUrl; + /** + * 封面裁剪为2.35:1规格的坐标字段。以原始图片(thumb_media_id)左上角(0,0),右下角(1,1)建立平面坐标系,经过裁剪后的图片,其左上角所在的坐标即为(X1,Y1),右下角所在的坐标则为(X2,Y2),用分隔符_拼接为X1_Y1_X2_Y2,每个坐标值的精度为不超过小数点后6位数字。示例见下图,图中(X1,Y1) 等于(0.1945,0),(X2,Y2)等于(1,0.5236),所以请求参数值为0.1945_0_1_0.5236。 + */ + @SerializedName("pic_crop_235_1") + private String picCrop2351; + + /** + * 封面裁剪为1:1规格的坐标字段,裁剪原理同pic_crop_235_1,裁剪后的图片必须符合规格要求。 + */ + @SerializedName("pic_crop_1_1") + private String picCrop11; + public static WxMpDraftArticles fromJson(String json) { return WxGsonBuilder.create().fromJson(json, WxMpDraftArticles.class); } diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDraftServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDraftServiceImplTest.java index 2413c7fca..15966d672 100644 --- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDraftServiceImplTest.java +++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDraftServiceImplTest.java @@ -4,11 +4,7 @@ import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.test.ApiTestModule; -import me.chanjar.weixin.mp.bean.draft.WxMpAddDraft; -import me.chanjar.weixin.mp.bean.draft.WxMpDraftArticles; -import me.chanjar.weixin.mp.bean.draft.WxMpDraftInfo; -import me.chanjar.weixin.mp.bean.draft.WxMpDraftList; -import me.chanjar.weixin.mp.bean.draft.WxMpUpdateDraft; +import me.chanjar.weixin.mp.bean.draft.*; import org.testng.annotations.Guice; import org.testng.annotations.Test; @@ -59,6 +55,8 @@ public class WxMpDraftServiceImplTest { .thumbMediaId(thumbMediaId) // 显示封面、打开评论、所有人可评论 .showCoverPic(1).needOpenComment(1).onlyFansCanComment(0) + .picCrop2351("0.1945_0_1_0.5236") + .picCrop11("0.1945_0_1_0.5236") .build(); draftArticleList.add(draftArticle); @@ -78,7 +76,10 @@ public class WxMpDraftServiceImplTest { @Test public void testUpdateDraft() throws WxErrorException { WxMpDraftArticles draftArticles = WxMpDraftArticles.builder() - .title("新标题").content("新图文消息的具体内容").thumbMediaId(thumbMediaId).build(); + .title("新标题").content("新图文消息的具体内容").thumbMediaId(thumbMediaId) + .picCrop2351("0.1945_0_1_0.5236") + .picCrop11("0.1945_0_1_0.5236") + .build(); WxMpUpdateDraft updateDraft = WxMpUpdateDraft.builder() .mediaId(mediaId) .index(0)