Compare commits
No commits in common. "main" and "OSS-256" have entirely different histories.
16
.idea/checkstyle-idea.xml
generated
16
.idea/checkstyle-idea.xml
generated
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CheckStyle-IDEA" serialisationVersion="2">
|
||||
<checkstyleVersion>10.22.0</checkstyleVersion>
|
||||
<scanScope>JavaOnly</scanScope>
|
||||
<copyLibs>true</copyLibs>
|
||||
<option name="thirdPartyClasspath" />
|
||||
<option name="activeLocationIds" />
|
||||
<option name="locations">
|
||||
<list>
|
||||
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
|
||||
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
21
.idea/compiler.xml
generated
21
.idea/compiler.xml
generated
@ -2,6 +2,7 @@
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
@ -14,5 +15,25 @@
|
||||
<module name="wechat-j-oa" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="wechat-j-oa (1)" target="11" />
|
||||
<module name="wechat-j-oa (2)" target="1.8" />
|
||||
<module name="weixin-graal" target="1.8" />
|
||||
<module name="weixin-java-common" target="1.8" />
|
||||
<module name="weixin-java-cp" target="1.8" />
|
||||
<module name="weixin-java-miniapp" target="1.8" />
|
||||
<module name="weixin-java-mp" target="1.8" />
|
||||
<module name="weixin-java-open" target="1.8" />
|
||||
<module name="weixin-java-pay" target="1.8" />
|
||||
<module name="weixin-java-qidian" target="1.8" />
|
||||
<module name="wx-java" target="1.8" />
|
||||
<module name="wx-java-cp-spring-boot-starter" target="1.8" />
|
||||
<module name="wx-java-miniapp-spring-boot-starter" target="1.8" />
|
||||
<module name="wx-java-mp-spring-boot-starter" target="1.8" />
|
||||
<module name="wx-java-open-spring-boot-starter" target="1.8" />
|
||||
<module name="wx-java-pay-spring-boot-starter" target="1.8" />
|
||||
<module name="wx-java-qidian-spring-boot-starter" target="1.8" />
|
||||
<module name="wx-java-spring-boot-starters" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
22
.idea/encodings.xml
generated
22
.idea/encodings.xml
generated
@ -11,8 +11,30 @@
|
||||
<file url="file://$PROJECT_DIR$/open/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/pay/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/pay/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-mp-spring-boot-starter/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-open-spring-boot-starter/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-open-spring-boot-starter/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-pay-spring-boot-starter/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-pay-spring-boot-starter/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-qidian-spring-boot-starter/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/spring-boot-starters/wx-java-qidian-spring-boot-starter/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/weixin-graal/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/weixin-graal/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/weixin-java-miniapp/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/weixin-java-miniapp/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/weixin-java-mp/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/weixin-java-mp/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/weixin-java-qidian/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/weixin-java-qidian/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/work/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/work/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
|
1831
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
1831
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
.idea/jarRepositories.xml
generated
20
.idea/jarRepositories.xml
generated
@ -1,20 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="ossez-repo-snapshots" />
|
||||
<option name="name" value="OSSEZ Private Snapshots" />
|
||||
<option name="url" value="https://repo.ossez.com/repository/maven-snapshots/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="ossez-repo-releases" />
|
||||
<option name="name" value="iSharkFly Private Releases" />
|
||||
<option name="url" value="https://repo.isharkfly.com/repository/isharkfly-maven-releases/" />
|
||||
<option name="name" value="OSSEZ Private Releases" />
|
||||
<option name="url" value="https://repo.ossez.com/repository/maven-releases/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.isharkfly.com/repository/maven/" />
|
||||
<option name="url" value="https://repo.ossez.com/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="ossez-repo-snapshots" />
|
||||
<option name="name" value="iSharkFly Private Snapshots" />
|
||||
<option name="url" value="https://repo.isharkfly.com/repository/isharkfly-maven-snapshots/" />
|
||||
<option name="name" value="OSSEZ Private Snapshots" />
|
||||
<option name="url" value="https://repo.ossez.com/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
@ -26,5 +31,10 @@
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="ossez-repo-releases" />
|
||||
<option name="name" value="OSSEZ Private Releases" />
|
||||
<option name="url" value="https://repo.ossez.com/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
6
.idea/jpa-buddy.xml
generated
Normal file
6
.idea/jpa-buddy.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JpaBuddyIdeaProjectConfig">
|
||||
<option name="renamerInitialized" value="true" />
|
||||
</component>
|
||||
</project>
|
12
.idea/php.xml
generated
Normal file
12
.idea/php.xml
generated
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
@ -1,4 +1,4 @@
|
||||
package com.ossez.wechat.common.model.entity.menu;
|
||||
package com.ossez.wechat.common.bean.menu;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@ -19,7 +19,7 @@ import lombok.Data;
|
||||
public class WxMenu implements Serializable {
|
||||
private static final long serialVersionUID = -7083914585539687746L;
|
||||
|
||||
private List<MenuButton> buttons = new ArrayList<>();
|
||||
private List<WxMenuButton> buttons = new ArrayList<>();
|
||||
|
||||
private WxMenuRule matchRule;
|
||||
|
@ -0,0 +1,96 @@
|
||||
package com.ossez.wechat.common.bean.menu;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.ossez.wechat.common.util.json.WxGsonBuilder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* menu button.
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@Data
|
||||
public class WxMenuButton implements Serializable {
|
||||
private static final long serialVersionUID = -1070939403109776555L;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 菜单的响应动作类型.
|
||||
* view表示网页类型,
|
||||
* click表示点击类型,
|
||||
* miniprogram表示小程序类型
|
||||
* </pre>
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 菜单标题,不超过16个字节,子菜单不超过60个字节.
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 菜单KEY值,用于消息接口推送,不超过128字节.
|
||||
* click等点击类型必须
|
||||
* </pre>
|
||||
*/
|
||||
private String key;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 网页链接.
|
||||
* 用户点击菜单可打开链接,不超过1024字节。type为miniprogram时,不支持小程序的老版本客户端将打开本url。
|
||||
* view、miniprogram类型必须
|
||||
* </pre>
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 调用新增永久素材接口返回的合法media_id.
|
||||
* media_id类型和view_limited类型必须
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName("media_id")
|
||||
private String mediaId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 调用发布图文接口获得的article_id.
|
||||
* article_id类型和article_view_limited类型必须
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName("article_id")
|
||||
private String articleId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 小程序的appid.
|
||||
* miniprogram类型必须
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName("appid")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 小程序的页面路径.
|
||||
* miniprogram类型必须
|
||||
* </pre>
|
||||
*/
|
||||
@SerializedName("pagepath")
|
||||
private String pagePath;
|
||||
|
||||
@SerializedName("sub_button")
|
||||
private List<WxMenuButton> subButtons = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return WxGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.ossez.wechat.common.model.entity.menu;
|
||||
package com.ossez.wechat.common.bean.menu;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,43 +0,0 @@
|
||||
package com.ossez.wechat.common.model.entity.builder;
|
||||
|
||||
import com.ossez.wechat.common.model.entity.menu.MenuButton;
|
||||
import com.ossez.wechat.common.model.req.MenuRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MenuButtonBuilder {
|
||||
private List<MenuButton> subButtonList;
|
||||
private String type;
|
||||
private String name;
|
||||
private String key;
|
||||
private String url;
|
||||
|
||||
public MenuButtonBuilder setSubButtonList(List<MenuButton> subButtonList) {
|
||||
this.subButtonList = subButtonList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MenuButtonBuilder setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MenuButtonBuilder setName(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MenuButtonBuilder setKey(String key) {
|
||||
this.key = key;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MenuButtonBuilder setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MenuButton createMenuButton() {
|
||||
return new MenuButton(subButtonList, type, name, key, url);
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package com.ossez.wechat.common.model.entity.menu;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.ossez.wechat.common.model.req.MenuRequest;
|
||||
import com.ossez.wechat.common.util.json.WxGsonBuilder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* menu button.
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@Data
|
||||
public class MenuButton implements Serializable {
|
||||
private static final long serialVersionUID = -1070939403109776555L;
|
||||
|
||||
public MenuButton(List<MenuButton> subButtonList, String type, String name, String key, String url) {
|
||||
this.subButtonList = subButtonList;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.key = key;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@JsonProperty(value = "sub_button")
|
||||
private List<MenuButton> subButtonList;
|
||||
@JsonProperty("type")
|
||||
private String type;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
@JsonProperty("key")
|
||||
private String key;
|
||||
@JsonProperty("url")
|
||||
private String url;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.ossez.wechat.common.model.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.ossez.wechat.common.model.entity.menu.MenuButton;
|
||||
import com.ossez.wechat.common.model.res.DataCubeArticle;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* CustomMessage
|
||||
*
|
||||
* @author YuCheng
|
||||
*/
|
||||
public class MenuRequest implements Serializable {
|
||||
private static final long serialVersionUID = -9196732086954365246L;
|
||||
@JsonProperty(value = "button", required = true)
|
||||
private List<MenuButton> buttonList;
|
||||
|
||||
|
||||
public List<MenuButton> getButtonList() {
|
||||
return buttonList;
|
||||
}
|
||||
|
||||
public void setButtonList(List<MenuButton> buttonList) {
|
||||
this.buttonList = buttonList;
|
||||
}
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
package com.ossez.wechat.common.model.res;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* UserSummaryResponse Object
|
||||
*
|
||||
* @author YuCheng Hu
|
||||
*/
|
||||
public class DataCubeArticle {
|
||||
@JsonProperty("list")
|
||||
private List<ArticleData> articleDataList;
|
||||
|
||||
public static class ArticleData {
|
||||
@JsonProperty("ref_date")
|
||||
private String refDate;
|
||||
|
||||
@JsonProperty("msgid")
|
||||
private String msgId;
|
||||
@JsonProperty("title")
|
||||
private String title;
|
||||
@JsonProperty("int_page_read_user")
|
||||
private Long intPageReadUser;
|
||||
@JsonProperty("ori_page_read_user")
|
||||
private Long oriPageReadUser;
|
||||
@JsonProperty("ori_page_read_count")
|
||||
private Long oriPageReadCount;
|
||||
@JsonProperty("share_user")
|
||||
private Long shareUser;
|
||||
|
||||
@JsonProperty("shareCount")
|
||||
private Long shareCount;
|
||||
|
||||
@JsonProperty("add_to_fav_user")
|
||||
private Long addToFavUser;
|
||||
|
||||
@JsonProperty("add_to_fav_count")
|
||||
private Long addToFavCount;
|
||||
|
||||
public String getRefDate() {
|
||||
return refDate;
|
||||
}
|
||||
|
||||
public void setRefDate(String refDate) {
|
||||
this.refDate = refDate;
|
||||
}
|
||||
|
||||
public String getMsgId() {
|
||||
return msgId;
|
||||
}
|
||||
|
||||
public void setMsgId(String msgId) {
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public Long getIntPageReadUser() {
|
||||
return intPageReadUser;
|
||||
}
|
||||
|
||||
public void setIntPageReadUser(Long intPageReadUser) {
|
||||
this.intPageReadUser = intPageReadUser;
|
||||
}
|
||||
|
||||
public Long getOriPageReadUser() {
|
||||
return oriPageReadUser;
|
||||
}
|
||||
|
||||
public void setOriPageReadUser(Long oriPageReadUser) {
|
||||
this.oriPageReadUser = oriPageReadUser;
|
||||
}
|
||||
|
||||
public Long getOriPageReadCount() {
|
||||
return oriPageReadCount;
|
||||
}
|
||||
|
||||
public void setOriPageReadCount(Long oriPageReadCount) {
|
||||
this.oriPageReadCount = oriPageReadCount;
|
||||
}
|
||||
|
||||
public Long getShareUser() {
|
||||
return shareUser;
|
||||
}
|
||||
|
||||
public void setShareUser(Long shareUser) {
|
||||
this.shareUser = shareUser;
|
||||
}
|
||||
|
||||
public Long getShareCount() {
|
||||
return shareCount;
|
||||
}
|
||||
|
||||
public void setShareCount(Long shareCount) {
|
||||
this.shareCount = shareCount;
|
||||
}
|
||||
|
||||
public Long getAddToFavUser() {
|
||||
return addToFavUser;
|
||||
}
|
||||
|
||||
public void setAddToFavUser(Long addToFavUser) {
|
||||
this.addToFavUser = addToFavUser;
|
||||
}
|
||||
|
||||
public Long getAddToFavCount() {
|
||||
return addToFavCount;
|
||||
}
|
||||
|
||||
public void setAddToFavCount(Long addToFavCount) {
|
||||
this.addToFavCount = addToFavCount;
|
||||
}
|
||||
}
|
||||
|
||||
public List<ArticleData> getArticleDataList() {
|
||||
return articleDataList;
|
||||
}
|
||||
|
||||
public void setArticleDataList(List<ArticleData> articleDataList) {
|
||||
this.articleDataList = articleDataList;
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||
*
|
||||
* @author YuCheng Hu
|
||||
*/
|
||||
public class DataCubeUser {
|
||||
public class UserSummaryResponse {
|
||||
@JsonProperty("list")
|
||||
private List<UserData> userDataList;
|
||||
|
@ -5,7 +5,7 @@ import com.google.gson.GsonBuilder;
|
||||
import com.ossez.wechat.common.exception.WxError;
|
||||
import com.ossez.wechat.common.model.WeChatAccessToken;
|
||||
import com.ossez.wechat.common.bean.WxNetCheckResult;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.result.WxMediaUploadResult;
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -9,10 +9,9 @@
|
||||
package com.ossez.wechat.common.util.json;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.ossez.wechat.common.model.entity.builder.MenuButtonBuilder;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.model.entity.menu.MenuButton;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenuRule;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenuButton;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenuRule;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
@ -20,16 +19,16 @@ import java.lang.reflect.Type;
|
||||
/**
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
public class WxMenuGsonAdapter {
|
||||
public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializer<WxMenu> {
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public JsonElement serialize(WxMenu menu, Type typeOfSrc, JsonSerializationContext context) {
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
JsonArray buttonArray = new JsonArray();
|
||||
for (MenuButton button : menu.getButtons()) {
|
||||
// JsonObject buttonJson = convertToJson(button);
|
||||
// buttonArray.add(buttonJson);
|
||||
for (WxMenuButton button : menu.getButtons()) {
|
||||
JsonObject buttonJson = convertToJson(button);
|
||||
buttonArray.add(buttonJson);
|
||||
}
|
||||
json.add("button", buttonArray);
|
||||
|
||||
@ -40,25 +39,25 @@ public class WxMenuGsonAdapter {
|
||||
return json;
|
||||
}
|
||||
|
||||
// protected JsonObject convertToJson(MenuButton button) {
|
||||
// JsonObject buttonJson = new JsonObject();
|
||||
// buttonJson.addProperty("type", button.getType());
|
||||
// buttonJson.addProperty("name", button.getName());
|
||||
// buttonJson.addProperty("key", button.getKey());
|
||||
// buttonJson.addProperty("url", button.getUrl());
|
||||
// buttonJson.addProperty("media_id", button.getMediaId());
|
||||
// buttonJson.addProperty("article_id", button.getArticleId());
|
||||
// buttonJson.addProperty("appid", button.getAppId());
|
||||
// buttonJson.addProperty("pagepath", button.getPagePath());
|
||||
// if (button.getSubButtons() != null && button.getSubButtons().size() > 0) {
|
||||
// JsonArray buttonArray = new JsonArray();
|
||||
// for (MenuButton sub_button : button.getSubButtons()) {
|
||||
// buttonArray.add(convertToJson(sub_button));
|
||||
// }
|
||||
// buttonJson.add("sub_button", buttonArray);
|
||||
// }
|
||||
// return buttonJson;
|
||||
// }
|
||||
protected JsonObject convertToJson(WxMenuButton button) {
|
||||
JsonObject buttonJson = new JsonObject();
|
||||
buttonJson.addProperty("type", button.getType());
|
||||
buttonJson.addProperty("name", button.getName());
|
||||
buttonJson.addProperty("key", button.getKey());
|
||||
buttonJson.addProperty("url", button.getUrl());
|
||||
buttonJson.addProperty("media_id", button.getMediaId());
|
||||
buttonJson.addProperty("article_id", button.getArticleId());
|
||||
buttonJson.addProperty("appid", button.getAppId());
|
||||
buttonJson.addProperty("pagepath", button.getPagePath());
|
||||
if (button.getSubButtons() != null && button.getSubButtons().size() > 0) {
|
||||
JsonArray buttonArray = new JsonArray();
|
||||
for (WxMenuButton sub_button : button.getSubButtons()) {
|
||||
buttonArray.add(convertToJson(sub_button));
|
||||
}
|
||||
buttonJson.add("sub_button", buttonArray);
|
||||
}
|
||||
return buttonJson;
|
||||
}
|
||||
|
||||
protected JsonObject convertToJson(WxMenuRule menuRule) {
|
||||
JsonObject matchRule = new JsonObject();
|
||||
@ -87,47 +86,47 @@ public class WxMenuGsonAdapter {
|
||||
return menuRule;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public WxMenu deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
// /*
|
||||
// * 操蛋的微信
|
||||
// * 创建菜单时是 { button : ... }
|
||||
// * 查询菜单时是 { menu : { button : ... } }
|
||||
// * 现在企业号升级为企业微信后,没有此问题,因此需要单独处理
|
||||
// */
|
||||
// JsonArray buttonsJson = json.getAsJsonObject().get("menu").getAsJsonObject().get("button").getAsJsonArray();
|
||||
// return this.buildMenuFromJson(buttonsJson);
|
||||
// }
|
||||
@Override
|
||||
public WxMenu deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
/*
|
||||
* 操蛋的微信
|
||||
* 创建菜单时是 { button : ... }
|
||||
* 查询菜单时是 { menu : { button : ... } }
|
||||
* 现在企业号升级为企业微信后,没有此问题,因此需要单独处理
|
||||
*/
|
||||
JsonArray buttonsJson = json.getAsJsonObject().get("menu").getAsJsonObject().get("button").getAsJsonArray();
|
||||
return this.buildMenuFromJson(buttonsJson);
|
||||
}
|
||||
|
||||
// protected WxMenu buildMenuFromJson(JsonArray buttonsJson) {
|
||||
// WxMenu menu = new WxMenu();
|
||||
// for (int i = 0; i < buttonsJson.size(); i++) {
|
||||
// JsonObject buttonJson = buttonsJson.get(i).getAsJsonObject();
|
||||
// MenuButton button = convertFromJson(buttonJson);
|
||||
// menu.getButtons().add(button);
|
||||
// if (buttonJson.get("sub_button") == null || buttonJson.get("sub_button").isJsonNull()) {
|
||||
// continue;
|
||||
// }
|
||||
// JsonArray sub_buttonsJson = buttonJson.get("sub_button").getAsJsonArray();
|
||||
// for (int j = 0; j < sub_buttonsJson.size(); j++) {
|
||||
// JsonObject sub_buttonJson = sub_buttonsJson.get(j).getAsJsonObject();
|
||||
// button.getSubButtons().add(convertFromJson(sub_buttonJson));
|
||||
// }
|
||||
// }
|
||||
// return menu;
|
||||
// }
|
||||
protected WxMenu buildMenuFromJson(JsonArray buttonsJson) {
|
||||
WxMenu menu = new WxMenu();
|
||||
for (int i = 0; i < buttonsJson.size(); i++) {
|
||||
JsonObject buttonJson = buttonsJson.get(i).getAsJsonObject();
|
||||
WxMenuButton button = convertFromJson(buttonJson);
|
||||
menu.getButtons().add(button);
|
||||
if (buttonJson.get("sub_button") == null || buttonJson.get("sub_button").isJsonNull()) {
|
||||
continue;
|
||||
}
|
||||
JsonArray sub_buttonsJson = buttonJson.get("sub_button").getAsJsonArray();
|
||||
for (int j = 0; j < sub_buttonsJson.size(); j++) {
|
||||
JsonObject sub_buttonJson = sub_buttonsJson.get(j).getAsJsonObject();
|
||||
button.getSubButtons().add(convertFromJson(sub_buttonJson));
|
||||
}
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
||||
// protected MenuButton convertFromJson(JsonObject json) {
|
||||
// MenuButton button = new MenuButtonBuilder().createMenuButton();
|
||||
// button.setName(GsonHelper.getString(json, "name"));
|
||||
// button.setKey(GsonHelper.getString(json, "key"));
|
||||
// button.setUrl(GsonHelper.getString(json, "url"));
|
||||
// button.setType(GsonHelper.getString(json, "type"));
|
||||
// button.setMediaId(GsonHelper.getString(json, "media_id"));
|
||||
// button.setArticleId(GsonHelper.getString(json, "article_id"));
|
||||
// button.setAppId(GsonHelper.getString(json, "appid"));
|
||||
// button.setPagePath(GsonHelper.getString(json, "pagepath"));
|
||||
// return button;
|
||||
// }
|
||||
protected WxMenuButton convertFromJson(JsonObject json) {
|
||||
WxMenuButton button = new WxMenuButton();
|
||||
button.setName(GsonHelper.getString(json, "name"));
|
||||
button.setKey(GsonHelper.getString(json, "key"));
|
||||
button.setUrl(GsonHelper.getString(json, "url"));
|
||||
button.setType(GsonHelper.getString(json, "type"));
|
||||
button.setMediaId(GsonHelper.getString(json, "media_id"));
|
||||
button.setArticleId(GsonHelper.getString(json, "article_id"));
|
||||
button.setAppId(GsonHelper.getString(json, "appid"));
|
||||
button.setPagePath(GsonHelper.getString(json, "pagepath"));
|
||||
return button;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package com.ossez.wechat.common.model;
|
||||
|
||||
import com.ossez.wechat.common.model.entity.builder.MenuButtonBuilder;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.model.entity.menu.MenuButton;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenuRule;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenuButton;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenuRule;
|
||||
import org.testng.*;
|
||||
import org.testng.annotations.*;
|
||||
|
||||
@ -19,41 +18,41 @@ public class WxMenuTest {
|
||||
@Test(dataProvider = "wxPushMenu")
|
||||
public void testToJson(String json) {
|
||||
WxMenu menu = new WxMenu();
|
||||
MenuButton button1 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button1 = new WxMenuButton();
|
||||
button1.setType("click");
|
||||
button1.setName("今日歌曲");
|
||||
button1.setKey("V1001_TODAY_MUSIC");
|
||||
|
||||
MenuButton button2 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button2 = new WxMenuButton();
|
||||
button2.setType("click");
|
||||
button2.setName("歌手简介");
|
||||
button2.setKey("V1001_TODAY_SINGER");
|
||||
|
||||
MenuButton button3 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button3 = new WxMenuButton();
|
||||
button3.setName("菜单");
|
||||
|
||||
menu.getButtons().add(button1);
|
||||
menu.getButtons().add(button2);
|
||||
menu.getButtons().add(button3);
|
||||
|
||||
MenuButton button31 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button31 = new WxMenuButton();
|
||||
button31.setType("view");
|
||||
button31.setName("搜索");
|
||||
button31.setUrl("http://www.soso.com/");
|
||||
|
||||
MenuButton button32 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button32 = new WxMenuButton();
|
||||
button32.setType("view");
|
||||
button32.setName("视频");
|
||||
button32.setUrl("http://v.qq.com/");
|
||||
|
||||
MenuButton button33 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button33 = new WxMenuButton();
|
||||
button33.setType("click");
|
||||
button33.setName("赞一下我们");
|
||||
button33.setKey("V1001_GOOD");
|
||||
|
||||
// button3.getSubButtons().add(button31);
|
||||
// button3.getSubButtons().add(button32);
|
||||
// button3.getSubButtons().add(button33);
|
||||
button3.getSubButtons().add(button31);
|
||||
button3.getSubButtons().add(button32);
|
||||
button3.getSubButtons().add(button33);
|
||||
|
||||
Assert.assertEquals(menu.toJson(), json);
|
||||
}
|
||||
@ -61,7 +60,7 @@ public class WxMenuTest {
|
||||
@Test(dataProvider = "wxAddConditionalMenu")
|
||||
public void testAddConditionalToJson(String json) {
|
||||
WxMenu menu = new WxMenu();
|
||||
MenuButton button1 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button1 = new WxMenuButton();
|
||||
button1.setType("click");
|
||||
button1.setName("今日歌曲");
|
||||
button1.setKey("V1001_TODAY_MUSIC");
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ossez.wechat.oa.api;
|
||||
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.exception.WxErrorException;
|
||||
import com.ossez.wechat.oa.bean.menu.WxMpGetSelfMenuInfoResult;
|
||||
import com.ossez.wechat.oa.bean.menu.WxMpMenu;
|
||||
|
@ -5,7 +5,7 @@ import com.ossez.wechat.oa.bean.menu.WxMpGetSelfMenuInfoResult;
|
||||
import com.ossez.wechat.oa.bean.menu.WxMpMenu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.exception.WxErrorException;
|
||||
import com.ossez.wechat.common.util.json.GsonParser;
|
||||
import com.ossez.wechat.oa.api.WxMpMenuService;
|
||||
|
@ -7,15 +7,16 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.ossez.wechat.common.constant.WeChatConstant;
|
||||
import com.ossez.wechat.common.exception.DataStructureException;
|
||||
import com.ossez.wechat.common.exception.WxErrorException;
|
||||
import com.ossez.wechat.common.model.req.CustomMessage;
|
||||
import com.ossez.wechat.common.model.req.DataCubeRequest;
|
||||
import com.ossez.wechat.common.model.res.DataCubeArticle;
|
||||
import com.ossez.wechat.common.model.res.DataCubeUser;
|
||||
import com.ossez.wechat.common.model.res.UserSummaryResponse;
|
||||
import com.ossez.wechat.oa.api.WeChatOfficialAccountService;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.interceptor.AuthenticationInterceptor;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.interceptor.WeChatErrorInterceptor;
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import retrofit2.HttpException;
|
||||
@ -25,6 +26,7 @@ import retrofit2.converter.jackson.JacksonConverterFactory;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@ -50,9 +52,15 @@ public class WeChatDataCubeService {
|
||||
mapper.setSerializationInclusion(Include.NON_NULL);
|
||||
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
|
||||
|
||||
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new AuthenticationInterceptor(accessToken)).addInterceptor(new WeChatErrorInterceptor()).connectionPool(new ConnectionPool(5, 1, TimeUnit.SECONDS)).readTimeout(1000, TimeUnit.SECONDS).build();
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
.addInterceptor(new AuthenticationInterceptor(accessToken))
|
||||
.addInterceptor(new WeChatErrorInterceptor())
|
||||
.connectionPool(new ConnectionPool(5, 1, TimeUnit.SECONDS)).readTimeout(1000, TimeUnit.SECONDS).build();
|
||||
|
||||
Retrofit retrofit = new Retrofit.Builder().baseUrl(WeChatConstant.ENDPOINT_WECHAT).client(client).addConverterFactory(JacksonConverterFactory.create(mapper)).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).build();
|
||||
Retrofit retrofit = new Retrofit.Builder().baseUrl(WeChatConstant.ENDPOINT_WECHAT).client(client)
|
||||
.addConverterFactory(JacksonConverterFactory.create(mapper))
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
|
||||
this.weChatOfficialAccountApi = retrofit.create(WeChatOfficialAccountApi.class);
|
||||
|
||||
@ -67,7 +75,7 @@ public class WeChatDataCubeService {
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
public DataCubeUser getUserSummary(LocalDateTime beginDate, LocalDateTime endDate) throws WxErrorException {
|
||||
public UserSummaryResponse getUserSummary(LocalDateTime beginDate, LocalDateTime endDate) throws WxErrorException {
|
||||
if (!(ObjectUtils.isNotEmpty(beginDate) && ObjectUtils.isNotEmpty(endDate) && endDate.isAfter(beginDate))) {
|
||||
log.warn("The begin date [{}] Or end date [{}] was null or ender date greater than begin date.", beginDate, endDate);
|
||||
throw new DataStructureException("Query data range error ");
|
||||
@ -90,7 +98,7 @@ public class WeChatDataCubeService {
|
||||
return null;
|
||||
}
|
||||
|
||||
public DataCubeUser getUserCumulate(LocalDateTime beginDate, LocalDateTime endDate) throws WxErrorException {
|
||||
public UserSummaryResponse getUserCumulate(LocalDateTime beginDate, LocalDateTime endDate) throws WxErrorException {
|
||||
if (!(ObjectUtils.isNotEmpty(beginDate) && ObjectUtils.isNotEmpty(endDate) && endDate.isAfter(beginDate))) {
|
||||
log.warn("The begin date [{}] Or end date [{}] was null or ender date greater than begin date.", beginDate, endDate);
|
||||
throw new DataStructureException("Query data range error ");
|
||||
@ -112,38 +120,5 @@ public class WeChatDataCubeService {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param beginDate
|
||||
* @param endDate
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
public DataCubeArticle getArticleSummary(LocalDateTime beginDate, LocalDateTime endDate) throws WxErrorException {
|
||||
try {
|
||||
return weChatOfficialAccountApi.getarticlesummary(getDataCubeRequest(beginDate, endDate)).blockingGet();
|
||||
} catch (HttpException ex) {
|
||||
log.warn("Call WeChat API with error: " + ex);
|
||||
if (ex.code() == 400) {
|
||||
throw new WxErrorException(ex);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private DataCubeRequest getDataCubeRequest(LocalDateTime beginDate, LocalDateTime endDate) throws DataStructureException {
|
||||
if (!(ObjectUtils.isNotEmpty(beginDate) && ObjectUtils.isNotEmpty(endDate) && endDate.isAfter(beginDate))) {
|
||||
log.warn("The begin date [{}] Or end date [{}] was null or ender date greater than begin date.", beginDate, endDate);
|
||||
throw new DataStructureException("Query data range error ");
|
||||
}
|
||||
|
||||
DataCubeRequest dataCubeRequest = new DataCubeRequest();
|
||||
dataCubeRequest.setBeginDate(beginDate.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
dataCubeRequest.setEndDate(endDate.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||
|
||||
return dataCubeRequest;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,90 +0,0 @@
|
||||
package com.ossez.wechat.oa.api.impl.okhttp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.ossez.wechat.common.constant.WeChatConstant;
|
||||
import com.ossez.wechat.common.exception.DataStructureException;
|
||||
import com.ossez.wechat.common.exception.WxErrorException;
|
||||
import com.ossez.wechat.common.model.WeChatStatus;
|
||||
import com.ossez.wechat.common.model.req.DataCubeRequest;
|
||||
import com.ossez.wechat.common.model.req.MenuRequest;
|
||||
import com.ossez.wechat.common.model.res.DataCubeArticle;
|
||||
import com.ossez.wechat.common.model.res.DataCubeUser;
|
||||
import com.ossez.wechat.oa.api.WeChatOfficialAccountService;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.interceptor.AuthenticationInterceptor;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.interceptor.WeChatErrorInterceptor;
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import retrofit2.HttpException;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
import retrofit2.converter.jackson.JacksonConverterFactory;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* WeChat Official Account Platform DataCube
|
||||
*
|
||||
* @author YuCheng
|
||||
*/
|
||||
public class WeChatMenuService {
|
||||
private final Logger log = LoggerFactory.getLogger(WeChatMenuService.class);
|
||||
|
||||
private WeChatOfficialAccountApi weChatOfficialAccountApi;
|
||||
|
||||
public WeChatMenuService(WeChatOfficialAccountService weChatOfficialAccountService) {
|
||||
String accessToken = null;
|
||||
try {
|
||||
accessToken = weChatOfficialAccountService.getAccessToken();
|
||||
} catch (WxErrorException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.setSerializationInclusion(Include.NON_NULL);
|
||||
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
|
||||
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
.addInterceptor(new AuthenticationInterceptor(accessToken))
|
||||
.addInterceptor(new WeChatErrorInterceptor())
|
||||
.connectionPool(new ConnectionPool(5, 1, TimeUnit.SECONDS)).readTimeout(1000, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
Retrofit retrofit = new Retrofit.Builder().baseUrl(WeChatConstant.ENDPOINT_WECHAT).client(client)
|
||||
.addConverterFactory(JacksonConverterFactory.create(mapper))
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
|
||||
this.weChatOfficialAccountApi = retrofit.create(WeChatOfficialAccountApi.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param menuRequest
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
public WeChatStatus create(MenuRequest menuRequest) throws WxErrorException {
|
||||
try {
|
||||
|
||||
return weChatOfficialAccountApi.createMenu(menuRequest).blockingGet();
|
||||
} catch (HttpException ex) {
|
||||
log.warn("Call WeChat API with error: " + ex);
|
||||
if (ex.code() == 400) {
|
||||
throw new WxErrorException(ex);
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -56,8 +56,10 @@ public class WeChatMsgService {
|
||||
.build();
|
||||
|
||||
this.weChatOfficialAccountApi = retrofit.create(WeChatOfficialAccountApi.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String sendMessage(CustomMessage customMessage) throws WxErrorException {
|
||||
|
||||
try {
|
||||
|
@ -3,11 +3,13 @@ package com.ossez.wechat.oa.api.impl.okhttp;
|
||||
import com.ossez.wechat.common.model.WeChatAccessToken;
|
||||
import com.ossez.wechat.common.model.WeChatApiDomainIp;
|
||||
import com.ossez.wechat.common.model.WeChatStatus;
|
||||
import com.ossez.wechat.common.model.req.*;
|
||||
import com.ossez.wechat.common.model.res.DataCubeArticle;
|
||||
import com.ossez.wechat.common.model.req.CustomMessage;
|
||||
import com.ossez.wechat.common.model.req.DataCubeRequest;
|
||||
import com.ossez.wechat.common.model.req.NetworkCheck;
|
||||
import com.ossez.wechat.common.model.req.QueryQuota;
|
||||
import com.ossez.wechat.common.model.res.NetworkCheckResponse;
|
||||
import com.ossez.wechat.common.model.res.QueryQuotaResponse;
|
||||
import com.ossez.wechat.common.model.res.DataCubeUser;
|
||||
import com.ossez.wechat.common.model.res.UserSummaryResponse;
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
@ -34,35 +36,10 @@ public interface WeChatOfficialAccountApi {
|
||||
@POST("/cgi-bin/message/custom/send")
|
||||
Single<WeChatStatus> sendMessage(@Body CustomMessage customMessage);
|
||||
|
||||
// MENU
|
||||
@POST("/cgi-bin/menu/create")
|
||||
Single<WeChatStatus> createMenu(@Body MenuRequest menuRequest);
|
||||
|
||||
@GET("/cgi-bin/get_current_selfmenu_info")
|
||||
Single<WeChatStatus> getMenu();
|
||||
|
||||
// DATA ANALYST
|
||||
@POST("/datacube/getusersummary")
|
||||
Single<DataCubeUser> getUserSummary(@Body DataCubeRequest dataCubeRequest);
|
||||
Single<UserSummaryResponse> getUserSummary(@Body DataCubeRequest dataCubeRequest);
|
||||
|
||||
@POST("/datacube/getusercumulate")
|
||||
Single<DataCubeUser> getUserCumulate(@Body DataCubeRequest dataCubeRequest);
|
||||
|
||||
@POST("/datacube/getarticlesummary")
|
||||
Single<DataCubeArticle> getarticlesummary(@Body DataCubeRequest dataCubeRequest);
|
||||
|
||||
@POST("/datacube/getarticletotal")
|
||||
Single<DataCubeUser> getarticletotal(@Body DataCubeRequest dataCubeRequest);
|
||||
|
||||
@POST("/datacube/getuserread")
|
||||
Single<DataCubeUser> getuserread(@Body DataCubeRequest dataCubeRequest);
|
||||
|
||||
@POST("/datacube/getuserreadhour")
|
||||
Single<DataCubeUser> getuserreadhour(@Body DataCubeRequest dataCubeRequest);
|
||||
|
||||
@POST("/datacube/getusershare")
|
||||
Single<DataCubeUser> getusershare(@Body DataCubeRequest dataCubeRequest);
|
||||
|
||||
@POST("/datacube/getusersharehour")
|
||||
Single<DataCubeUser> getusersharehour(@Body DataCubeRequest dataCubeRequest);
|
||||
Single<UserSummaryResponse> getUserCumulate(@Body DataCubeRequest dataCubeRequest);
|
||||
}
|
@ -5,8 +5,8 @@ import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import com.ossez.wechat.common.model.entity.menu.MenuButton;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenuRule;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenuButton;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenuRule;
|
||||
import com.ossez.wechat.common.util.json.WxGsonBuilder;
|
||||
import com.ossez.wechat.oa.util.json.WxMpGsonBuilder;
|
||||
|
||||
@ -46,7 +46,7 @@ public class WxMpMenu implements Serializable {
|
||||
private static final long serialVersionUID = -2279946921755382289L;
|
||||
|
||||
@SerializedName("button")
|
||||
private List<MenuButton> buttons;
|
||||
private List<WxMenuButton> buttons;
|
||||
@SerializedName("matchrule")
|
||||
private WxMenuRule rule;
|
||||
@SerializedName("menuid")
|
||||
|
@ -3,8 +3,7 @@ package com.ossez.wechat.oa.api.impl;
|
||||
import com.google.inject.Inject;
|
||||
import com.ossez.wechat.common.exception.DataStructureException;
|
||||
import com.ossez.wechat.common.exception.WxErrorException;
|
||||
import com.ossez.wechat.common.model.res.DataCubeArticle;
|
||||
import com.ossez.wechat.common.model.res.DataCubeUser;
|
||||
import com.ossez.wechat.common.model.res.UserSummaryResponse;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.WeChatDataCubeService;
|
||||
import com.ossez.wechat.oa.api.test.TestBase;
|
||||
import com.ossez.wechat.oa.api.test.TestConfigStorage;
|
||||
@ -33,35 +32,23 @@ public class DataCubeServiceTest extends TestBase {
|
||||
|
||||
@Test
|
||||
public void testGetUserSummarye() throws WxErrorException, DataStructureException {
|
||||
DataCubeUser dataCubeUser = weChatDataCubeService.getUserSummary(LocalDateTime.now().minusDays(4), LocalDateTime.now().minusDays(1));
|
||||
UserSummaryResponse userSummaryResponse = weChatDataCubeService.getUserSummary(LocalDateTime.now().minusDays(4), LocalDateTime.now().minusDays(1));
|
||||
|
||||
assertThat(dataCubeUser).isNotNull();
|
||||
assertThat(dataCubeUser.getUserDataList().size()).isEqualTo(4);
|
||||
assertThat(dataCubeUser.getUserDataList().get(0).getCancelUser()).isGreaterThanOrEqualTo(0);
|
||||
assertThat(userSummaryResponse).isNotNull();
|
||||
assertThat(userSummaryResponse.getUserDataList().size()).isEqualTo(4);
|
||||
assertThat(userSummaryResponse.getUserDataList().get(0).getCancelUser()).isGreaterThanOrEqualTo(0);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUserCumulate() throws WxErrorException {
|
||||
DataCubeUser dataCubeUser = weChatDataCubeService.getUserCumulate(LocalDateTime.now().minusDays(4), LocalDateTime.now().minusDays(1));
|
||||
UserSummaryResponse userSummaryResponse = weChatDataCubeService.getUserCumulate(LocalDateTime.now().minusDays(4), LocalDateTime.now().minusDays(1));
|
||||
|
||||
assertThat(dataCubeUser).isNotNull();
|
||||
assertThat(dataCubeUser.getUserDataList().size()).isEqualTo(4);
|
||||
assertThat(dataCubeUser.getUserDataList().get(0).getCumulateUser()).isGreaterThanOrEqualTo(0);
|
||||
assertThat(userSummaryResponse).isNotNull();
|
||||
assertThat(userSummaryResponse.getUserDataList().size()).isEqualTo(4);
|
||||
assertThat(userSummaryResponse.getUserDataList().get(0).getCumulateUser()).isGreaterThanOrEqualTo(0);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetarticlesummary() throws WxErrorException {
|
||||
DataCubeArticle dataCubeArticle = weChatDataCubeService.getArticleSummary(LocalDateTime.now().minusDays(12), LocalDateTime.now().minusDays(12));
|
||||
|
||||
assertThat(dataCubeArticle).isNotNull();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// @Test(dataProvider = "oneDay")
|
||||
// public void testGetArticleSummary(Date date) throws WxErrorException {
|
||||
|
@ -1,76 +0,0 @@
|
||||
package com.ossez.wechat.oa.api.impl;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.ossez.wechat.common.exception.WxErrorException;
|
||||
import com.ossez.wechat.common.model.WeChatStatus;
|
||||
import com.ossez.wechat.common.model.entity.builder.MenuButtonBuilder;
|
||||
import com.ossez.wechat.common.model.entity.menu.MenuButton;
|
||||
import com.ossez.wechat.common.model.req.MenuRequest;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.WeChatMenuService;
|
||||
import com.ossez.wechat.oa.api.test.TestBase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
import org.junit.jupiter.api.TestInstance.Lifecycle;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Test for datacube API
|
||||
*
|
||||
* @author YuCheng
|
||||
*/
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
public class MenuServiceTest extends TestBase {
|
||||
private static final Logger log = LoggerFactory.getLogger(TestBase.class);
|
||||
@Inject
|
||||
protected WeChatMenuService weChatMenuService;
|
||||
|
||||
/**
|
||||
* Test Create Menu
|
||||
*
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Test
|
||||
public void testCreate() throws WxErrorException {
|
||||
log.debug("Create WeChat Offical Account Menun Test");
|
||||
MenuRequest menuRequest = new MenuRequest();
|
||||
|
||||
List<MenuButton> buttonList = new ArrayList<>();
|
||||
|
||||
List<MenuButton> menuLinkButtonList = new ArrayList<>();
|
||||
menuLinkButtonList.add(new MenuButtonBuilder()
|
||||
.setType("view")
|
||||
.setName("地产经纪")
|
||||
.setUrl("https://www.verani.com/").createMenuButton());
|
||||
|
||||
|
||||
menuLinkButtonList.add(new MenuButtonBuilder()
|
||||
.setType("view")
|
||||
.setName("置业科普")
|
||||
.setUrl("https://www.isharkfly.com/c/realestate/8").createMenuButton());
|
||||
|
||||
menuLinkButtonList.add(new MenuButtonBuilder()
|
||||
.setType("view")
|
||||
.setName("USVisaTrack")
|
||||
.setUrl("https://www.usvisatrack.com/").createMenuButton());
|
||||
|
||||
MenuButton buttonTop = new MenuButtonBuilder().createMenuButton();
|
||||
buttonTop.setName("Shark 服务");
|
||||
buttonTop.setSubButtonList(menuLinkButtonList);
|
||||
buttonList.add(buttonTop);
|
||||
|
||||
menuRequest.setButtonList(buttonList);
|
||||
|
||||
WeChatStatus weChatStatus = weChatMenuService.create(menuRequest);
|
||||
|
||||
assertThat(weChatStatus).isNotNull();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -2,9 +2,8 @@ package com.ossez.wechat.oa.api.impl;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.ossez.wechat.common.constant.WeChatConstant;
|
||||
import com.ossez.wechat.common.model.entity.builder.MenuButtonBuilder;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.model.entity.menu.MenuButton;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenuButton;
|
||||
import com.ossez.wechat.common.exception.WxErrorException;
|
||||
import com.ossez.wechat.oa.api.WeChatOfficialAccountService;
|
||||
import com.ossez.wechat.oa.api.test.ApiTestModule;
|
||||
@ -201,7 +200,7 @@ public class WxMpMenuServiceImplTest {
|
||||
@DataProvider(name = "menu")
|
||||
public Object[][] getMenu() {
|
||||
WxMenu menu = new WxMenu();
|
||||
MenuButton button1 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button1 = new WxMenuButton();
|
||||
button1.setType(WeChatConstant.MenuButtonType.CLICK);
|
||||
button1.setName("今日歌曲");
|
||||
button1.setKey("V1001_TODAY_MUSIC");
|
||||
@ -213,31 +212,31 @@ public class WxMpMenuServiceImplTest {
|
||||
// button2.setPagePath("pages/lunar/index.html");
|
||||
// button2.setUrl("http://mp.weixin.qq.com");
|
||||
|
||||
MenuButton button3 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button3 = new WxMenuButton();
|
||||
button3.setName("菜单");
|
||||
|
||||
menu.getButtons().add(button1);
|
||||
// menu.getButtons().add(button2);
|
||||
menu.getButtons().add(button3);
|
||||
|
||||
MenuButton button31 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button31 = new WxMenuButton();
|
||||
button31.setType(WeChatConstant.MenuButtonType.VIEW);
|
||||
button31.setName("搜索");
|
||||
button31.setUrl("http://www.soso.com/");
|
||||
|
||||
MenuButton button32 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button32 = new WxMenuButton();
|
||||
button32.setType(WeChatConstant.MenuButtonType.VIEW);
|
||||
button32.setName("视频");
|
||||
button32.setUrl("http://v.qq.com/");
|
||||
|
||||
MenuButton button33 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button33 = new WxMenuButton();
|
||||
button33.setType(WeChatConstant.MenuButtonType.CLICK);
|
||||
button33.setName("赞一下我们");
|
||||
button33.setKey("V1001_GOOD");
|
||||
|
||||
// button3.getSubButtons().add(button31);
|
||||
// button3.getSubButtons().add(button32);
|
||||
// button3.getSubButtons().add(button33);
|
||||
button3.getSubButtons().add(button31);
|
||||
button3.getSubButtons().add(button32);
|
||||
button3.getSubButtons().add(button33);
|
||||
|
||||
return new Object[][]{
|
||||
new Object[]{
|
||||
|
@ -6,7 +6,6 @@ import com.google.inject.Injector;
|
||||
import com.ossez.wechat.common.exception.WxRuntimeException;
|
||||
import com.ossez.wechat.oa.api.WeChatOfficialAccountService;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.WeChatDataCubeService;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.WeChatMenuService;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.WeChatMsgService;
|
||||
import com.ossez.wechat.oa.api.impl.okhttp.WeChatOfficialAccountServiceOkHttp;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@ -62,13 +61,11 @@ public class TestBase {
|
||||
// Init WeChatMsgService
|
||||
WeChatMsgService weChatMsgService = new WeChatMsgService(weChatOfficialAccountService);
|
||||
WeChatDataCubeService weChatDataCubeService = new WeChatDataCubeService(weChatOfficialAccountService);
|
||||
WeChatMenuService weChatMenuService = new WeChatMenuService(weChatOfficialAccountService);
|
||||
|
||||
bind(TestConfigStorage.class).toInstance(config);
|
||||
bind(WeChatOfficialAccountService.class).toInstance(weChatOfficialAccountService);
|
||||
bind(WeChatMsgService.class).toInstance(weChatMsgService);
|
||||
bind(WeChatDataCubeService.class).toInstance(weChatDataCubeService);
|
||||
bind(WeChatMenuService.class).toInstance(weChatMenuService);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} catch (DocumentException e) {
|
||||
|
@ -1,16 +0,0 @@
|
||||
<xml>
|
||||
<appId>***</appId>
|
||||
<secret>***</secret>
|
||||
<token>***</token>
|
||||
<aesKey>公众号EncodingAESKey</aesKey>
|
||||
<accessToken>可以不填写</accessToken>
|
||||
<expiresTime>可以不填写</expiresTime>
|
||||
<openid>o9phd5jz_We8mPs1ovmyjud97Ock</openid>
|
||||
<partnerId>微信商户平台ID</partnerId>
|
||||
<partnerKey>商户平台设置的API密钥</partnerKey>
|
||||
<keyPath>商户平台的证书文件地址</keyPath>
|
||||
<templateId>模版消息的模版ID</templateId>
|
||||
<oauth2redirectUri>网页授权获取用户信息回调地址</oauth2redirectUri>
|
||||
<qrconnectRedirectUrl>网页应用授权登陆回调地址</qrconnectRedirectUrl>
|
||||
<kfAccount>完整客服账号,格式为:账号前缀@公众号微信号</kfAccount>
|
||||
</xml>
|
34
pom.xml
34
pom.xml
@ -479,23 +479,23 @@
|
||||
<release>11</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
||||
<!-- <artifactId>maven-gpg-plugin</artifactId>-->
|
||||
<!-- <version>3.0.1</version>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <id>sign-artifacts</id>-->
|
||||
<!-- <phase>verify</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>sign</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <passphraseServerId>ossez</passphraseServerId>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<passphraseServerId>ossez</passphraseServerId>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ossez.wechat.wecom.api;
|
||||
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.exception.WxErrorException;
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ossez.wechat.wecom.api.impl;
|
||||
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.exception.WxErrorException;
|
||||
import com.ossez.wechat.wecom.api.WxCpMenuService;
|
||||
import com.ossez.wechat.wecom.api.WxCpService;
|
||||
|
@ -2,7 +2,7 @@ package com.ossez.wechat.wecom.util.json;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.exception.WxError;
|
||||
import com.ossez.wechat.common.util.json.WxErrorAdapter;
|
||||
import com.ossez.wechat.wecom.bean.WxCpChat;
|
||||
|
@ -3,7 +3,7 @@ package com.ossez.wechat.wecom.util.json;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.util.json.WxMenuGsonAdapter;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
@ -16,8 +16,8 @@ import java.lang.reflect.Type;
|
||||
*/
|
||||
public class WxCpMenuGsonAdapter extends WxMenuGsonAdapter {
|
||||
|
||||
// @Override
|
||||
// public WxMenu deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
// return this.buildMenuFromJson(json.getAsJsonObject().get("button").getAsJsonArray());
|
||||
// }
|
||||
@Override
|
||||
public WxMenu deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
return this.buildMenuFromJson(json.getAsJsonObject().get("button").getAsJsonArray());
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package com.ossez.wechat.wecom.api.impl;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.ossez.wechat.common.model.entity.builder.MenuButtonBuilder;
|
||||
import com.ossez.wechat.common.model.entity.menu.WxMenu;
|
||||
import com.ossez.wechat.common.model.entity.menu.MenuButton;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenu;
|
||||
import com.ossez.wechat.common.bean.menu.WxMenuButton;
|
||||
import com.ossez.wechat.common.constant.WeChatConstant;
|
||||
import com.ossez.wechat.wecom.api.ApiTestModule;
|
||||
import com.ossez.wechat.wecom.api.WxCpService;
|
||||
@ -35,42 +34,42 @@ public class WxCpMenuServiceImplTest {
|
||||
@DataProvider
|
||||
public Object[][] menuData() {
|
||||
WxMenu menu = new WxMenu();
|
||||
MenuButton button1 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button1 = new WxMenuButton();
|
||||
Object WxConsts;
|
||||
button1.setType(WeChatConstant.MenuButtonType.CLICK);
|
||||
button1.setName("今日歌曲");
|
||||
button1.setKey("V1001_TODAY_MUSIC");
|
||||
|
||||
MenuButton button2 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button2 = new WxMenuButton();
|
||||
button2.setType(WeChatConstant.MenuButtonType.CLICK);
|
||||
button2.setName("歌手简介");
|
||||
button2.setKey("V1001_TODAY_SINGER");
|
||||
|
||||
MenuButton button3 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button3 = new WxMenuButton();
|
||||
button3.setName("菜单");
|
||||
|
||||
menu.getButtons().add(button1);
|
||||
menu.getButtons().add(button2);
|
||||
menu.getButtons().add(button3);
|
||||
|
||||
MenuButton button31 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button31 = new WxMenuButton();
|
||||
button31.setType(WeChatConstant.MenuButtonType.VIEW);
|
||||
button31.setName("搜索");
|
||||
button31.setUrl("http://www.soso.com/");
|
||||
|
||||
MenuButton button32 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button32 = new WxMenuButton();
|
||||
button32.setType(WeChatConstant.MenuButtonType.VIEW);
|
||||
button32.setName("视频");
|
||||
button32.setUrl("http://v.qq.com/");
|
||||
|
||||
MenuButton button33 = new MenuButtonBuilder().createMenuButton();
|
||||
WxMenuButton button33 = new WxMenuButton();
|
||||
button33.setType(WeChatConstant.MenuButtonType.CLICK);
|
||||
button33.setName("赞一下我们");
|
||||
button33.setKey("V1001_GOOD");
|
||||
|
||||
// button3.getSubButtons().add(button31);
|
||||
// button3.getSubButtons().add(button32);
|
||||
// button3.getSubButtons().add(button33);
|
||||
button3.getSubButtons().add(button31);
|
||||
button3.getSubButtons().add(button32);
|
||||
button3.getSubButtons().add(button33);
|
||||
|
||||
return new Object[][]{
|
||||
new Object[]{
|
||||
|
Loading…
x
Reference in New Issue
Block a user