Commit fdfdbcb5 authored by xianjun's avatar xianjun

创建微信小程序接口实体

parent fdb9020f
...@@ -17,6 +17,18 @@ public class WxXcxConfig { ...@@ -17,6 +17,18 @@ public class WxXcxConfig {
@Value("${yzg.wx.xcx.url:https://api.weixin.qq.com}") @Value("${yzg.wx.xcx.url:https://api.weixin.qq.com}")
private String baseUrl; private String baseUrl;
/**
* 公共URI
*/
@Value("${yzg.wx.xcx.appid:wxd70bc341df16d0b8}")
private String appid;
/**
* 公共URI
*/
@Value("${yzg.wx.xcx.secret:a8a4bc5f1dc5cde3c9abddf107c5598e}")
private String secret;
/** /**
* 登录凭证校验 * 登录凭证校验
*/ */
...@@ -123,13 +135,13 @@ public class WxXcxConfig { ...@@ -123,13 +135,13 @@ public class WxXcxConfig {
/** /**
* 发送客服消息给用户 * 发送客服消息给用户
*/ */
@Value("${yzg.wx.xcx.customerServiceMessageSend:/cgi-bin/message/custom/send}") @Value("${yzg.wx.xcx.customerServiceMessageSend:/cgi-bin/message/custom/business/send}")
private String customerServiceMessageSend; private String customerServiceMessageSend;
/** /**
* 下发客服当前输入状态给用户 * 下发客服当前输入状态给用户
*/ */
@Value("${yzg.wx.xcx.customerServiceMessageSetTyping:/cgi-bin/message/custom/typing}") @Value("${yzg.wx.xcx.customerServiceMessageSetTyping:/cgi-bin/message/custom/business/typing}")
private String customerServiceMessageSetTyping; private String customerServiceMessageSetTyping;
/** /**
...@@ -276,10 +288,48 @@ public class WxXcxConfig { ...@@ -276,10 +288,48 @@ public class WxXcxConfig {
@Value("${yzg.wx.xcx.redPacketCoverGetAuthenticationUrl:/redpacketcover/wxapp/cover_url/get_by_token}") @Value("${yzg.wx.xcx.redPacketCoverGetAuthenticationUrl:/redpacketcover/wxapp/cover_url/get_by_token}")
private String redPacketCoverGetAuthenticationUrl; private String redPacketCoverGetAuthenticationUrl;
/**
* 重置 API 调用次数
*/
@Value("${yzg.wx.xcx.clearQuota:/cgi-bin/clear_quota}")
private String clearQuota;
/**
* 查询API调用额度
*/
@Value("${yzg.wx.xcx.clearQuota:/cgi-bin/openapi/quota/get}")
private String getApiQuota;
/**
* 查询RID信息
*/
@Value("${yzg.wx.xcx.clearQuota:/cgi-bin/openapi/rid/get}")
private String getRidInfo;
public String getGetApiQuota() {
return getApiQuota;
}
public String getGetRidInfo() {
return getRidInfo;
}
public String getClearQuota() {
return clearQuota;
}
public String getBaseUrl() { public String getBaseUrl() {
return baseUrl; return baseUrl;
} }
public String getAppid() {
return appid;
}
public String getSecret() {
return secret;
}
public String getAuthCode2SessionUrl() { public String getAuthCode2SessionUrl() {
return authCode2SessionUrl; return authCode2SessionUrl;
} }
......
package com.yanzuoguang.wxxcx.openapimanage;
/**
* 重置 API 调用次数 请求
*
* @author 李贤军
*/
public class WxXcxOpenApiManageClearQuotaReq {
/**
* 第三方平台接口调用凭证authorizer_access_token,该参数为 URL 参数,非 Body 参数。
*/
private String access_token;
/**
* 要被清空的账号的appid
*/
private String appid;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
}
package com.yanzuoguang.wxxcx.openapimanage;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
import com.yanzuoguang.wxxcx.nearbypoi.WxXcxNearbyPoiAddReq;
import com.yanzuoguang.wxxcx.nearbypoi.WxXcxNearbyPoiAddRes;
/**
* 重置 API 调用次数 转换
*
* @author 李贤军
*/
public class WxXcxOpenApiManageClearQuotaRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxXcxOpenApiManageClearQuotaReq req;
public WxXcxOpenApiManageClearQuotaRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxXcxOpenApiManageClearQuotaReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getClearQuota() + "?" + this.getUrlPara();
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
public WxXcxOpenApiManageClearQuotaRes getResponse() {
// todo: 检测参数是否合法
// Assert.assertEquals();
return this.wxXcxRequest.request(this, response -> {
WxXcxOpenApiManageClearQuotaRes ret = JsonHelper.deserialize(response, new TypeReference<WxXcxOpenApiManageClearQuotaRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
\ No newline at end of file
package com.yanzuoguang.wxxcx.openapimanage;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
/**
* 重置 API 调用次数 响应
*
* @author 李贤军
*/
public class WxXcxOpenApiManageClearQuotaRes extends WxXcxResponseBaseError {
}
package com.yanzuoguang.wxxcx.openapimanage;
/**
* 查询 API 调用额度 响应详情
*
* @author 李贤军
*/
public class WxXcxOpenApiManageGetApiQuotaQuotaRes {
/**
* 当天该账号可调用该接口的次数
*/
private int daily_limit;
/**
* 当天已经调用的次数
*/
private int used;
/**
* 当天剩余调用次数
*/
private int remain;
public int getDaily_limit() {
return daily_limit;
}
public void setDaily_limit(int daily_limit) {
this.daily_limit = daily_limit;
}
public int getUsed() {
return used;
}
public void setUsed(int used) {
this.used = used;
}
public int getRemain() {
return remain;
}
public void setRemain(int remain) {
this.remain = remain;
}
}
package com.yanzuoguang.wxxcx.openapimanage;
/**
* 查询 API 调用额度 请求
*
* @author 李贤军
*/
public class WxXcxOpenApiManageGetApiQuotaReq {
/**
* 第三方平台接口调用凭证authorizer_access_token,该参数为 URL 参数,非 Body 参数
*/
private String access_token;
/**
* api的请求地址,例如"/cgi-bin/message/custom/send";不要前缀“https://api.weixin.qq.com” ,也不要漏了"/",否则都会76003的报错
*/
private String cgi_path;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getCgi_path() {
return cgi_path;
}
public void setCgi_path(String cgi_path) {
this.cgi_path = cgi_path;
}
}
package com.yanzuoguang.wxxcx.openapimanage;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
/**
* 查询 API 调用额度 转换
*
* @author 李贤军
*/
public class WxXcxOpenApiManageGetApiQuotaRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxXcxOpenApiManageGetApiQuotaReq req;
public WxXcxOpenApiManageGetApiQuotaRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxXcxOpenApiManageGetApiQuotaReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getGetApiQuota() + "?" + this.getUrlPara();
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
public WxXcxOpenApiManageGetApiQuotaRes getResponse() {
// todo: 检测参数是否合法
// Assert.assertEquals();
return this.wxXcxRequest.request(this, response -> {
WxXcxOpenApiManageGetApiQuotaRes ret = JsonHelper.deserialize(response, new TypeReference<WxXcxOpenApiManageGetApiQuotaRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
\ No newline at end of file
package com.yanzuoguang.wxxcx.openapimanage;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
/**
* 查询 API 调用额度 响应
*
* @author 李贤军
*/
public class WxXcxOpenApiManageGetApiQuotaRes extends WxXcxResponseBaseError {
private WxXcxOpenApiManageGetApiQuotaQuotaRes quota;
public WxXcxOpenApiManageGetApiQuotaQuotaRes getQuota() {
return quota;
}
public void setQuota(WxXcxOpenApiManageGetApiQuotaQuotaRes quota) {
this.quota = quota;
}
}
package com.yanzuoguang.wxxcx.openapimanage;
/**
* 查询 RID 信息 请求
*
* @author 李贤军
*/
public class WxXcxOpenApiManageGetRidInfoReq {
/**
* 第三方平台接口调用凭证authorizer_access_token,该参数为 URL 参数,非 Body 参数。
*/
private String access_token;
/**
* 调用接口报错返回的rid
*/
private String rid;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getRid() {
return rid;
}
public void setRid(String rid) {
this.rid = rid;
}
}
package com.yanzuoguang.wxxcx.openapimanage;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
/**
* 查询 RID 信息 转换
*
* @author 李贤军
*/
public class WxXcxOpenApiManageGetRidInfoRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxXcxOpenApiManageGetRidInfoReq req;
public WxXcxOpenApiManageGetRidInfoRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxXcxOpenApiManageGetRidInfoReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getGetRidInfo() + "?" + this.getUrlPara();
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
public WxXcxOpenApiManageGetRidInfoRes getResponse() {
// todo: 检测参数是否合法
// Assert.assertEquals();
return this.wxXcxRequest.request(this, response -> {
WxXcxOpenApiManageGetRidInfoRes ret = JsonHelper.deserialize(response, new TypeReference<WxXcxOpenApiManageGetRidInfoRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
\ No newline at end of file
package com.yanzuoguang.wxxcx.openapimanage;
/**
* @author 李贤军
*/
public class WxXcxOpenApiManageGetRidInfoRequestRes {
/**
* 发起请求的时间戳
*/
private double invoke_time;
/**
* 请求毫秒级耗时
*/
private double cost_in_ms;
/**
* 请求的 URL 参数
*/
private String request_url;
/**
* post请求的请求参数
*/
private String request_body;
/**
* 接口请求返回参数
*/
private String response_body;
/**
* 接口请求的客户端ip
*/
private String client_ip;
public double getInvoke_time() {
return invoke_time;
}
public void setInvoke_time(double invoke_time) {
this.invoke_time = invoke_time;
}
public double getCost_in_ms() {
return cost_in_ms;
}
public void setCost_in_ms(double cost_in_ms) {
this.cost_in_ms = cost_in_ms;
}
public String getRequest_url() {
return request_url;
}
public void setRequest_url(String request_url) {
this.request_url = request_url;
}
public String getRequest_body() {
return request_body;
}
public void setRequest_body(String request_body) {
this.request_body = request_body;
}
public String getResponse_body() {
return response_body;
}
public void setResponse_body(String response_body) {
this.response_body = response_body;
}
public String getClient_ip() {
return client_ip;
}
public void setClient_ip(String client_ip) {
this.client_ip = client_ip;
}
}
package com.yanzuoguang.wxxcx.openapimanage;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
/**
* 查询 RID 信息 响应
*
* @author 李贤军
*/
public class WxXcxOpenApiManageGetRidInfoRes extends WxXcxResponseBaseError {
/**
* 查询 RID 信息 响应详情
*/
private WxXcxOpenApiManageGetRidInfoRequestRes request;
public WxXcxOpenApiManageGetRidInfoRequestRes getRequest() {
return request;
}
public void setRequest(WxXcxOpenApiManageGetRidInfoRequestRes request) {
this.request = request;
}
}
...@@ -26,6 +26,7 @@ public class WxXcxAuthLoginImpl implements WxXcxAuthLogin { ...@@ -26,6 +26,7 @@ public class WxXcxAuthLoginImpl implements WxXcxAuthLogin {
/** /**
* 登录凭证校验。通过 wx.login 接口获得临时登录凭证 code 后传到开发者服务器调用此接口完成登录流程。更多使用方法详见 小程序登录。 * 登录凭证校验。通过 wx.login 接口获得临时登录凭证 code 后传到开发者服务器调用此接口完成登录流程。更多使用方法详见 小程序登录。
*
* @param wxXcxAuthCode2SessionReq 请求登录 * @param wxXcxAuthCode2SessionReq 请求登录
* @return * @return
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment