Skip to content

Commit

Permalink
🆕 #2373 【小程序】urllink生成接口增加env_version参数以支持环境隔离
Browse files Browse the repository at this point in the history
  • Loading branch information
imyzt authored Nov 8, 2021
1 parent bb6bec0 commit def6856
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cn.binarywang.wx.miniapp.bean.urllink;

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;

Expand All @@ -16,6 +17,8 @@
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class GenerateUrlLinkRequest implements Serializable {

private static final long serialVersionUID = -2183685760797791910L;
Expand All @@ -36,6 +39,15 @@ public class GenerateUrlLinkRequest implements Serializable {
*/
private String query;

/**
* 要打开的小程序版本。正式版为"release",体验版为"trial",开发版为"develop",仅在微信外打开时生效。
* <pre>
* 是否必填: 否
* </pre>
*/
@SerializedName("env_version")
private String envVersion = "release";

/**
* 生成的 URL Link 类型,到期失效:true,永久有效:false
* <pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import cn.binarywang.wx.miniapp.bean.urllink.GenerateUrlLinkRequest;
import cn.binarywang.wx.miniapp.test.ApiTestModule;
import com.google.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;

@Test
@Guice(modules = ApiTestModule.class)
@Slf4j
public class WxMaLinkServiceImplTest {
@Inject
private WxMaService wxMaService;
Expand All @@ -34,4 +36,17 @@ public void testGenerateShortLink() throws WxErrorException {
System.out.println("generate:");
System.out.println(generate);
}

/**
* 多版本链接生成测试
* 开发时,仅支持IOS设备打开体验版及开发版
*/
@Test
public void testGenerateMultiEnvUrlLink() throws WxErrorException {
String url = this.wxMaService.getLinkService().generateUrlLink(GenerateUrlLinkRequest.builder()
.path("")
.envVersion("trial")
.build());
log.info("generate url link = {}", url);
}
}

0 comments on commit def6856

Please sign in to comment.