mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 07:23:01 +08:00
修复错误重构的代码,主要是api的url地址
This commit is contained in:
parent
1d2f2e2985
commit
bcbc10d277
@ -28,8 +28,8 @@ import java.util.UUID;
|
|||||||
* Created by Binary Wang on 2016/7/21.
|
* Created by Binary Wang on 2016/7/21.
|
||||||
*/
|
*/
|
||||||
public class WxMpMaterialServiceImpl implements WxMpMaterialService {
|
public class WxMpMaterialServiceImpl implements WxMpMaterialService {
|
||||||
private static final String MEDIA_API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/qrcode";
|
private static final String MEDIA_API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/media";
|
||||||
private static final String MATERIAL_API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/qrcode";
|
private static final String MATERIAL_API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/material";
|
||||||
private WxMpService wxMpService;
|
private WxMpService wxMpService;
|
||||||
|
|
||||||
public WxMpMaterialServiceImpl(WxMpService wxMpService) {
|
public WxMpMaterialServiceImpl(WxMpService wxMpService) {
|
||||||
|
@ -11,6 +11,7 @@ import me.chanjar.weixin.mp.api.WxMpService;
|
|||||||
* Created by Binary Wang on 2016/7/21.
|
* Created by Binary Wang on 2016/7/21.
|
||||||
*/
|
*/
|
||||||
public class WxMpMenuServiceImpl implements WxMpMenuService {
|
public class WxMpMenuServiceImpl implements WxMpMenuService {
|
||||||
|
private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/menu";
|
||||||
|
|
||||||
private WxMpService wxMpService;
|
private WxMpService wxMpService;
|
||||||
|
|
||||||
@ -21,29 +22,29 @@ public class WxMpMenuServiceImpl implements WxMpMenuService {
|
|||||||
@Override
|
@Override
|
||||||
public void menuCreate(WxMenu menu) throws WxErrorException {
|
public void menuCreate(WxMenu menu) throws WxErrorException {
|
||||||
if (menu.getMatchRule() != null) {
|
if (menu.getMatchRule() != null) {
|
||||||
String url = "https://api.weixin.qq.com/cgi-bin/menu/addconditional";
|
String url = API_URL_PREFIX + "/addconditional";
|
||||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url, menu.toJson());
|
this.wxMpService.execute(new SimplePostRequestExecutor(), url, menu.toJson());
|
||||||
} else {
|
} else {
|
||||||
String url = "https://api.weixin.qq.com/cgi-bin/menu/create";
|
String url = API_URL_PREFIX + "/create";
|
||||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url, menu.toJson());
|
this.wxMpService.execute(new SimplePostRequestExecutor(), url, menu.toJson());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void menuDelete() throws WxErrorException {
|
public void menuDelete() throws WxErrorException {
|
||||||
String url = "https://api.weixin.qq.com/cgi-bin/menu/delete";
|
String url = API_URL_PREFIX + "/delete";
|
||||||
this.wxMpService.execute(new SimpleGetRequestExecutor(), url, null);
|
this.wxMpService.execute(new SimpleGetRequestExecutor(), url, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void menuDelete(String menuid) throws WxErrorException {
|
public void menuDelete(String menuid) throws WxErrorException {
|
||||||
String url = "https://api.weixin.qq.com/cgi-bin/menu/delconditional";
|
String url = API_URL_PREFIX + "/delconditional";
|
||||||
this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "menuid=" + menuid);
|
this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "menuid=" + menuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxMenu menuGet() throws WxErrorException {
|
public WxMenu menuGet() throws WxErrorException {
|
||||||
String url = "https://api.weixin.qq.com/cgi-bin/menu/get";
|
String url = API_URL_PREFIX + "/get";
|
||||||
try {
|
try {
|
||||||
String resultContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, null);
|
String resultContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, null);
|
||||||
return WxMenu.fromJson(resultContent);
|
return WxMenu.fromJson(resultContent);
|
||||||
@ -58,7 +59,7 @@ public class WxMpMenuServiceImpl implements WxMpMenuService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxMenu menuTryMatch(String userid) throws WxErrorException {
|
public WxMenu menuTryMatch(String userid) throws WxErrorException {
|
||||||
String url = "https://api.weixin.qq.com/cgi-bin/menu/trymatch";
|
String url = API_URL_PREFIX + "/trymatch";
|
||||||
try {
|
try {
|
||||||
String resultContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "user_id=" + userid);
|
String resultContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "user_id=" + userid);
|
||||||
return WxMenu.fromJson(resultContent);
|
return WxMenu.fromJson(resultContent);
|
||||||
|
Loading…
Reference in New Issue
Block a user