Commit b1e0d659 authored by heyanou's avatar heyanou

增加硬件设备接口,小程序直播,运维中心,云开发,图像文字识别,及时配送,物流助手,广告(未写逻辑),微信服务市场,生物认证。

parent 48c8d366
package com.yanzuoguang.wxxcx.ad.req;
/***
* 回传广告数据
*
* @author:heyanou
*/
public class WxUserActionDataReq {
}
package com.yanzuoguang.wxxcx.ad.req;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetDataReq {
}
package com.yanzuoguang.wxxcx.ad.req;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetReportsDataReq {
}
package com.yanzuoguang.wxxcx.ad.req;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetsDataReq {
}
package com.yanzuoguang.wxxcx.ad.request;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.ad.req.WxUserActionDataReq;
import com.yanzuoguang.wxxcx.ad.res.WxUserActionDataRes;
import com.yanzuoguang.wxxcx.base.*;
/***
* 回传广告数据
*
* @author:heyanou
*/
public class WxUserActionDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxUserActionDataReq req;
public WxUserActionDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxUserActionDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getAdUserActionDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxUserActionDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxUserActionDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxUserActionDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.ad.request;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.ad.req.WxUserActionDataReq;
import com.yanzuoguang.wxxcx.ad.res.WxUserActionDataRes;
import com.yanzuoguang.wxxcx.ad.res.WxUserActionSetDataRes;
import com.yanzuoguang.wxxcx.base.*;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxUserActionDataReq req;
public WxUserActionSetDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxUserActionDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getAdUserActionSetDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxUserActionSetDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxUserActionSetDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxUserActionSetDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.ad.request;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.ad.req.WxUserActionDataReq;
import com.yanzuoguang.wxxcx.ad.req.WxUserActionSetReportsDataReq;
import com.yanzuoguang.wxxcx.ad.res.WxUserActionDataRes;
import com.yanzuoguang.wxxcx.ad.res.WxUserActionSetReportsDataRes;
import com.yanzuoguang.wxxcx.base.*;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetReportsDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxUserActionSetReportsDataReq req;
public WxUserActionSetReportsDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxUserActionSetReportsDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getAdUserActionSetReportsDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxUserActionSetReportsDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxUserActionSetReportsDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxUserActionSetReportsDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.ad.request;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.ad.req.WxUserActionDataReq;
import com.yanzuoguang.wxxcx.ad.res.WxUserActionDataRes;
import com.yanzuoguang.wxxcx.base.*;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetsDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxUserActionDataReq req;
public WxUserActionSetsDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxUserActionDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getAdUserActionSetDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxUserActionDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxUserActionDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxUserActionDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.ad.res;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
/***
* 回传广告数据
*
* @author:heyanou
*/
public class WxUserActionDataRes extends WxXcxResponseBaseError {
}
package com.yanzuoguang.wxxcx.ad.res;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetDataRes extends WxXcxResponseBaseError {
}
package com.yanzuoguang.wxxcx.ad.res;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetReportsDataRes extends WxXcxResponseBaseError {
}
package com.yanzuoguang.wxxcx.ad.res;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetsDataRes extends WxXcxResponseBaseError {
}
package com.yanzuoguang.wxxcx.ad.service;
/***
* 回传广告数据
*
* @author:heyanou
*/
public interface WxUserActionService {
}
package com.yanzuoguang.wxxcx.ad.service;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public interface WxUserActionSetReportsService {
}
package com.yanzuoguang.wxxcx.ad.service;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public interface WxUserActionSetService {
}
package com.yanzuoguang.wxxcx.ad.service;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public interface WxUserActionSetsService {
}
package com.yanzuoguang.wxxcx.ad.service.impl;
/***
* 回传广告数据
*
* @author:heyanou
*/
public class WxUserActionServiceImpl {
}
package com.yanzuoguang.wxxcx.ad.service.impl;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetReportsServiceImpl {
}
package com.yanzuoguang.wxxcx.ad.service.impl;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetServiceImpl {
}
package com.yanzuoguang.wxxcx.ad.service.impl;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxUserActionSetsServiceImpl {
}
package com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction;
/***
* 延时调用云函数
*
* @author:heyanou
*/
public class WxAddDelayedFunctionTaskDataReq {
/**
* <p>
* 是否必填:是
* 描述:接口调用凭证
* </p>
*/
private String access_token;
/**
* <p>
* 是否必填:是
* 描述:环境ID
* </p>
*/
private String env;
/**
* <p>
* 是否必填:是
* 描述:函数名称
* </p>
*/
private String function_name;
/**
* <p>
* 是否必填:是
* 描述:延迟时间,单位:秒,合法范围:6s-30天
* </p>
*/
private Long delay_time;
/**
* <p>
* 是否必填:是
* 描述:发送的数据包,格式必须为JSONString
* </p>
*/
private String data;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getEnv() {
return env;
}
public void setEnv(String env) {
this.env = env;
}
public String getFunction_name() {
return function_name;
}
public void setFunction_name(String function_name) {
this.function_name = function_name;
}
public Long getDelay_time() {
return delay_time;
}
public void setDelay_time(Long delay_time) {
this.delay_time = delay_time;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
package com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction;
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.cloudbase.addDelayedFunction.WxAddDelayedFunctionTaskDataRes;
import com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.WxAddDelayedFunctionTaskDataReq;
/***
* 延时调用云函数
*
* @author:heyanou
*/
public class WxAddDelayedFunctionTaskDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxAddDelayedFunctionTaskDataReq req;
public WxAddDelayedFunctionTaskDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.WxAddDelayedFunctionTaskDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getCloudbaseAdddelayedfunctiontaskDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxAddDelayedFunctionTaskDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxAddDelayedFunctionTaskDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxAddDelayedFunctionTaskDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
/***
* 返回结果
*
* @author:heyanou
*/
public class WxAddDelayedFunctionTaskDataRes extends WxXcxResponseBaseError {
}
云开发 /addDelayedFunctionTask
# cloudbase.addDelayedFunctionTask
> 本接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。
> 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0`
延时调用云函数
调用方式:
- [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.addDelayedFunctionTask.html#method-http)
- [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.addDelayedFunctionTask.html#method-cloud)
## HTTPS 调用
### 请求地址
```text
POST https://api.weixin.qq.com/tcb/adddelayedfunctiontask?access_token=TOKEN
```
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :------------------------------------ | :----- | :----- | :--- | :----------------------------------------------------------- |
| access_token / cloudbase_access_token | string | | 是 | [接口调用凭证](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html) |
| env | string | | 是 | 环境ID |
| function_name | string | | 是 | 函数名称 |
| delay_time | number | | 是 | 延迟时间,单位:秒,合法范围:6s-30天 |
| data | string | | 是 | 发送的数据包,格式必须为JSONString |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errcode | string | 错误码 |
| errmsg | string | 错误信息 |
### 请求数据示例
```json
{
"env": "test-env-6gni9ity244a6ea3",
"function_name": "echo",
"delay_time": 10,
"data": "{\"test\":true}"
}
```
### 返回数据示例
```json
{
"errcode": 0,
"errmsg": "ok"
}
```
## 云调用
> [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。
### 接口方法
```js
openapi.cloudbase.addDelayedFunctionTask
```
> 需在 `config.json` 中配置 `cloudbase.addDelayedFunctionTask` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3)
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :----------- | :----- | :----- | :--- | :------------------------------------ |
| env | string | | 是 | 环境ID |
| functionName | string | | 是 | 函数名称 |
| delayTime | number | | 是 | 延迟时间,单位:秒,合法范围:6s-30天 |
| data | string | | 是 | 发送的数据包,格式必须为JSONString |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errCode | string | 错误码 |
| errMsg | string | 错误信息 |
### 异常
### Object
抛出的异常
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errCode | string | 错误码 |
| errMsg | string | 错误信息 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :--- | :--- | :------- |
| | | |
### 请求数据示例
```js
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.cloudbase.addDelayedFunctionTask({
"env": 'test-env-6gni9ity244a6ea3',
"data": '{\'test\":true}",
"functionName": 'echo',
"delayTime": 10
})
return result
} catch (err) {
return err
}
}
```
### 返回数据示例
```json
{
"errCode": 0,
"errMsg": "openapi.cloudbase.addDelayedFunctionTask:ok"
}
```
\ No newline at end of file
package com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.service;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.WxAddDelayedFunctionTaskDataRes;
import com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.WxAddDelayedFunctionTaskDataReq;
/***
* 延时调用云函数
*
* @author:heyanou
*/
public interface WxAddDelayedFunctionTaskService {
/**
*<b>延时调用云函数</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
WxAddDelayedFunctionTaskDataRes addDelayedFunctionTask(WxXcxAccessToken accessToken, WxAddDelayedFunctionTaskDataReq req);
}
package com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.service.impl;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.base.WxXcxConfig;
import com.yanzuoguang.wxxcx.base.WxXcxRequest;
import com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.WxAddDelayedFunctionTaskDataReq;
import com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.WxAddDelayedFunctionTaskDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.WxAddDelayedFunctionTaskDataRes;
import com.yanzuoguang.wxxcx.cloudbase.addDelayedFunction.service.WxAddDelayedFunctionTaskService;
import org.springframework.stereotype.Component;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
@Component
public class WxAddDelayedFunctionTaskServiceImpl implements WxAddDelayedFunctionTaskService {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
public WxAddDelayedFunctionTaskServiceImpl(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
}
/**
*<b>延时调用云函数</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
@Override
public WxAddDelayedFunctionTaskDataRes addDelayedFunctionTask(WxXcxAccessToken accessToken, WxAddDelayedFunctionTaskDataReq req) {
WxAddDelayedFunctionTaskDataRequest addDelayedFunctionTaskDataRequest = new WxAddDelayedFunctionTaskDataRequest(wxXcxConfig, wxXcxRequest, accessToken, req);
return addDelayedFunctionTaskDataRequest.getResponse();
}
}
- [云开发]
- [延时调用]
- [延时调用云函数](./addDelayedFunctionTask/addDelayedFunctionTask.md)
- [上传文件]
- [上传文件信息](./describeExtension/describeExtension.md)
- [短信记录]
- [查询 2 个月内的短信记录](./describeSmsRecords/describeSmsRecords.md)
- [开放数据]
- [换取 cloudID ](./getopen/getOpenData.md)
- [获取云开发]
- [获取云开发数据接口](./getstatistics/getStatistics.md)
- [获取实时语音签名]
- [获取实时语音签名](./getVoIPSign/getVoIPSign.md)
- [导入]
- [云开发通用上报接口](./report/report.md)
- [短信]
- [发送短信](./sendSms/sendSms.md)
- [发送短信V2](./sendSmsV2/sendSmsV2.md)
- [创建发短信任务]
- [创建发短信任务](./sendSmsTask/createSendSmsTask.md)
\ No newline at end of file
package com.yanzuoguang.wxxcx.cloudbase.describeExtension;
import com.yanzuoguang.wxxcx.cloudbase.vo.ExtensionFiles;
import java.util.List;
/***
* 描述扩展上传文件信息
*
* @author:heyanou
*/
public class WxDescribeExtensionUploadInfoDataReq {
/**
* <p>
* 是否必填:是
* 描述:接口调用凭证
* </p>
*/
private String access_token;
/**
* <p>
* 是否必填:是
* 描述:待上传的文件列表
* </p>
*/
private List<ExtensionFiles> ExtensionFiles;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public List<com.yanzuoguang.wxxcx.cloudbase.vo.ExtensionFiles> getExtensionFiles() {
return ExtensionFiles;
}
public void setExtensionFiles(List<com.yanzuoguang.wxxcx.cloudbase.vo.ExtensionFiles> extensionFiles) {
ExtensionFiles = extensionFiles;
}
}
package com.yanzuoguang.wxxcx.cloudbase.describeExtension;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
/***
* 广告请求
*
* @author:heyanou
*/
public class WxDescribeExtensionUploadInfoDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxDescribeExtensionUploadInfoDataReq req;
public WxDescribeExtensionUploadInfoDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxDescribeExtensionUploadInfoDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getCloudbaseDescribeextensionuploadinfoDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxDescribeExtensionUploadInfoDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxDescribeExtensionUploadInfoDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxDescribeExtensionUploadInfoDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.cloudbase.describeExtension;
import com.yanzuoguang.wxxcx.base.*;
import java.util.ArrayList;
/***
* 广告请求
*
* @author:heyanou
*/
public class WxDescribeExtensionUploadInfoDataRes extends WxXcxResponseBaseError {
/***
* <b>待上传文件的信息数组</b>
*/
private ArrayList<Object> FilesData;
/***
* <p>唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。</p>
*/
private String RequestId;
public ArrayList<Object> getFilesData() {
return FilesData;
}
public void setFilesData(ArrayList<Object> filesData) {
FilesData = filesData;
}
public String getRequestId() {
return RequestId;
}
public void setRequestId(String requestId) {
RequestId = requestId;
}
}
云开发 /describeExtensionUploadInfo
# cloudbase.describeExtensionUploadInfo
> 本接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。
> 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0`
描述扩展上传文件信息
调用方式:
- [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.describeExtensionUploadInfo.html#method-http)
- [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.describeExtensionUploadInfo.html#method-cloud)
## HTTPS 调用
### 请求地址
```text
POST https://api.weixin.qq.com/tcb/describeextensionuploadinfo?access_token=TOKEN
```
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :------------------------------------ | :------------- | :----- | :--- | :----------------------------------------------------------- |
| access_token / cloudbase_access_token | string | | 是 | [接口调用凭证](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html) |
| ExtensionFiles | Array.<Object> | | 是 | 待上传的文件列表 |
**ExtensionFiles 的结构**
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :------- | :----- | :----- | :--- | :----------------------------------------------------------- |
| FileType | string | | 是 | 文件类型。枚举值 FUNCTION:函数代码 STATIC:静态托管代码 SMS:短信文件 |
| FileName | string | | 是 | 文件名,长度不超过24 |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :-------- | :------------- | :----------------------------------------------------------- |
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
| FilesData | Array.<Object> | 待上传文件的信息数组 |
| RequestId | string | 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 |
**errcode 的合法值**
| 值 | 说明 | 最低版本 |
| :------ | :----------------------------- | :------- |
| 0 | 请求成功 | |
| -1 | 系统繁忙,此时请开发者稍候再试 | |
| -501007 | 参数有误,具体原因参考 errmsg | |
**FilesData 的结构**
| 属性 | 类型 | 说明 |
| :-------- | :----- | :----------------------------------------------------------- |
| CodeUri | string | 模板里使用的地址 |
| UploadUrl | string | 上传文件的临时地址,含签名 |
| CustomKey | string | 自定义密钥。如果为空,则表示不需要加密 |
| MaxSize | number | 文件大小限制,单位M,客户端上传前需要主动检查文件大小,超过限制的文件会被删除。 |
### 请求数据示例
```json
{
"PostData": {
"ExtensionFiles": [{
"FileType":"SMS",
"FileName":"gongzi.csv"
}]
}
}
```
### 返回数据示例
```json
{
"Response":{
"FilesData":[
{
"CodeUri":"extension://xxx.zip",
"UploadUrl":"https://xxx",
"CustomKey":"",
"MaxSize":30
}
],
"RequestId":"83793d78-b90b-4b1e-9454-d7b4f5317f01"
}
}
```
## 云调用
> [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。
### 接口方法
```js
openapi.cloudbase.describeExtensionUploadInfo
```
> 需在 `config.json` 中配置 `cloudbase.describeExtensionUploadInfo` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3)
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :------------- | :------------- | :----- | :--- | :--------------- |
| ExtensionFiles | Array.<Object> | | 是 | 待上传的文件列表 |
**ExtensionFiles 的结构**
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :------- | :----- | :----- | :--- | :----------------------------------------------------------- |
| FileType | string | | 是 | 文件类型。枚举值 FUNCTION:函数代码 STATIC:静态托管代码 SMS:短信文件 |
| FileName | string | | 是 | 文件名,长度不超过24 |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :-------- | :------------- | :----------------------------------------------------------- |
| errCode | number | 错误码 |
| errMsg | string | 错误信息 |
| FilesData | Array.<Object> | 待上传文件的信息数组 |
| RequestId | string | 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :--- | :--- | :------- |
| 0 | 成功 | |
**FilesData 的结构**
| 属性 | 类型 | 说明 |
| :-------- | :----- | :----------------------------------------------------------- |
| CodeUri | string | 模板里使用的地址 |
| UploadUrl | string | 上传文件的临时地址,含签名 |
| CustomKey | string | 自定义密钥。如果为空,则表示不需要加密 |
| MaxSize | number | 文件大小限制,单位M,客户端上传前需要主动检查文件大小,超过限制的文件会被删除。 |
### 异常
### Object
抛出的异常
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errCode | number | 错误码 |
| errMsg | string | 错误信息 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :------ | :----------------------------- | :------- |
| -1 | 系统繁忙,此时请开发者稍候再试 | |
| -501007 | 参数有误,具体原因参考 errmsg | |
### 请求数据示例
```js
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi({ convertCase: false }).cloudbase.describeExtensionUploadInfo({
"PostData": {
"ExtensionFiles": [
{
"FileType": 'SMS',
"FileName": 'gongzi.csv'
}
]
}
})
return result
} catch (err) {
return err
}
}
```
### 返回数据示例
```json
{
"Response": {
"FilesData": [
{
"CodeUri": "extension://xxx.zip",
"UploadUrl": "https://xxx",
"CustomKey": "",
"MaxSize": 30
}
],
"RequestId": "83793d78-b90b-4b1e-9454-d7b4f5317f01"
},
"errMsg": "openapi.cloudbase.describeExtensionUploadInfo:ok"
}
```
\ No newline at end of file
package com.yanzuoguang.wxxcx.cloudbase.describeExtension.service;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.cloudbase.describeExtension.WxDescribeExtensionUploadInfoDataReq;
import com.yanzuoguang.wxxcx.cloudbase.describeExtension.WxDescribeExtensionUploadInfoDataRes;
import com.yanzuoguang.wxxcx.cloudbase.sendSmsTask.WxCreateSendSmsTaskDataReq;
import com.yanzuoguang.wxxcx.cloudbase.sendSmsTask.WxCreateSendSmsTaskDataRes;
/***
* 描述扩展上传文件信息
*
* @author:heyanou
*/
public interface WxDescribeExtensionUploadInfoService {
/**
*<b>描述扩展上传文件信息</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
WxDescribeExtensionUploadInfoDataRes describeExtensionUploadInfo(WxXcxAccessToken accessToken, WxDescribeExtensionUploadInfoDataReq req);
}
package com.yanzuoguang.wxxcx.cloudbase.describeExtension.service.impl;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.base.WxXcxConfig;
import com.yanzuoguang.wxxcx.base.WxXcxRequest;
import com.yanzuoguang.wxxcx.cloudbase.describeExtension.WxDescribeExtensionUploadInfoDataReq;
import com.yanzuoguang.wxxcx.cloudbase.describeExtension.WxDescribeExtensionUploadInfoDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.describeExtension.WxDescribeExtensionUploadInfoDataRes;
import com.yanzuoguang.wxxcx.cloudbase.describeExtension.service.WxDescribeExtensionUploadInfoService;
import org.springframework.stereotype.Component;
/***
* 延时调用云函数
*
* @author:heyanou
*/
@Component
public class WxDescribeExtensionUploadInfoServiceImpl implements WxDescribeExtensionUploadInfoService {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
public WxDescribeExtensionUploadInfoServiceImpl(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
}
/**
*<b>描述扩展上传文件信息</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
@Override
public WxDescribeExtensionUploadInfoDataRes describeExtensionUploadInfo(WxXcxAccessToken accessToken, WxDescribeExtensionUploadInfoDataReq req){
WxDescribeExtensionUploadInfoDataRequest extensionuploadInfoRequest = new WxDescribeExtensionUploadInfoDataRequest(wxXcxConfig, wxXcxRequest, accessToken, req);
return extensionuploadInfoRequest.getResponse();
}
}
package com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords;
/***
* 查询 2 个月内的短信记录
*
* @author:heyanou
*/
public class WxDescribeSmsRecordsDataReq {
/**
* <p>
* 是否必填:是
* 描述:接口调用凭证
* </p>
*/
private String access_token;
/**
* <p>
* 是否必填:是
* 描述:环境ID
* </p>
*/
private String EnvId;
/**
* <p>
* 是否必填:是
* 描述:开始日期, 如:2021-01-01
* </p>
*/
private String StartDate;
/**
* <p>
* 是否必填:是
* 描述:结束日期, 如2021-01-07
* </p>
*/
private String EndDate;
/**
* <p>
* 是否必填:否
* 描述:电话号码
* </p>
*/
private String Mobile;
/**
* <p>
* 是否必填:否
* 描述:查询ID
* </p>
*/
private String QueryId;
/**
* <p>
* 是否必填:否
* 描述:页码(1开始)
* </p>
*/
private int PageNumber;
/**
* <p>
* 是否必填:否
* 描述:每页条目数
* </p>
*/
private int PageSize;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getEnvId() {
return EnvId;
}
public void setEnvId(String envId) {
EnvId = envId;
}
public String getStartDate() {
return StartDate;
}
public void setStartDate(String startDate) {
StartDate = startDate;
}
public String getEndDate() {
return EndDate;
}
public void setEndDate(String endDate) {
EndDate = endDate;
}
public String getMobile() {
return Mobile;
}
public void setMobile(String mobile) {
Mobile = mobile;
}
public String getQueryId() {
return QueryId;
}
public void setQueryId(String queryId) {
QueryId = queryId;
}
public int getPageNumber() {
return PageNumber;
}
public void setPageNumber(int pageNumber) {
PageNumber = pageNumber;
}
public int getPageSize() {
return PageSize;
}
public void setPageSize(int pageSize) {
PageSize = pageSize;
}
}
package com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords;
import com.yanzuoguang.wxxcx.cloudbase.vo.SmsRecords;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
import java.util.List;
/***
* 返回的 JSON 数据包
*
* @author:heyanou
*/
public class WxDescribeSmsRecordsDataRes extends WxXcxResponseBaseError {
/***
* <p>发送记录列表</p>
*/
private List<SmsRecords> SmsRecords;
/***
* <p>记录总数</p>
*/
private int TotalCount;
/***
* <p>唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。</p>
*/
private String RequestId;
public List<SmsRecords> getSmsRecords() {
return SmsRecords;
}
public void setSmsRecords(List<SmsRecords> smsRecords) {
SmsRecords = smsRecords;
}
public int getTotalCount() {
return TotalCount;
}
public void setTotalCount(int totalCount) {
TotalCount = totalCount;
}
public String getRequestId() {
return RequestId;
}
public void setRequestId(String requestId) {
RequestId = requestId;
}
}
package com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
/***
* 广告请求
*
* @author:heyanou
*/
public class WxDescribeSmsRecordsRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxDescribeSmsRecordsDataReq req;
public WxDescribeSmsRecordsRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxDescribeSmsRecordsDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getCloudbaseDescribesmsrecordsDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxDescribeSmsRecordsDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxDescribeSmsRecordsDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxDescribeSmsRecordsDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
云开发 /describeSmsRecords
# cloudbase.describeSmsRecords
> 本接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。
> 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0`
查询 2 个月内的短信记录
调用方式:
- [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.describeSmsRecords.html#method-http)
- [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.describeSmsRecords.html#method-cloud)
## HTTPS 调用
### 请求地址
```text
POST https://api.weixin.qq.com/tcb/describesmsrecords?access_token=TOKEN
```
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :------------------------------------ | :----- | :----- | :--- | :----------------------------------------------------------- |
| access_token / cloudbase_access_token | string | | 是 | [接口调用凭证](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html) |
| EnvId | string | | 是 | [环境 ID](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/quickstart.html#_2-开通云开发、创建环境) |
| StartDate | string | | 是 | 开始日期, 如:2021-01-01 |
| EndDate | string | | 是 | 结束日期, 如2021-01-07 |
| Mobile | string | | 否 | 电话号码 |
| QueryId | string | | 否 | 查询ID |
| PageNumber | number | | 否 | 页码(1开始) |
| PageSize | number | | 否 | 每页条目数 |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :--------- | :------------- | :----------------------------------------------------------- |
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
| SmsRecords | Array.<Object> | 发送记录列表 |
| TotalCount | number | 记录总数 |
| RequestId | string | 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 |
**errcode 的合法值**
| 值 | 说明 | 最低版本 |
| :------ | :----------------------------- | :------- |
| 0 | 请求成功 | |
| -1 | 系统繁忙,此时请开发者稍候再试 | |
| -501007 | 参数有误,具体原因参考 errmsg | |
**SmsRecords 的结构**
| 属性 | 类型 | 说明 |
| :----------- | :----- | :---------------------- |
| Mobile | string | 手机号码 |
| Content | string | 短信内容 |
| ContentSize | number | 短信内容长度 |
| Fee | number | 计费条数 |
| CreateTime | string | 发送时间 |
| ReceivedTime | string | 用户接收时间 |
| Status | string | sent(成功), error(失败) |
| Remarks | string | 备注 |
### 请求数据示例
```json
{
"PostData": {
"StartDate":"2021-03-01",
"EndDate":"2021-03-23",
"EnvId":"xxx",
"QueryId":"xxx",
"PageNumber":1,
"PageSize":20
}
}
```
### 返回数据示例
```json
{
"Response":{
"SmsRecords":[
{
"Content":"【XXX】XXX,跳转小程序 https://xxx/xxx 回 T 退订",
"ContentSize":51,
"CreateTime":"2021-03-22 17:18:37",
"Fee":1,
"Mobile":"+86xxxxxxxxxxx",
"ReceivedTime":"2021-03-22 17:18:43",
"Remarks":"用户短信接收成功",
"Status":"sent"
}
],
"TotalCount":1,
"RequestId":"bf34127a-35bd-48a2-86bb-ae583d2ff9ff"
}
}
```
## 云调用
> [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。
### 接口方法
```js
openapi.cloudbase.describeSmsRecords
```
> 需在 `config.json` 中配置 `cloudbase.describeSmsRecords` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3)
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :--------- | :----- | :----- | :--- | :----------------------------------------------------------- |
| EnvId | string | | 是 | [环境 ID](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/quickstart.html#_2-开通云开发、创建环境) |
| StartDate | string | | 是 | 开始日期, 如:2021-01-01 |
| EndDate | string | | 是 | 结束日期, 如2021-01-07 |
| Mobile | string | | 否 | 电话号码 |
| QueryId | string | | 否 | 查询ID |
| PageNumber | number | | 否 | 页码(1开始) |
| PageSize | number | | 否 | 每页条目数 |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :--------- | :------------- | :----------------------------------------------------------- |
| errCode | number | 错误码 |
| errMsg | string | 错误信息 |
| SmsRecords | Array.<Object> | 发送记录列表 |
| TotalCount | number | 记录总数 |
| RequestId | string | 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :--- | :--- | :------- |
| 0 | 成功 | |
**SmsRecords 的结构**
| 属性 | 类型 | 说明 |
| :----------- | :----- | :---------------------- |
| Mobile | string | 手机号码 |
| Content | string | 短信内容 |
| ContentSize | number | 短信内容长度 |
| Fee | number | 计费条数 |
| CreateTime | string | 发送时间 |
| ReceivedTime | string | 用户接收时间 |
| Status | string | sent(成功), error(失败) |
| Remarks | string | 备注 |
### 异常
### Object
抛出的异常
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errCode | number | 错误码 |
| errMsg | string | 错误信息 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :------ | :----------------------------- | :------- |
| -1 | 系统繁忙,此时请开发者稍候再试 | |
| -501007 | 参数有误,具体原因参考 errmsg | |
### 请求数据示例
```js
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi({ convertCase: false }).cloudbase.describeSmsRecords({
"PostData": {
"StartDate": '2021-03-01',
"EndDate": '2021-03-23',
"EnvId": 'xxx',
"QueryId": 'xxx',
"PageNumber": 1,
"PageSize": 20
}
})
return result
} catch (err) {
return err
}
}
```
### 返回数据示例
```json
{
"Response": {
"SmsRecords": [
{
"Content": "【XXX】XXX,跳转小程序 https://xxx/xxx 回 T 退订",
"ContentSize": 51,
"CreateTime": "2021-03-22 17:18:37",
"Fee": 1,
"Mobile": "+86xxxxxxxxxxx",
"ReceivedTime": "2021-03-22 17:18:43",
"Remarks": "用户短信接收成功",
"Status": "sent"
}
],
"TotalCount": 1,
"RequestId": "bf34127a-35bd-48a2-86bb-ae583d2ff9ff"
},
"errMsg": "openapi.cloudbase.describeSmsRecords:ok"
}
```
\ No newline at end of file
package com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords.service;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords.WxDescribeSmsRecordsDataRes;
import com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords.WxDescribeSmsRecordsDataReq;
/***
* 查询 2 个月内的短信记录
*
* @author:heyanou
*/
public interface WxDescribeSmsRecordsService {
/**
*<b>查询 2 个月内的短信记录</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
public WxDescribeSmsRecordsDataRes describeSmsRecords(WxXcxAccessToken accessToken, WxDescribeSmsRecordsDataReq req);
}
package com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords.service.impl;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.base.WxXcxConfig;
import com.yanzuoguang.wxxcx.base.WxXcxRequest;
import com.yanzuoguang.wxxcx.cloudbase.describeExtension.WxDescribeExtensionUploadInfoDataReq;
import com.yanzuoguang.wxxcx.cloudbase.describeExtension.WxDescribeExtensionUploadInfoDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.describeExtension.WxDescribeExtensionUploadInfoDataRes;
import com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords.WxDescribeSmsRecordsDataReq;
import com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords.WxDescribeSmsRecordsDataRes;
import com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords.WxDescribeSmsRecordsRequest;
import com.yanzuoguang.wxxcx.cloudbase.describeSmsRecords.service.WxDescribeSmsRecordsService;
import org.springframework.stereotype.Component;
/***
* 延时调用云函数
*
* @author:heyanou
*/
@Component
public class WxDescribeSmsRecordsServiceImpl implements WxDescribeSmsRecordsService {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
public WxDescribeSmsRecordsServiceImpl(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
}
/**
*<b>查询 2 个月内的短信记录</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
@Override
public WxDescribeSmsRecordsDataRes describeSmsRecords(WxXcxAccessToken accessToken, WxDescribeSmsRecordsDataReq req){
WxDescribeSmsRecordsRequest smsRecordsRequest = new WxDescribeSmsRecordsRequest(wxXcxConfig, wxXcxRequest, accessToken, req);
return smsRecordsRequest.getResponse();
}
}
package com.yanzuoguang.wxxcx.cloudbase.getVoIPSign;
/***
* 获取实时语音签名
*
* @author:heyanou
*/
public class WxGetVoIPSignDataReq {
/**
* <p>
* 是否必填:是
* 描述:用户唯一标识符
* </p>
*/
private String openid;
/**
* <p>
* 是否必填:是
* 描述:接口调用凭证
* </p>
*/
private String access_token;
/**
* <p>
* 是否必填:是
* 描述:游戏房间的标识
* </p>
*/
private String group_id;
/**
* <p>
* 是否必填:是
* 描述:随机字符串,长度应小于 128
* </p>
*/
private String nonce;
/**
* <p>
* 是否必填:是
* 描述:生成这个随机字符串的 UNIX 时间戳(精确到秒)
* </p>
*/
private String timestamp;
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getGroup_id() {
return group_id;
}
public void setGroup_id(String group_id) {
this.group_id = group_id;
}
public String getNonce() {
return nonce;
}
public void setNonce(String nonce) {
this.nonce = nonce;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
}
package com.yanzuoguang.wxxcx.cloudbase.getVoIPSign;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxGetVoIPSignDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxGetVoIPSignDataReq req;
public WxGetVoIPSignDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxGetVoIPSignDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getCloudbaseGetVoIPSignDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxGetVoIPSignDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxGetVoIPSignDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxGetVoIPSignDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.cloudbase.getVoIPSign;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
import java.util.List;
/***
* 返回的 JSON 数据包
*
* @author:heyanou
*/
public class WxGetVoIPSignDataRes extends WxXcxResponseBaseError {
/***
* <p>签名</p>
*/
private String signature;
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
}
云开发 /getVoIPSign
# cloudbase.getVoIPSign
> 本接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。
> 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0`
获取实时语音签名
调用方式:
- [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.getVoIPSign.html#method-http)
- [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.getVoIPSign.html#method-cloud)
## HTTPS 调用
### 请求地址
```text
POST https://api.weixin.qq.com/wxa/getvoipsign?openid=OPENID&access_token=TOKEN
```
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :------------------------------------ | :----- | :----- | :--- | :----------------------------------------------------------- |
| openid | string | | 是 | 用户唯一标识符 |
| access_token / cloudbase_access_token | string | | 是 | [接口调用凭证](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html) |
| group_id | string | | 是 | 游戏房间的标识 |
| nonce | string | | 是 | 随机字符串,长度应小于 128 |
| timestamp | string | | 是 | 生成这个随机字符串的 UNIX 时间戳(精确到秒) |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :-------- | :----- | :------- |
| errcode | string | 错误码 |
| errmsg | string | 错误信息 |
| signature | string | 签名 |
### 请求数据示例
```json
{
"group_id": "xxx",
"nonce": "yyy",
"timestamp": 12312312312
}
```
### 返回数据示例
```json
{
"errcode": 0,
"errmsg": "ok",
"signature": "xxxx"
}
```
## 云调用
> [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。
### 接口方法
```js
openapi.cloudbase.getVoIPSign
```
> 需在 `config.json` 中配置 `cloudbase.getVoIPSign` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3)
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :-------- | :----- | :----- | :--- | :------------------------------------------- |
| openid | string | | 是 | 用户唯一标识符 |
| groupId | string | | 是 | 游戏房间的标识 |
| nonce | string | | 是 | 随机字符串,长度应小于 128 |
| timestamp | string | | 是 | 生成这个随机字符串的 UNIX 时间戳(精确到秒) |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :-------- | :----- | :------- |
| errCode | string | 错误码 |
| errMsg | string | 错误信息 |
| signature | string | 签名 |
### 异常
### Object
抛出的异常
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errCode | string | 错误码 |
| errMsg | string | 错误信息 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :--- | :--- | :------- |
| | | |
### 请求数据示例
```js
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.cloudbase.getVoIPSign({
"nonce": 'yyy',
"timestamp": 12312312312,
"groupId": 'xxx'
})
return result
} catch (err) {
return err
}
}
```
### 返回数据示例
```json
{
"errCode": 0,
"errMsg": "openapi.cloudbase.getVoIPSign:ok",
"signature": "xxxx"
}
```
\ No newline at end of file
package com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.service;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.WxGetVoIPSignDataReq;
import com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.WxGetVoIPSignDataRes;
import com.yanzuoguang.wxxcx.cloudbase.sendSmsTask.WxCreateSendSmsTaskDataReq;
import com.yanzuoguang.wxxcx.cloudbase.sendSmsTask.WxCreateSendSmsTaskDataRes;
/***
* 获取实时语音签名
*
* @author:heyanou
*/
public interface WxGetVoIPSignService {
/**
*<b>获取实时语音签名</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
WxGetVoIPSignDataRes getVoIPSign(WxXcxAccessToken accessToken, WxGetVoIPSignDataReq req);
}
package com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.service.impl;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.base.WxXcxConfig;
import com.yanzuoguang.wxxcx.base.WxXcxRequest;
import com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.WxGetVoIPSignDataReq;
import com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.WxGetVoIPSignDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.WxGetVoIPSignDataRes;
import com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.service.WxGetVoIPSignService;
import org.springframework.stereotype.Component;
/***
* 获取实时语音签名
*
* @author:heyanou
*/
@Component
public class WxGetVoIPSignServiceImpl implements WxGetVoIPSignService {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
public WxGetVoIPSignServiceImpl(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
}
/**
*<b>获取实时语音签名</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
@Override
public WxGetVoIPSignDataRes getVoIPSign(WxXcxAccessToken accessToken, WxGetVoIPSignDataReq req){
WxGetVoIPSignDataRequest voIPSignDataRequest = new WxGetVoIPSignDataRequest(wxXcxConfig, wxXcxRequest, accessToken, req);
return voIPSignDataRequest.getResponse();
}
}
package com.yanzuoguang.wxxcx.cloudbase.getopen;
import java.util.List;
/***
* 换取 cloudID 对应的开放数据
*
* @author:heyanou
*/
public class WxGetOpenDataReq {
/**
* <p>
* 是否必填:是
* 描述:接口调用凭证
* </p>
*/
private String access_token;
/**
* <p>
* 是否必填:是
* 描述:用户唯一标识符
* </p>
*/
private String openid;
/**
* <p>
* 是否必填:是
* 描述:CloudID 列表
* </p>
*/
private List<String> cloudid_list;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public List<String> getCloudid_list() {
return cloudid_list;
}
public void setCloudid_list(List<String> cloudid_list) {
this.cloudid_list = cloudid_list;
}
}
package com.yanzuoguang.wxxcx.cloudbase.getopen;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
/***
* 广告请求
*
* @author:heyanou
*/
public class WxGetOpenDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxGetOpenDataReq req;
public WxGetOpenDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxGetOpenDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getCloudbaseGetopendataDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxGetOpenDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxGetOpenDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxGetOpenDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.cloudbase.getopen;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
import java.util.List;
import java.util.ArrayList;
/***
* 返回的 JSON 数据包
*
* @author:heyanou
*/
public class WxGetOpenDataRes extends WxXcxResponseBaseError {
/***
* <p>开放数据列表</p>
*/
private List<String> data_list=new ArrayList<>();
public List<String> getData_list() {
return data_list;
}
public void setData_list(List<String> data_list) {
this.data_list = data_list;
}
}
云开发 /getOpenData
# cloudbase.getOpenData
> 本接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。
> 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0`
换取 cloudID 对应的开放数据
调用方式:
- [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.getOpenData.html#method-http)
- [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.getOpenData.html#method-cloud)
## HTTPS 调用
### 请求地址
```text
POST https://api.weixin.qq.com/wxa/getopendata?openid=OPENID&access_token=TOKEN
```
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :------------------------------------ | :------------- | :----- | :--- | :----------------------------------------------------------- |
| openid | string | | 是 | 用户唯一标识符 |
| access_token / cloudbase_access_token | string | | 是 | [接口调用凭证](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html) |
| cloudid_list | Array.<string> | | 是 | CloudID 列表 |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :-------- | :------------- | :----------- |
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
| data_list | Array.<Object> | 开放数据列表 |
**errcode 的合法值**
| 值 | 说明 | 最低版本 |
| :---- | :----------------------------- | :------- |
| 0 | 请求成功 | |
| -1 | 系统繁忙,此时请开发者稍候再试 | |
| 40003 | openid无效 | |
### 请求数据示例
```json
{
"cloudid_list": ["xxx"]
}
```
### 返回数据示例
假设获取了微信运动数据
```json
{
"errcode": 0,
"errmsg": "ok",
"data_list": [{
"cloud_id": "xxx",
"json": {
"cloudID": "xxx",
"data": {
"stepInfoList": [{
"timestamp": 1603641600,
"step": 1234
}]
}
}
}]
}
```
## 云调用
> [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。
### 接口方法
```js
openapi.cloudbase.getOpenData
```
> 需在 `config.json` 中配置 `cloudbase.getOpenData` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3)
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :---------- | :------------- | :----- | :--- | :------------- |
| openid | string | | 是 | 用户唯一标识符 |
| cloudidList | Array.<string> | | 是 | CloudID 列表 |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :------- | :------------- | :----------- |
| errCode | number | 错误码 |
| errMsg | string | 错误信息 |
| dataList | Array.<Object> | 开放数据列表 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :--- | :--- | :------- |
| 0 | 成功 | |
### 异常
### Object
抛出的异常
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errCode | number | 错误码 |
| errMsg | string | 错误信息 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :---- | :----------------------------- | :------- |
| -1 | 系统繁忙,此时请开发者稍候再试 | |
| 40003 | openid无效 | |
### 请求数据示例
```js
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.cloudbase.getOpenData({
"cloudidList": [
"xxx"
]
})
return result
} catch (err) {
return err
}
}
```
### 返回数据示例
假设获取了微信运动数据
```json
{
"errCode": 0,
"errMsg": "openapi.cloudbase.getOpenData:ok",
"dataList": [
{
"json": {
"cloudID": "xxx",
"data": {
"stepInfoList": [
{
"timestamp": 1603641600,
"step": 1234
}
]
}
},
"cloudId": "xxx"
}
]
}
```
\ No newline at end of file
package com.yanzuoguang.wxxcx.cloudbase.getopen.service;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.cloudbase.getopen.WxGetOpenDataReq;
import com.yanzuoguang.wxxcx.cloudbase.getopen.WxGetOpenDataRes;
import com.yanzuoguang.wxxcx.cloudbase.sendSmsTask.WxCreateSendSmsTaskDataReq;
import com.yanzuoguang.wxxcx.cloudbase.sendSmsTask.WxCreateSendSmsTaskDataRes;
/***
* 换取 cloudID 对应的开放数据
*
* @author:heyanou
*/
public interface WxGetOpenService {
/**
*<b>查询 2 个月内的短信记录</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
WxGetOpenDataRes getOpenData(WxXcxAccessToken accessToken, WxGetOpenDataReq req);
}
package com.yanzuoguang.wxxcx.cloudbase.getopen.service.impl;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.base.WxXcxConfig;
import com.yanzuoguang.wxxcx.base.WxXcxRequest;
import com.yanzuoguang.wxxcx.cloudbase.getopen.WxGetOpenDataReq;
import com.yanzuoguang.wxxcx.cloudbase.getopen.WxGetOpenDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.getopen.WxGetOpenDataRes;
import com.yanzuoguang.wxxcx.cloudbase.getopen.service.WxGetOpenService;
import com.yanzuoguang.wxxcx.cloudbase.sendSmsTask.WxCreateSendSmsTaskDataReq;
import com.yanzuoguang.wxxcx.cloudbase.sendSmsTask.WxCreateSendSmsTaskDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.sendSmsTask.WxCreateSendSmsTaskDataRes;
import org.springframework.stereotype.Component;
/***
* 查询 2 个月内的短信记录
*
* @author:heyanou
*/
@Component
public class WxGetOpenServiceImpl implements WxGetOpenService {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
public WxGetOpenServiceImpl(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
}
/**
*<b>查询 2 个月内的短信记录</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
@Override
public WxGetOpenDataRes getOpenData(WxXcxAccessToken accessToken, WxGetOpenDataReq req){
WxGetOpenDataRequest getOpenDataRequest = new WxGetOpenDataRequest(wxXcxConfig, wxXcxRequest, accessToken, req);
return getOpenDataRequest.getResponse();
}
}
package com.yanzuoguang.wxxcx.cloudbase.getstatistics;
import com.yanzuoguang.wxxcx.cloudbase.vo.Condition;
/***
* 获取云开发数据接口
*
* @author:heyanou
*/
public class WxGetStatisticsDataReq {
/**
* <p>
* 是否必填:是
* 描述:接口调用凭证
* </p>
*/
private String access_token;
/**
* <p>
* 是否必填:是
* 描述:获取动作,目前支持(smsMarketingOverviewData:短信营销概览数据;smsMarketingConversionData:短信营销转化数据;smsMarketingRealTimeData:短信营销实时数据)
* </p>
*/
private String action;
/**
* <p>
* 是否必填:是
* 描述:开始时间戳
* </p>
*/
private Long begin_date;
/**
* <p>
* 是否必填:是
* 描述:结束时间戳
* </p>
*/
private Long end_date;
/**
* <p>
* 是否必填:是
* 描述:分页 offset【action 取 smsMarketingOverviewData、smsMarketingConversionData 时必填】
* </p>
*/
private Integer page_offset;
/**
* <p>
* 是否必填:是
* 描述:分页 limit【action 取 smsMarketingOverviewData、smsMarketingConversionData 时必填】
* </p>
*/
private Integer page_limit;
/**
* <p>
* 是否必填:是
* 描述:查询条件
* </p>
*/
private Condition condition;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public Long getBegin_date() {
return begin_date;
}
public void setBegin_date(Long begin_date) {
this.begin_date = begin_date;
}
public Long getEnd_date() {
return end_date;
}
public void setEnd_date(Long end_date) {
this.end_date = end_date;
}
public Integer getPage_offset() {
return page_offset;
}
public void setPage_offset(Integer page_offset) {
this.page_offset = page_offset;
}
public Integer getPage_limit() {
return page_limit;
}
public void setPage_limit(Integer page_limit) {
this.page_limit = page_limit;
}
public Condition getCondition() {
return condition;
}
public void setCondition(Condition condition) {
this.condition = condition;
}
}
package com.yanzuoguang.wxxcx.cloudbase.getstatistics;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
/***
* @description:对该类的描述(该类的功能)
*
* @author:heyanou
*/
public class WxGetStatisticsDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxGetStatisticsDataReq req;
public WxGetStatisticsDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxGetStatisticsDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getCloudbaseGetStatisticsDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxGetStatisticsDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxGetStatisticsDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxGetStatisticsDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.cloudbase.getstatistics;
import com.yanzuoguang.wxxcx.cloudbase.vo.DataColumn;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
import java.util.List;
/***
* 返回的 JSON 数据包
*
* @author:heyanou
*/
public class WxGetStatisticsDataRes extends WxXcxResponseBaseError {
/***
* <p>环境 ID</p>
*/
private String env_id;
/***
* <p>活动 ID</p>
*/
private String activity_id;
/***
* <p>是否按渠道划分(0:返回概览数据;1:返回各个渠道的数据,可以用于饼图)【action 取 smsMarketingOverviewData 时必填】</p>
*/
private String by_channel_id;
/***
* <p>渠道 ID(云开发 CMS 使用 _cms_sms_)【action 取 smsMarketingConversionData、smsMarketingRealTimeData 时必填】</p>
*/
private String channel_id;
/***
* <p>行为数据(h5:打开 H5;wxapp:跳转小程序)【action == smsMarketingRealTimeData 时必填】</p>
*/
private String act_type;
/***
* <p>数据列定义</p>
*/
private List<DataColumn> data_column;
/***
* <p>数据行</p>
*/
private List<String> data_value;
/***
* <p>总行数</p>
*/
private int total_num;
public String getEnv_id() {
return env_id;
}
public void setEnv_id(String env_id) {
this.env_id = env_id;
}
public String getActivity_id() {
return activity_id;
}
public void setActivity_id(String activity_id) {
this.activity_id = activity_id;
}
public String getBy_channel_id() {
return by_channel_id;
}
public void setBy_channel_id(String by_channel_id) {
this.by_channel_id = by_channel_id;
}
public String getChannel_id() {
return channel_id;
}
public void setChannel_id(String channel_id) {
this.channel_id = channel_id;
}
public String getAct_type() {
return act_type;
}
public void setAct_type(String act_type) {
this.act_type = act_type;
}
public List<DataColumn> getData_column() {
return data_column;
}
public void setData_column(List<DataColumn> data_column) {
this.data_column = data_column;
}
public List<String> getData_value() {
return data_value;
}
public void setData_value(List<String> data_value) {
this.data_value = data_value;
}
public int getTotal_num() {
return total_num;
}
public void setTotal_num(int total_num) {
this.total_num = total_num;
}
}
package com.yanzuoguang.wxxcx.cloudbase.getstatistics.service;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.cloudbase.getstatistics.WxGetStatisticsDataReq;
import com.yanzuoguang.wxxcx.cloudbase.getstatistics.WxGetStatisticsDataRes;
/***
* 获取云开发数据接口
*
* @author:heyanou
*/
public interface WxGetStatisticsService {
/**
*<b>获取云开发数据接口</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
WxGetStatisticsDataRes getStatistics(WxXcxAccessToken accessToken, WxGetStatisticsDataReq req);
}
package com.yanzuoguang.wxxcx.cloudbase.getstatistics.service.impl;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.base.WxXcxConfig;
import com.yanzuoguang.wxxcx.base.WxXcxRequest;
import com.yanzuoguang.wxxcx.cloudbase.getstatistics.WxGetStatisticsDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.getstatistics.service.WxGetStatisticsService;
import org.springframework.stereotype.Component;
import com.yanzuoguang.wxxcx.cloudbase.getstatistics.WxGetStatisticsDataReq;
import com.yanzuoguang.wxxcx.cloudbase.getstatistics.WxGetStatisticsDataRes;
/***
* 获取云开发数据接口
*
* @author:heyanou
*/
@Component
public class WxGetStatisticsServiceImpl implements WxGetStatisticsService {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
public WxGetStatisticsServiceImpl(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
}
/**
*<b>获取云开发数据接口</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
@Override
public WxGetStatisticsDataRes getStatistics(WxXcxAccessToken accessToken, WxGetStatisticsDataReq req){
WxGetStatisticsDataRequest statisticsDataRequest = new WxGetStatisticsDataRequest(wxXcxConfig, wxXcxRequest, accessToken, req);
return statisticsDataRequest.getResponse();
}
}
package com.yanzuoguang.wxxcx.cloudbase.report;
/***
* 云开发通用上报接口
*
* @author:heyanou
*/
public class WxReportDataReq {
/**
* <p>
* 是否必填:是
* 描述:上报动作,目前支持(sendSmsTask:发送短信;openH5:H5 打开)
* </p>
*/
private String report_action;
/**
* <p>
* 是否必填:是
* 描述:环境 ID
* </p>
*/
private String env_id;
/**
* <p>
* 是否必填:是
* 描述:活动 ID
* </p>
*/
private String activity_id;
/**
* <p>
* 是否必填:是
* 描述:任务 ID【report_action 取 sendSmsTask 时必填】
* </p>
*/
private String task_id;
/**
* <p>
* 是否必填:是
* 描述:下发手机号数量【report_action 取 sendSmsTask 时必填】
* </p>
*/
private String phone_count;
/**
* <p>
* 是否必填:是
* 描述:渠道 ID(云开发 CMS 使用 _cms_sms_)【report_action 取 openH5 时必填】
* </p>
*/
private String channel_id;
/**
* <p>
* 是否必填:是
* 描述:会话 ID【report_action 取 openH5 时必填】
* </p>
*/
private String session_id;
public String getReport_action() {
return report_action;
}
public void setReport_action(String report_action) {
this.report_action = report_action;
}
public String getEnv_id() {
return env_id;
}
public void setEnv_id(String env_id) {
this.env_id = env_id;
}
public String getActivity_id() {
return activity_id;
}
public void setActivity_id(String activity_id) {
this.activity_id = activity_id;
}
public String getTask_id() {
return task_id;
}
public void setTask_id(String task_id) {
this.task_id = task_id;
}
public String getPhone_count() {
return phone_count;
}
public void setPhone_count(String phone_count) {
this.phone_count = phone_count;
}
public String getChannel_id() {
return channel_id;
}
public void setChannel_id(String channel_id) {
this.channel_id = channel_id;
}
public String getSession_id() {
return session_id;
}
public void setSession_id(String session_id) {
this.session_id = session_id;
}
}
package com.yanzuoguang.wxxcx.cloudbase.report;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
/***
* 云开发通用上报接口
*
* @author:heyanou
*/
public class WxReportDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxReportDataReq req;
public WxReportDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxReportDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getCloudbaseReportDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxReportDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxReportDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxReportDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.cloudbase.report;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
/***
* 返回结果
*
* @author:heyanou
*/
public class WxReportDataRes extends WxXcxResponseBaseError {
}
云开发 /report
# cloudbase.report
> 本接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。
> 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0`
云开发通用上报接口
调用方式:
- [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.report.html#method-http)
- [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.report.html#method-cloud)
## HTTPS 调用
### 请求地址
```text
POST https://api.weixin.qq.com/tcb/cloudbasereport?access_token=TOKEN
```
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :------------ | :----- | :----- | :--- | :----------------------------------------------------------- |
| report_action | string | | 是 | 上报动作,目前支持(sendSmsTask:发送短信;openH5:H5 打开) |
| env_id | string | | 是 | [环境 ID](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/quickstart.html#_2-开通云开发、创建环境) |
| activity_id | string | | 是 | 活动 ID |
| task_id | string | | 是 | 任务 ID【report_action 取 sendSmsTask 时必填】 |
| phone_count | string | | 是 | 下发手机号数量【report_action 取 sendSmsTask 时必填】 |
| channel_id | string | | 是 | 渠道 ID(云开发 CMS 使用 `_cms_sms_`)【report_action 取 openH5 时必填】 |
| session_id | string | | 是 | 会话 ID【report_action 取 openH5 时必填】 |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
**errcode 的合法值**
| 值 | 说明 | 最低版本 |
| :--- | :----------------------------- | :------- |
| 0 | 请求成功 | |
| -1 | 系统繁忙,此时请开发者稍候再试 | |
### sendSmsTask 请求数据示例
```json
{
"report_action": "sendSmsTask",
"env_id": "xxx",
"activity_id": "xxx",
"task_id": "xxx",
"phone_count": "12345"
}
```
### openH5 请求数据示例
```json
{
"report_action":"openH5",
"env_id":"xxx",
"activity_id":"xxx",
"channel_id":"xxx",
"session_id":"xxx"
}
```
### 返回数据示例
```json
{
"errcode":0,
"errmsg": ""
}
```
## 云调用
> [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。
### 接口方法
```js
openapi.cloudbase.report
```
> 需在 `config.json` 中配置 `cloudbase.report` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3)
### 请求参数
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| :----------- | :----- | :----- | :--- | :----------------------------------------------------------- |
| reportAction | string | | 是 | 上报动作,目前支持(sendSmsTask:发送短信;openH5:H5 打开) |
| envId | string | | 是 | [环境 ID](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/quickstart.html#_2-开通云开发、创建环境) |
| activityId | string | | 是 | 活动 ID |
| taskId | string | | 是 | 任务 ID【report_action 取 sendSmsTask 时必填】 |
| phoneCount | string | | 是 | 下发手机号数量【report_action 取 sendSmsTask 时必填】 |
| channelId | string | | 是 | 渠道 ID(云开发 CMS 使用 `_cms_sms_`)【report_action 取 openH5 时必填】 |
| sessionId | string | | 是 | 会话 ID【report_action 取 openH5 时必填】 |
### 返回值
### Object
返回的 JSON 数据包
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errCode | number | 错误码 |
| errMsg | string | 错误信息 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :--- | :--- | :------- |
| 0 | 成功 | |
### 异常
### Object
抛出的异常
| 属性 | 类型 | 说明 |
| :------ | :----- | :------- |
| errCode | number | 错误码 |
| errMsg | string | 错误信息 |
**errCode 的合法值**
| 值 | 说明 | 最低版本 |
| :--- | :----------------------------- | :------- |
| -1 | 系统繁忙,此时请开发者稍候再试 | |
### sendSmsTask 请求数据示例
```js
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.cloudbase.report({
"reportAction": 'sendSmsTask',
"envId": 'xxx',
"activityId": 'xxx',
"taskId": 'xxx',
"phoneCount": '12345'
})
return result
} catch (err) {
return err
}
}
```
### openH5 请求数据示例
```js
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.cloudbase.report({
"reportAction": 'openH5',
"envId": 'xxx',
"activityId": 'xxx',
"channelId": 'xxx',
"sessionId": 'xxx'
})
return result
} catch (err) {
return err
}
}
```
### 返回数据示例
```json
{
"errCode": 0,
"errMsg": "openapi.cloudbase.report:ok"
}
```
\ No newline at end of file
package com.yanzuoguang.wxxcx.cloudbase.report.service;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.cloudbase.report.WxReportDataReq;
import com.yanzuoguang.wxxcx.cloudbase.report.WxReportDataRes;
/***
* 获取实时语音签名
*
* @author:heyanou
*/
public interface WxReportService {
/**
*<b>云开发通用上报接口</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
WxReportDataRes report(WxXcxAccessToken accessToken, WxReportDataReq req);
}
package com.yanzuoguang.wxxcx.cloudbase.report.service.impl;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.base.WxXcxConfig;
import com.yanzuoguang.wxxcx.base.WxXcxRequest;
import com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.WxGetVoIPSignDataReq;
import com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.WxGetVoIPSignDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.getVoIPSign.WxGetVoIPSignDataRes;
import com.yanzuoguang.wxxcx.cloudbase.report.WxReportDataReq;
import com.yanzuoguang.wxxcx.cloudbase.report.WxReportDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.report.WxReportDataRes;
import com.yanzuoguang.wxxcx.cloudbase.report.service.WxReportService;
import org.springframework.stereotype.Component;
/***
* 获取实时语音签名
*
* @author:heyanou
*/
@Component
public class WxReportServiceImpl implements WxReportService {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
public WxReportServiceImpl(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
}
/**
*<b>云开发通用上报接口</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
@Override
public WxReportDataRes report(WxXcxAccessToken accessToken, WxReportDataReq req){
WxReportDataRequest reportDataRequest = new WxReportDataRequest(wxXcxConfig, wxXcxRequest, accessToken, req);
return reportDataRequest.getResponse();
}
}
package com.yanzuoguang.wxxcx.cloudbase.sendSms;
import java.util.List;
/***
* 发送支持打开云开发静态网站的短信,该 H5 可以打开小程序
*
* @author:heyanou
*/
public class WxSendSmsDataReq {
/**
* <p>
* 是否必填:是
* 描述:接口调用凭证
* </p>
*/
private String access_token;
/**
* <p>
* 是否必填:是
* 描述:环境 ID
* </p>
*/
private String env;
/**
* <p>
* 是否必填:是
* 描述:手机号列表,单次请求最多支持 1000 个境内手机号,手机号必须以+86开头
* </p>
*/
private List<String> phone_number_list;
/**
* <p>
* 是否必填:是
* 描述:短信类型,营销类短信:Marketing;通知类短信:Notification
* </p>
*/
private String sms_type="Marketing";
/**
* <p>
* 是否必填:是
* 描述:sms_type="Marketing" 时必填,自定义短信内容,一条短信最多为70个字。可自定义内容最多为 30 个字符,详情参考短信规则
* </p>
*/
private String content;
/**
* <p>
* 是否必填:是
* 描述:sms_type="Marketing" 时必填,云开发静态网站 path,不需要指定域名,例如/index.html
* </p>
*/
private String path;
/**
* <p>
* 是否必填:是
* 描述:sms_type="Notification" 时必填,模版 ID
* </p>
*/
private String template_id;
/**
* <p>
* 是否必填:是
* 描述:生成这个随机字符串的 UNIX 时间戳(精确到秒)
* </p>
*/
private List<String> template_param_list;
/**
* <p>
* 是否必填:否
* 描述:是否使用小程序简称
* </p>
*/
private Boolean use_short_name;
/**
* <p>
* 是否必填:v
* 描述:资源方appid,第三方代开发时可填第三方 appid 或小程序appid,应为所填环境所属的账号APPID
* </p>
*/
private String resource_appid;
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getEnv() {
return env;
}
public void setEnv(String env) {
this.env = env;
}
public List<String> getPhone_number_list() {
return phone_number_list;
}
public void setPhone_number_list(List<String> phone_number_list) {
this.phone_number_list = phone_number_list;
}
public String getSms_type() {
return sms_type;
}
public void setSms_type(String sms_type) {
this.sms_type = sms_type;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getTemplate_id() {
return template_id;
}
public void setTemplate_id(String template_id) {
this.template_id = template_id;
}
public List<String> getTemplate_param_list() {
return template_param_list;
}
public void setTemplate_param_list(List<String> template_param_list) {
this.template_param_list = template_param_list;
}
public Boolean getUse_short_name() {
return use_short_name;
}
public void setUse_short_name(Boolean use_short_name) {
this.use_short_name = use_short_name;
}
public String getResource_appid() {
return resource_appid;
}
public void setResource_appid(String resource_appid) {
this.resource_appid = resource_appid;
}
}
package com.yanzuoguang.wxxcx.cloudbase.sendSms;
import com.alibaba.fastjson.TypeReference;
import com.yanzuoguang.util.helper.HttpHelper;
import com.yanzuoguang.util.helper.JsonHelper;
import com.yanzuoguang.wxxcx.base.*;
/***
* 云开发通用上报接口
*
* @author:heyanou
*/
public class WxSendSmsDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara, WxXcxRequestPostFormData {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
private final WxXcxAccessToken accessToken;
private final WxSendSmsDataReq req;
public WxSendSmsDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxSendSmsDataReq req) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
this.accessToken = accessToken;
this.req = req;
}
@Override
public String getPost() {
return HttpHelper.getUrlParameter(req);
}
@Override
public String getUrlPara() {
return HttpHelper.getUrlParameter(accessToken);
}
@Override
public String getUrl() {
return wxXcxConfig.getBaseUrl() + wxXcxConfig.getCloudbaseSendSmsDataUrl() + "?" + this.getUrlPara();
}
/***
* <b>response返回结果集检测</b>
* @return 返回类对象
*/
public WxSendSmsDataRes getResponse() {
// todo: 检测参数是否合法
return this.wxXcxRequest.request(this, response -> {
WxSendSmsDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxSendSmsDataRes>() {
});
WxXcxAssert.assertBaseError(ret);
return ret;
});
}
}
package com.yanzuoguang.wxxcx.cloudbase.sendSms;
import com.yanzuoguang.wxxcx.cloudbase.vo.SendStatusList;
import com.yanzuoguang.wxxcx.base.WxXcxResponseBaseError;
import java.util.ArrayList;
import java.util.List;
/***
* 返回的 JSON 数据包
*
* @author:heyanou
*/
public class WxSendSmsDataRes extends WxXcxResponseBaseError {
/***
* <p>开放数据列表</p>
*/
private List<SendStatusList> send_status_list=new ArrayList<>();
public List<SendStatusList> getSend_status_list() {
return send_status_list;
}
public void setSend_status_list(List<SendStatusList> send_status_list) {
this.send_status_list = send_status_list;
}
}
package com.yanzuoguang.wxxcx.cloudbase.sendSms.service;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.cloudbase.sendSms.WxSendSmsDataReq;
import com.yanzuoguang.wxxcx.cloudbase.sendSms.WxSendSmsDataRes;
/***
* 发送支持打开云开发静态网站的短信
*
* @author:heyanou
*/
public interface WxSendSmsService {
/**
*<b>发送支持打开云开发静态网站的短信,该 H5 可以打开小程序</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
WxSendSmsDataRes sendSms(WxXcxAccessToken accessToken, WxSendSmsDataReq req);
}
package com.yanzuoguang.wxxcx.cloudbase.sendSms.service.impl;
import com.yanzuoguang.wxxcx.base.WxXcxAccessToken;
import com.yanzuoguang.wxxcx.base.WxXcxConfig;
import com.yanzuoguang.wxxcx.base.WxXcxRequest;
import com.yanzuoguang.wxxcx.cloudbase.sendSms.WxSendSmsDataReq;
import com.yanzuoguang.wxxcx.cloudbase.sendSms.WxSendSmsDataRequest;
import com.yanzuoguang.wxxcx.cloudbase.sendSms.WxSendSmsDataRes;
import com.yanzuoguang.wxxcx.cloudbase.sendSms.service.WxSendSmsService;
import org.springframework.stereotype.Component;
/***
* 发送支持打开云开发静态网站的短信
*
* @author:heyanou
*/
@Component
public class WxSendSmsServiceImpl implements WxSendSmsService {
private final WxXcxConfig wxXcxConfig;
private final WxXcxRequest wxXcxRequest;
public WxSendSmsServiceImpl(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest) {
this.wxXcxConfig = wxXcxConfig;
this.wxXcxRequest = wxXcxRequest;
}
/**
*<b>发送支持打开云开发静态网站的短信,该 H5 可以打开小程序</b>
* @param accessToken 传输带的指令牌
* @param req 请求数据
* @return 返回结果集
*/
@Override
public WxSendSmsDataRes sendSms(WxXcxAccessToken accessToken, WxSendSmsDataReq req){
WxSendSmsDataRequest sendSmsDataRequest = new WxSendSmsDataRequest(wxXcxConfig, wxXcxRequest, accessToken, req);
return sendSmsDataRequest.getResponse();
}
}
- [硬件设备]
- [设备消息]
- [开发者可以通过该接口向用户发送设备消息](./send/send.md)
- [获取设备票据]
- [获取设备票据,5 分钟内有效](./snTicket/snTicket.md)
This diff is collapsed.
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