当前位置: 首页>>代码示例>>Java>>正文


Java WxRespCode类代码示例

本文整理汇总了Java中org.hamster.weixinmp.model.WxRespCode的典型用法代码示例。如果您正苦于以下问题:Java WxRespCode类的具体用法?Java WxRespCode怎么用?Java WxRespCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WxRespCode类属于org.hamster.weixinmp.model包,在下文中一共展示了WxRespCode类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: menuCreate

import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public WxRespCode menuCreate(String accessToken, List<WxMenuBtnEntity> entities)
		throws WxException {
	Map<String, String> params = getAccessTokenParams(accessToken);

	GsonBuilder gsonBuilder = new GsonBuilder();
	gsonBuilder.registerTypeAdapter(WxUserEntity.class,
			new WxMenuBtnSerializer());
	Gson gson = gsonBuilder.create();
	
	WxMenuCreateJson wrapper = new WxMenuCreateJson(entities);
	wrapper.setButton(entities);

	try {
		return sendRequest(config.getMenuCreateUrl(), HttpMethod.POST, params,
				new StringEntity(gson.toJson(wrapper)),
				WxRespCode.class);
	} catch (UnsupportedEncodingException e) {
		throw new WxException(e);
	}
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:21,代码来源:WxMenuService.java

示例2: menuCreate

import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public WxRespCode menuCreate(String accessToken, List<WxMenuBtnEntity> entities)
		throws WxException {
	Map<String, String> params = getAccessTokenParams(accessToken);

	GsonBuilder gsonBuilder = new GsonBuilder();
	gsonBuilder.registerTypeAdapter(WxUserEntity.class,
			new WxMenuBtnSerializer());
	Gson gson = gsonBuilder.create();
	
	WxMenuCreateJson wrapper = new WxMenuCreateJson();
	wrapper.setButton(entities);

	try {
		return sendRequest(config.getMenuCreateUrl(), HttpMethod.POST, params,
				new StringEntity(gson.toJson(wrapper)),
				WxRespCode.class);
	} catch (UnsupportedEncodingException e) {
		throw new WxException(e);
	}
}
 
开发者ID:honeyzhaoAliyun,项目名称:WeixinMultiPlatform,代码行数:21,代码来源:WxMenuService.java

示例3: toWxErrorJson

import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public static final WxRespCode toWxErrorJson(String errorResult) {
	if (errorResult != null && (errorResult.startsWith("{\"errcode")
			|| errorResult.startsWith("{\"errmsg"))) {
		return new Gson().fromJson(errorResult, WxRespCode.class);
	}
	return null;
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:8,代码来源:WxJsonUtil.java

示例4: WxException

import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
/**
 * 
 */
public WxException(WxRespCode errorJson) {
	super(errorJson.getErrmsg());
	this.error = errorJson;
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:8,代码来源:WxException.java

示例5: menuDelete

import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public WxRespCode menuDelete(String accessToken) throws WxException {
	Map<String, String> params = getAccessTokenParams(accessToken);
	return sendRequest(config.getMenuDeleteUrl(), HttpMethod.GET, params, null,
			WxRespCode.class);
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:6,代码来源:WxMenuService.java

示例6: getError

import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public WxRespCode getError() {
	return error;
}
 
开发者ID:honeyzhaoAliyun,项目名称:WeixinMultiPlatform,代码行数:4,代码来源:WxException.java

示例7: setError

import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
public void setError(WxRespCode error) {
	this.error = error;
}
 
开发者ID:honeyzhaoAliyun,项目名称:WeixinMultiPlatform,代码行数:4,代码来源:WxException.java

示例8: remoteGroupsUpdate

import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
/**
 * http请求方式: POST(请使用https协议)<br>
 * https://api.weixin.qq.com/cgi-bin/groups/update?access_token=ACCESS_TOKEN<br>
 * POST数据格式:json<br>
 * POST数据例子:{"group":{"id":108,"name":"test2_modify2"}}<br>
 * 
 * {"errcode": 0, "errmsg": "ok"}<br>
 * 
 * @param id
 * @param name
 * @return
 * @throws WxException
 */
public WxRespCode remoteGroupsUpdate(String accessToken, Long id,
		String name) throws WxException {
	Map<String, Object> requestJson = new HashMap<String, Object>();
	Map<String, Object> l1Json = new HashMap<String, Object>();
	l1Json.put("id", id);
	l1Json.put("name", name);
	requestJson.put("group", l1Json);
	return sendRequest(config.getGroupsUpdateUrl(), HttpMethod.POST,
			getAccessTokenParams(accessToken), toJsonStringEntity(requestJson),
			WxRespCode.class);
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:25,代码来源:WxUserGroupService.java

示例9: remoteGroupsMembersUpdate

import org.hamster.weixinmp.model.WxRespCode; //导入依赖的package包/类
/**
 * http请求方式: POST(请使用https协议)<br>
 * https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token=
 * ACCESS_TOKEN<br>
 * POST数据格式:json<br>
 * POST数据例子:{"openid":"oDF3iYx0ro3_7jD4HFRDfrjdCM58","to_groupid":108}<br>
 * {"errcode": 0, "errmsg": "ok"}<br>
 * 
 * @param openid
 * @param to_groupid
 * @return
 * @throws WxException
 */
public WxRespCode remoteGroupsMembersUpdate(String accessToken,
		String openid, Long to_groupid) throws WxException {
	Map<String, Object> requestJson = new HashMap<String, Object>();
	requestJson.put("openid", openid);
	requestJson.put("to_groupid", to_groupid);
	return sendRequest(config.getGroupsMembersUpdateUrl(), HttpMethod.POST,
			getAccessTokenParams(accessToken), toJsonStringEntity(requestJson),
			WxRespCode.class);
}
 
开发者ID:Charlemin,项目名称:weixin-mp-java-master,代码行数:23,代码来源:WxUserGroupService.java


注:本文中的org.hamster.weixinmp.model.WxRespCode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。