🎨 优化重构代码

This commit is contained in:
Binary Wang 2021-01-28 22:44:53 +08:00
parent 73c135fb10
commit fa179f6cba
40 changed files with 848 additions and 587 deletions

View File

@ -11,201 +11,186 @@ import lombok.experimental.UtilityClass;
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
@UtilityClass
public final class WxCpApiPathConsts {
public static final String DEFAULT_CP_BASE_URL = "https://qyapi.weixin.qq.com";
public interface WxCpApiPathConsts {
String DEFAULT_CP_BASE_URL = "https://qyapi.weixin.qq.com";
public static final String GET_JSAPI_TICKET = "/cgi-bin/get_jsapi_ticket";
public static final String GET_AGENT_CONFIG_TICKET = "/cgi-bin/ticket/get?&type=agent_config";
public static final String GET_CALLBACK_IP = "/cgi-bin/getcallbackip";
public static final String BATCH_REPLACE_PARTY = "/cgi-bin/batch/replaceparty";
public static final String BATCH_REPLACE_USER = "/cgi-bin/batch/replaceuser";
public static final String BATCH_GET_RESULT = "/cgi-bin/batch/getresult?jobid=";
public static final String JSCODE_TO_SESSION = "/cgi-bin/miniprogram/jscode2session";
public static final String GET_TOKEN = "/cgi-bin/gettoken?corpid=%s&corpsecret=%s";
public static final String WEBHOOK_SEND = "/cgi-bin/webhook/send?key=";
String GET_JSAPI_TICKET = "/cgi-bin/get_jsapi_ticket";
String GET_AGENT_CONFIG_TICKET = "/cgi-bin/ticket/get?&type=agent_config";
String GET_CALLBACK_IP = "/cgi-bin/getcallbackip";
String BATCH_REPLACE_PARTY = "/cgi-bin/batch/replaceparty";
String BATCH_REPLACE_USER = "/cgi-bin/batch/replaceuser";
String BATCH_GET_RESULT = "/cgi-bin/batch/getresult?jobid=";
String JSCODE_TO_SESSION = "/cgi-bin/miniprogram/jscode2session";
String GET_TOKEN = "/cgi-bin/gettoken?corpid=%s&corpsecret=%s";
String WEBHOOK_SEND = "/cgi-bin/webhook/send?key=";
/**
* 消息推送相关接口
* https://work.weixin.qq.com/api/doc/90000/90135/90235
*/
@UtilityClass
public static class Message {
interface Message {
/**
* 发送应用消息
*/
public static final String MESSAGE_SEND = "/cgi-bin/message/send";
String MESSAGE_SEND = "/cgi-bin/message/send";
/**
* 查询应用消息发送统计
*/
public static final String GET_STATISTICS = "/cgi-bin/message/get_statistics";
String GET_STATISTICS = "/cgi-bin/message/get_statistics";
/**
* 互联企业发送应用消息
*/
public static final String LINKEDCORP_MESSAGE_SEND = "/cgi-bin/linkedcorp/message/send";
String LINKEDCORP_MESSAGE_SEND = "/cgi-bin/linkedcorp/message/send";
}
@UtilityClass
public static class Agent {
public static final String AGENT_GET = "/cgi-bin/agent/get?agentid=%d";
public static final String AGENT_SET = "/cgi-bin/agent/set";
public static final String AGENT_LIST = "/cgi-bin/agent/list";
interface Agent {
String AGENT_GET = "/cgi-bin/agent/get?agentid=%d";
String AGENT_SET = "/cgi-bin/agent/set";
String AGENT_LIST = "/cgi-bin/agent/list";
}
@UtilityClass
public static class WorkBench {
public static final String WORKBENCH_TEMPLATE_SET = "/cgi-bin/agent/set_workbench_template";
public static final String WORKBENCH_TEMPLATE_GET = "/cgi-bin/agent/get_workbench_template";
public static final String WORKBENCH_DATA_SET = "/cgi-bin/agent/set_workbench_data";
interface WorkBench {
String WORKBENCH_TEMPLATE_SET = "/cgi-bin/agent/set_workbench_template";
String WORKBENCH_TEMPLATE_GET = "/cgi-bin/agent/get_workbench_template";
String WORKBENCH_DATA_SET = "/cgi-bin/agent/set_workbench_data";
}
@UtilityClass
public static class OAuth2 {
public static final String GET_USER_INFO = "/cgi-bin/user/getuserinfo?code=%s&agentid=%d";
public static final String GET_USER_DETAIL = "/cgi-bin/user/getuserdetail";
public static final String URL_OAUTH2_AUTHORIZE = "https://open.weixin.qq.com/connect/oauth2/authorize";
interface OAuth2 {
String GET_USER_INFO = "/cgi-bin/user/getuserinfo?code=%s&agentid=%d";
String GET_USER_DETAIL = "/cgi-bin/user/getuserdetail";
String URL_OAUTH2_AUTHORIZE = "https://open.weixin.qq.com/connect/oauth2/authorize";
}
@UtilityClass
public static class Chat {
public static final String APPCHAT_CREATE = "/cgi-bin/appchat/create";
public static final String APPCHAT_UPDATE = "/cgi-bin/appchat/update";
public static final String APPCHAT_GET_CHATID = "/cgi-bin/appchat/get?chatid=";
public static final String APPCHAT_SEND = "/cgi-bin/appchat/send";
interface Chat {
String APPCHAT_CREATE = "/cgi-bin/appchat/create";
String APPCHAT_UPDATE = "/cgi-bin/appchat/update";
String APPCHAT_GET_CHATID = "/cgi-bin/appchat/get?chatid=";
String APPCHAT_SEND = "/cgi-bin/appchat/send";
}
@UtilityClass
public static class Department {
public static final String DEPARTMENT_CREATE = "/cgi-bin/department/create";
public static final String DEPARTMENT_UPDATE = "/cgi-bin/department/update";
public static final String DEPARTMENT_DELETE = "/cgi-bin/department/delete?id=%d";
public static final String DEPARTMENT_LIST = "/cgi-bin/department/list";
interface Department {
String DEPARTMENT_CREATE = "/cgi-bin/department/create";
String DEPARTMENT_UPDATE = "/cgi-bin/department/update";
String DEPARTMENT_DELETE = "/cgi-bin/department/delete?id=%d";
String DEPARTMENT_LIST = "/cgi-bin/department/list";
}
@UtilityClass
public static class Media {
public static final String MEDIA_GET = "/cgi-bin/media/get";
public static final String MEDIA_UPLOAD = "/cgi-bin/media/upload?type=";
public static final String IMG_UPLOAD = "/cgi-bin/media/uploadimg";
public static final String JSSDK_MEDIA_GET = "/cgi-bin/media/get/jssdk";
interface Media {
String MEDIA_GET = "/cgi-bin/media/get";
String MEDIA_UPLOAD = "/cgi-bin/media/upload?type=";
String IMG_UPLOAD = "/cgi-bin/media/uploadimg";
String JSSDK_MEDIA_GET = "/cgi-bin/media/get/jssdk";
}
@UtilityClass
public static class Menu {
public static final String MENU_CREATE = "/cgi-bin/menu/create?agentid=%d";
public static final String MENU_DELETE = "/cgi-bin/menu/delete?agentid=%d";
public static final String MENU_GET = "/cgi-bin/menu/get?agentid=%d";
interface Menu {
String MENU_CREATE = "/cgi-bin/menu/create?agentid=%d";
String MENU_DELETE = "/cgi-bin/menu/delete?agentid=%d";
String MENU_GET = "/cgi-bin/menu/get?agentid=%d";
}
@UtilityClass
public static class Oa {
public static final String GET_CHECKIN_DATA = "/cgi-bin/checkin/getcheckindata";
public static final String GET_CHECKIN_OPTION = "/cgi-bin/checkin/getcheckinoption";
public static final String GET_APPROVAL_INFO = "/cgi-bin/oa/getapprovalinfo";
public static final String GET_APPROVAL_DETAIL = "/cgi-bin/oa/getapprovaldetail";
public static final String GET_DIAL_RECORD = "/cgi-bin/dial/get_dial_record";
public static final String GET_TEMPLATE_DETAIL = "/cgi-bin/oa/gettemplatedetail";
public static final String APPLY_EVENT = "/cgi-bin/oa/applyevent";
interface Oa {
String GET_CHECKIN_DATA = "/cgi-bin/checkin/getcheckindata";
String GET_CHECKIN_OPTION = "/cgi-bin/checkin/getcheckinoption";
String GET_APPROVAL_INFO = "/cgi-bin/oa/getapprovalinfo";
String GET_APPROVAL_DETAIL = "/cgi-bin/oa/getapprovaldetail";
String GET_DIAL_RECORD = "/cgi-bin/dial/get_dial_record";
String GET_TEMPLATE_DETAIL = "/cgi-bin/oa/gettemplatedetail";
String APPLY_EVENT = "/cgi-bin/oa/applyevent";
public static final String CALENDAR_ADD = "/cgi-bin/oa/calendar/add";
public static final String CALENDAR_UPDATE = "/cgi-bin/oa/calendar/update";
public static final String CALENDAR_GET = "/cgi-bin/oa/calendar/get";
public static final String CALENDAR_DEL = "/cgi-bin/oa/calendar/del";
String CALENDAR_ADD = "/cgi-bin/oa/calendar/add";
String CALENDAR_UPDATE = "/cgi-bin/oa/calendar/update";
String CALENDAR_GET = "/cgi-bin/oa/calendar/get";
String CALENDAR_DEL = "/cgi-bin/oa/calendar/del";
public static final String SCHEDULE_ADD = "/cgi-bin/oa/schedule/add";
public static final String SCHEDULE_UPDATE = "/cgi-bin/oa/schedule/update";
public static final String SCHEDULE_GET = "/cgi-bin/oa/schedule/get";
public static final String SCHEDULE_DEL = "/cgi-bin/oa/schedule/del";
public static final String SCHEDULE_LIST = "/cgi-bin/oa/schedule/get_by_calendar";
String SCHEDULE_ADD = "/cgi-bin/oa/schedule/add";
String SCHEDULE_UPDATE = "/cgi-bin/oa/schedule/update";
String SCHEDULE_GET = "/cgi-bin/oa/schedule/get";
String SCHEDULE_DEL = "/cgi-bin/oa/schedule/del";
String SCHEDULE_LIST = "/cgi-bin/oa/schedule/get_by_calendar";
public static final String COPY_TEMPLATE = "/cgi-bin/oa/approval/copytemplate";
String COPY_TEMPLATE = "/cgi-bin/oa/approval/copytemplate";
}
@UtilityClass
public static class Tag {
public static final String TAG_CREATE = "/cgi-bin/tag/create";
public static final String TAG_UPDATE = "/cgi-bin/tag/update";
public static final String TAG_DELETE = "/cgi-bin/tag/delete?tagid=%s";
public static final String TAG_LIST = "/cgi-bin/tag/list";
public static final String TAG_GET = "/cgi-bin/tag/get?tagid=%s";
public static final String TAG_ADD_TAG_USERS = "/cgi-bin/tag/addtagusers";
public static final String TAG_DEL_TAG_USERS = "/cgi-bin/tag/deltagusers";
interface Tag {
String TAG_CREATE = "/cgi-bin/tag/create";
String TAG_UPDATE = "/cgi-bin/tag/update";
String TAG_DELETE = "/cgi-bin/tag/delete?tagid=%s";
String TAG_LIST = "/cgi-bin/tag/list";
String TAG_GET = "/cgi-bin/tag/get?tagid=%s";
String TAG_ADD_TAG_USERS = "/cgi-bin/tag/addtagusers";
String TAG_DEL_TAG_USERS = "/cgi-bin/tag/deltagusers";
}
@UtilityClass
public static class TaskCard {
public static final String UPDATE_TASK_CARD = "/cgi-bin/message/update_taskcard";
interface TaskCard {
String UPDATE_TASK_CARD = "/cgi-bin/message/update_taskcard";
}
@UtilityClass
public static class Tp {
public static final String JSCODE_TO_SESSION = "/cgi-bin/service/miniprogram/jscode2session";
public static final String GET_CORP_TOKEN = "/cgi-bin/service/get_corp_token";
public static final String GET_PERMANENT_CODE = "/cgi-bin/service/get_permanent_code";
public static final String GET_SUITE_TOKEN = "/cgi-bin/service/get_suite_token";
public static final String GET_PROVIDER_TOKEN = "/cgi-bin/service/get_provider_token";
public static final String GET_PREAUTH_CODE = "/cgi-bin/service/get_pre_auth_code";
public static final String GET_AUTH_INFO = "/cgi-bin/service/get_auth_info";
public static final String GET_AUTH_CORP_JSAPI_TICKET = "/cgi-bin/get_jsapi_ticket";
public static final String GET_SUITE_JSAPI_TICKET = "/cgi-bin/ticket/get";
public static final String GET_USERINFO3RD = "/cgi-bin/service/getuserinfo3rd";
public static final String GET_USERDETAIL3RD = "/cgi-bin/service/getuserdetail3rd";
public static final String GET_LOGIN_INFO = "/cgi-bin/service/get_login_info";
interface Tp {
String JSCODE_TO_SESSION = "/cgi-bin/service/miniprogram/jscode2session";
String GET_CORP_TOKEN = "/cgi-bin/service/get_corp_token";
String GET_PERMANENT_CODE = "/cgi-bin/service/get_permanent_code";
String GET_SUITE_TOKEN = "/cgi-bin/service/get_suite_token";
String GET_PROVIDER_TOKEN = "/cgi-bin/service/get_provider_token";
String GET_PREAUTH_CODE = "/cgi-bin/service/get_pre_auth_code";
String GET_AUTH_INFO = "/cgi-bin/service/get_auth_info";
String GET_AUTH_CORP_JSAPI_TICKET = "/cgi-bin/get_jsapi_ticket";
String GET_SUITE_JSAPI_TICKET = "/cgi-bin/ticket/get";
String GET_USERINFO3RD = "/cgi-bin/service/getuserinfo3rd";
String GET_USERDETAIL3RD = "/cgi-bin/service/getuserdetail3rd";
String GET_LOGIN_INFO = "/cgi-bin/service/get_login_info";
public static final String CONTACT_SEARCH = "/cgi-bin/service/contact/search";
public static final String GET_ADMIN_LIST = "/cgi-bin/service/get_admin_list";
String CONTACT_SEARCH = "/cgi-bin/service/contact/search";
String GET_ADMIN_LIST = "/cgi-bin/service/get_admin_list";
}
@UtilityClass
public static class User {
public static final String USER_AUTHENTICATE = "/cgi-bin/user/authsucc?userid=";
public static final String USER_CREATE = "/cgi-bin/user/create";
public static final String USER_UPDATE = "/cgi-bin/user/update";
public static final String USER_DELETE = "/cgi-bin/user/delete?userid=";
public static final String USER_BATCH_DELETE = "/cgi-bin/user/batchdelete";
public static final String USER_GET = "/cgi-bin/user/get?userid=";
public static final String USER_LIST = "/cgi-bin/user/list?department_id=";
public static final String USER_SIMPLE_LIST = "/cgi-bin/user/simplelist?department_id=";
public static final String BATCH_INVITE = "/cgi-bin/batch/invite";
public static final String USER_CONVERT_TO_OPENID = "/cgi-bin/user/convert_to_openid";
public static final String USER_CONVERT_TO_USERID = "/cgi-bin/user/convert_to_userid";
public static final String GET_USER_ID = "/cgi-bin/user/getuserid";
public static final String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid=";
public static final String GET_JOIN_QR_CODE = "/cgi-bin/corp/get_join_qrcode?size_type=";
interface User {
String USER_AUTHENTICATE = "/cgi-bin/user/authsucc?userid=";
String USER_CREATE = "/cgi-bin/user/create";
String USER_UPDATE = "/cgi-bin/user/update";
String USER_DELETE = "/cgi-bin/user/delete?userid=";
String USER_BATCH_DELETE = "/cgi-bin/user/batchdelete";
String USER_GET = "/cgi-bin/user/get?userid=";
String USER_LIST = "/cgi-bin/user/list?department_id=";
String USER_SIMPLE_LIST = "/cgi-bin/user/simplelist?department_id=";
String BATCH_INVITE = "/cgi-bin/batch/invite";
String USER_CONVERT_TO_OPENID = "/cgi-bin/user/convert_to_openid";
String USER_CONVERT_TO_USERID = "/cgi-bin/user/convert_to_userid";
String GET_USER_ID = "/cgi-bin/user/getuserid";
String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid=";
String GET_JOIN_QR_CODE = "/cgi-bin/corp/get_join_qrcode?size_type=";
}
@UtilityClass
public static class ExternalContact {
interface ExternalContact {
@Deprecated
public static final String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid=";
String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid=";
public static final String ADD_CONTACT_WAY = "/cgi-bin/externalcontact/add_contact_way";
public static final String GET_CONTACT_WAY = "/cgi-bin/externalcontact/get_contact_way";
public static final String UPDATE_CONTACT_WAY = "/cgi-bin/externalcontact/update_contact_way";
public static final String DEL_CONTACT_WAY = "/cgi-bin/externalcontact/del_contact_way";
public static final String CLOSE_TEMP_CHAT = "/cgi-bin/externalcontact/close_temp_chat";
public static final String GET_FOLLOW_USER_LIST = "/cgi-bin/externalcontact/get_follow_user_list";
public static final String GET_CONTACT_DETAIL = "/cgi-bin/externalcontact/get?external_userid=";
public static final String GET_CONTACT_DETAIL_BATCH = "/cgi-bin/externalcontact/batch/get_by_user?";
public static final String UPDATE_REMARK = "/cgi-bin/externalcontact/remark";
public static final String LIST_EXTERNAL_CONTACT = "/cgi-bin/externalcontact/list?userid=";
public static final String LIST_UNASSIGNED_CONTACT = "/cgi-bin/externalcontact/get_unassigned_list";
public static final String TRANSFER_UNASSIGNED_CONTACT = "/cgi-bin/externalcontact/transfer";
public static final String GROUP_CHAT_LIST = "/cgi-bin/externalcontact/groupchat/list";
public static final String GROUP_CHAT_INFO = "/cgi-bin/externalcontact/groupchat/get";
public static final String LIST_USER_BEHAVIOR_DATA = "/cgi-bin/externalcontact/get_user_behavior_data";
public static final String LIST_GROUP_CHAT_DATA = "/cgi-bin/externalcontact/groupchat/statistic";
public static final String ADD_MSG_TEMPLATE = "/cgi-bin/externalcontact/add_msg_template";
public static final String SEND_WELCOME_MSG = "/cgi-bin/externalcontact/send_welcome_msg";
String ADD_CONTACT_WAY = "/cgi-bin/externalcontact/add_contact_way";
String GET_CONTACT_WAY = "/cgi-bin/externalcontact/get_contact_way";
String UPDATE_CONTACT_WAY = "/cgi-bin/externalcontact/update_contact_way";
String DEL_CONTACT_WAY = "/cgi-bin/externalcontact/del_contact_way";
String CLOSE_TEMP_CHAT = "/cgi-bin/externalcontact/close_temp_chat";
String GET_FOLLOW_USER_LIST = "/cgi-bin/externalcontact/get_follow_user_list";
String GET_CONTACT_DETAIL = "/cgi-bin/externalcontact/get?external_userid=";
String GET_CONTACT_DETAIL_BATCH = "/cgi-bin/externalcontact/batch/get_by_user?";
String UPDATE_REMARK = "/cgi-bin/externalcontact/remark";
String LIST_EXTERNAL_CONTACT = "/cgi-bin/externalcontact/list?userid=";
String LIST_UNASSIGNED_CONTACT = "/cgi-bin/externalcontact/get_unassigned_list";
String TRANSFER_UNASSIGNED_CONTACT = "/cgi-bin/externalcontact/transfer";
String GROUP_CHAT_LIST = "/cgi-bin/externalcontact/groupchat/list";
String GROUP_CHAT_INFO = "/cgi-bin/externalcontact/groupchat/get";
String LIST_USER_BEHAVIOR_DATA = "/cgi-bin/externalcontact/get_user_behavior_data";
String LIST_GROUP_CHAT_DATA = "/cgi-bin/externalcontact/groupchat/statistic";
String ADD_MSG_TEMPLATE = "/cgi-bin/externalcontact/add_msg_template";
String SEND_WELCOME_MSG = "/cgi-bin/externalcontact/send_welcome_msg";
public static final String GET_CORP_TAG_LIST = "/cgi-bin/externalcontact/get_corp_tag_list";
public static final String ADD_CORP_TAG = "/cgi-bin/externalcontact/add_corp_tag";
public static final String EDIT_CORP_TAG = "/cgi-bin/externalcontact/edit_corp_tag";
public static final String DEL_CORP_TAG = "/cgi-bin/externalcontact/del_corp_tag";
public static final String MARK_TAG = "/cgi-bin/externalcontact/mark_tag";
String GET_CORP_TAG_LIST = "/cgi-bin/externalcontact/get_corp_tag_list";
String ADD_CORP_TAG = "/cgi-bin/externalcontact/add_corp_tag";
String EDIT_CORP_TAG = "/cgi-bin/externalcontact/edit_corp_tag";
String DEL_CORP_TAG = "/cgi-bin/externalcontact/del_corp_tag";
String MARK_TAG = "/cgi-bin/externalcontact/mark_tag";
}
}

View File

@ -1,11 +1,6 @@
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.analysis.WxMaRetainInfo;
import cn.binarywang.wx.miniapp.bean.analysis.WxMaSummaryTrend;
import cn.binarywang.wx.miniapp.bean.analysis.WxMaUserPortrait;
import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitDistribution;
import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitPage;
import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitTrend;
import cn.binarywang.wx.miniapp.bean.analysis.*;
import me.chanjar.weixin.common.error.WxErrorException;
import java.util.Date;
@ -19,16 +14,6 @@ import java.util.List;
* @since 2018-04-28
*/
public interface WxMaAnalysisService {
String GET_DAILY_SUMMARY_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiddailysummarytrend";
String GET_DAILY_VISIT_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend";
String GET_WEEKLY_VISIT_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidweeklyvisittrend";
String GET_MONTHLY_VISIT_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyvisittrend";
String GET_VISIT_DISTRIBUTION_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidvisitdistribution";
String GET_DAILY_RETAIN_INFO_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyretaininfo";
String GET_WEEKLY_RETAIN_INFO_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidweeklyretaininfo";
String GET_MONTHLY_RETAIN_INFO_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyretaininfo";
String GET_VISIT_PAGE_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidvisitpage";
String GET_USER_PORTRAIT_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiduserportrait";
/**
* 查询概况趋势

View File

@ -11,28 +11,17 @@ import java.util.Map;
* 云开发相关接口.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2020-01-22
* @date 2020 -01-22
*/
public interface WxMaCloudService {
String INVOKE_CLOUD_FUNCTION_URL = "https://api.weixin.qq.com/tcb/invokecloudfunction?env=%s&name=%s";
String DATABASE_COLLECTION_GET_URL = "https://api.weixin.qq.com/tcb/databasecollectionget";
String DATABASE_COLLECTION_DELETE_URL = "https://api.weixin.qq.com/tcb/databasecollectiondelete";
String DATABASE_COLLECTION_ADD_URL = "https://api.weixin.qq.com/tcb/databasecollectionadd";
String GET_QCLOUD_TOKEN_URL = "https://api.weixin.qq.com/tcb/getqcloudtoken";
String BATCH_DELETE_FILE_URL = "https://api.weixin.qq.com/tcb/batchdeletefile";
String BATCH_DOWNLOAD_FILE_URL = "https://api.weixin.qq.com/tcb/batchdownloadfile";
String UPLOAD_FILE_URL = "https://api.weixin.qq.com/tcb/uploadfile";
String DATABASE_MIGRATE_QUERY_INFO_URL = "https://api.weixin.qq.com/tcb/databasemigratequeryinfo";
String DATABASE_MIGRATE_EXPORT_URL = "https://api.weixin.qq.com/tcb/databasemigrateexport";
String DATABASE_MIGRATE_IMPORT_URL = "https://api.weixin.qq.com/tcb/databasemigrateimport";
String UPDATE_INDEX_URL = "https://api.weixin.qq.com/tcb/updateindex";
String DATABASE_COUNT_URL = "https://api.weixin.qq.com/tcb/databasecount";
String DATABASE_AGGREGATE_URL = "https://api.weixin.qq.com/tcb/databaseaggregate";
String DATABASE_QUERY_URL = "https://api.weixin.qq.com/tcb/databasequery";
String DATABASE_UPDATE_URL = "https://api.weixin.qq.com/tcb/databaseupdate";
String DATABASE_DELETE_URL = "https://api.weixin.qq.com/tcb/databasedelete";
String DATABASE_ADD_URL = "https://api.weixin.qq.com/tcb/databaseadd";
/**
* Invoke cloud function string.
*
* @param name the name
* @param body the body
* @return the string
* @throws WxErrorException the wx error exception
*/
String invokeCloudFunction(String name, String body) throws WxErrorException;
/**
@ -48,15 +37,38 @@ public interface WxMaCloudService {
* @param env string 云开发环境ID
* @param name string 云函数名称
* @param body string 云函数的传入参数具体结构由开发者定义
* @return resp_data string 云函数返回的buffer
* @return resp_data string 云函数返回的buffer
* @throws WxErrorException .
*/
String invokeCloudFunction(String env, String name, String body) throws WxErrorException;
/**
* Add list.
*
* @param collection the collection
* @param list the list
* @return the list
* @throws WxErrorException the wx error exception
*/
List<String> add(String collection, List list) throws WxErrorException;
/**
* Add string.
*
* @param collection the collection
* @param obj the obj
* @return the string
* @throws WxErrorException the wx error exception
*/
String add(String collection, Object obj) throws WxErrorException;
/**
* Database add json array.
*
* @param query the query
* @return the json array
* @throws WxErrorException the wx error exception
*/
JsonArray databaseAdd(String query) throws WxErrorException;
/**
@ -69,13 +81,28 @@ public interface WxMaCloudService {
*
* @param env 云环境ID
* @param query 数据库操作语句
* @return 插入成功的数据集合主键_id
* @return 插入成功的数据集合主键_id json array
* @throws WxErrorException .
*/
JsonArray databaseAdd(String env, String query) throws WxErrorException;
/**
* Delete integer.
*
* @param collection the collection
* @param whereJson the where json
* @return the integer
* @throws WxErrorException the wx error exception
*/
Integer delete(String collection, String whereJson) throws WxErrorException;
/**
* Database delete int.
*
* @param query the query
* @return the int
* @throws WxErrorException the wx error exception
*/
int databaseDelete(String query) throws WxErrorException;
/**
@ -88,13 +115,29 @@ public interface WxMaCloudService {
*
* @param env 云环境ID
* @param query 数据库操作语句
* @return 删除记录数量
* @return 删除记录数量 int
* @throws WxErrorException .
*/
int databaseDelete(String env, String query) throws WxErrorException;
/**
* Update wx cloud database update result.
*
* @param collection the collection
* @param whereJson the where json
* @param updateJson the update json
* @return the wx cloud database update result
* @throws WxErrorException the wx error exception
*/
WxCloudDatabaseUpdateResult update(String collection, String whereJson, String updateJson) throws WxErrorException;
/**
* Database update wx cloud database update result.
*
* @param query the query
* @return the wx cloud database update result
* @throws WxErrorException the wx error exception
*/
WxCloudDatabaseUpdateResult databaseUpdate(String query) throws WxErrorException;
/**
@ -107,32 +150,40 @@ public interface WxMaCloudService {
*
* @param env 云环境ID
* @param query 数据库操作语句
* @return .
* @return . wx cloud database update result
* @throws WxErrorException .
*/
WxCloudDatabaseUpdateResult databaseUpdate(String env, String query) throws WxErrorException;
/**
* db.collection('geo')
* .where({
* price: _.gt(10)
* })
* .orderBy('_id', 'asc')
* .orderBy('price', 'desc')
* .skip(1)
* .limit(10)
* .get()
* @param collection
* @param whereJson
* @param orderBy
* @param skip
* @param limit
* @return
* @throws WxErrorException
* .where({
* price: _.gt(10)
* })
* .orderBy('_id', 'asc')
* .orderBy('price', 'desc')
* .skip(1)
* .limit(10)
* .get()
*
* @param collection the collection
* @param whereJson the where json
* @param orderBy the order by
* @param skip the skip
* @param limit the limit
* @return wx cloud database query result
* @throws WxErrorException the wx error exception
*/
WxCloudDatabaseQueryResult query(String collection, String whereJson, Map<String, String> orderBy,
Integer skip, Integer limit) throws WxErrorException;
/**
* Database query wx cloud database query result.
*
* @param query the query
* @return the wx cloud database query result
* @throws WxErrorException the wx error exception
*/
WxCloudDatabaseQueryResult databaseQuery(String query) throws WxErrorException;
/**
@ -145,11 +196,18 @@ public interface WxMaCloudService {
*
* @param env 云环境ID
* @param query 数据库操作语句
* @return .
* @return . wx cloud database query result
* @throws WxErrorException .
*/
WxCloudDatabaseQueryResult databaseQuery(String env, String query) throws WxErrorException;
/**
* Database aggregate json array.
*
* @param query the query
* @return the json array
* @throws WxErrorException the wx error exception
*/
JsonArray databaseAggregate(String query) throws WxErrorException;
/**
@ -162,13 +220,28 @@ public interface WxMaCloudService {
*
* @param env 云环境ID
* @param query 数据库操作语句
* @return .
* @return . json array
* @throws WxErrorException .
*/
JsonArray databaseAggregate(String env, String query) throws WxErrorException;
/**
* Count long.
*
* @param collection the collection
* @param whereJson the where json
* @return the long
* @throws WxErrorException the wx error exception
*/
Long count(String collection, String whereJson) throws WxErrorException;
/**
* Database count long.
*
* @param query the query
* @return the long
* @throws WxErrorException the wx error exception
*/
Long databaseCount(String query) throws WxErrorException;
/**
@ -181,11 +254,19 @@ public interface WxMaCloudService {
*
* @param env 云环境ID
* @param query 数据库操作语句
* @return 记录数量
* @return 记录数量 long
* @throws WxErrorException .
*/
Long databaseCount(String env, String query) throws WxErrorException;
/**
* Update index.
*
* @param collectionName the collection name
* @param createIndexes the create indexes
* @param dropIndexNames the drop index names
* @throws WxErrorException the wx error exception
*/
void updateIndex(String collectionName, List<WxCloudDatabaseCreateIndexRequest> createIndexes,
List<String> dropIndexNames) throws WxErrorException;
@ -206,6 +287,17 @@ public interface WxMaCloudService {
void updateIndex(String env, String collectionName, List<WxCloudDatabaseCreateIndexRequest> createIndexes,
List<String> dropIndexNames) throws WxErrorException;
/**
* Database migrate import long.
*
* @param collectionName the collection name
* @param filePath the file path
* @param fileType the file type
* @param stopOnError the stop on error
* @param conflictMode the conflict mode
* @return the long
* @throws WxErrorException the wx error exception
*/
Long databaseMigrateImport(String collectionName, String filePath, int fileType,
boolean stopOnError, int conflictMode) throws WxErrorException;
@ -224,12 +316,21 @@ public interface WxMaCloudService {
* @param fileType 导入文件类型 1 JSON 2 CSV
* @param stopOnError 是否在遇到错误时停止导入
* @param conflictMode 冲突处理模式 1 INSERT , 2 UPSERT
* @return jobId
* @return jobId long
* @throws WxErrorException .
*/
Long databaseMigrateImport(String env, String collectionName, String filePath, int fileType, boolean stopOnError,
int conflictMode) throws WxErrorException;
/**
* Database migrate export long.
*
* @param filePath the file path
* @param fileType the file type
* @param query the query
* @return the long
* @throws WxErrorException the wx error exception
*/
Long databaseMigrateExport(String filePath, int fileType, String query) throws WxErrorException;
/**
@ -245,11 +346,18 @@ public interface WxMaCloudService {
* @param filePath 导出文件路径文件会导出到同环境的云存储中可使用获取下载链接 API 获取下载链接
* @param fileType 导出文件类型 1 JSON 2 CSV
* @param query 导出条件
* @return jobId
* @return jobId long
* @throws WxErrorException .
*/
Long databaseMigrateExport(String env, String filePath, int fileType, String query) throws WxErrorException;
/**
* Database migrate query info wx cloud cloud database migrate query info result.
*
* @param jobId the job id
* @return the wx cloud cloud database migrate query info result
* @throws WxErrorException the wx error exception
*/
WxCloudCloudDatabaseMigrateQueryInfoResult databaseMigrateQueryInfo(Long jobId) throws WxErrorException;
/**
@ -263,11 +371,18 @@ public interface WxMaCloudService {
*
* @param env 云环境ID
* @param jobId 迁移任务ID
* @return .
* @return . wx cloud cloud database migrate query info result
* @throws WxErrorException .
*/
WxCloudCloudDatabaseMigrateQueryInfoResult databaseMigrateQueryInfo(String env, Long jobId) throws WxErrorException;
/**
* Upload file wx cloud upload file result.
*
* @param path the path
* @return the wx cloud upload file result
* @throws WxErrorException the wx error exception
*/
WxCloudUploadFileResult uploadFile(String path) throws WxErrorException;
/**
@ -281,11 +396,19 @@ public interface WxMaCloudService {
*
* @param env 云环境ID
* @param path 上传路径
* @return 上传结果
* @return 上传结果 wx cloud upload file result
* @throws WxErrorException .
*/
WxCloudUploadFileResult uploadFile(String env, String path) throws WxErrorException;
/**
* Batch download file wx cloud batch download file result.
*
* @param fileIds the file ids
* @param maxAges the max ages
* @return the wx cloud batch download file result
* @throws WxErrorException the wx error exception
*/
WxCloudBatchDownloadFileResult batchDownloadFile(String[] fileIds, long[] maxAges) throws WxErrorException;
/**
@ -300,11 +423,18 @@ public interface WxMaCloudService {
* @param env 云环境ID
* @param fileIds 文件ID列表
* @param maxAges 下载链接有效期列表对应文件id列表
* @return 下载链接信息
* @return 下载链接信息 wx cloud batch download file result
* @throws WxErrorException .
*/
WxCloudBatchDownloadFileResult batchDownloadFile(String env, String[] fileIds, long[] maxAges) throws WxErrorException;
/**
* Batch delete file wx cloud batch delete file result.
*
* @param fileIds the file ids
* @return the wx cloud batch delete file result
* @throws WxErrorException the wx error exception
*/
WxCloudBatchDeleteFileResult batchDeleteFile(String[] fileIds) throws WxErrorException;
/**
@ -318,7 +448,7 @@ public interface WxMaCloudService {
*
* @param env 云环境ID
* @param fileIds 文件ID列表
* @return 下载链接信息
* @return 下载链接信息 wx cloud batch delete file result
* @throws WxErrorException .
*/
WxCloudBatchDeleteFileResult batchDeleteFile(String env, String[] fileIds) throws WxErrorException;
@ -332,11 +462,17 @@ public interface WxMaCloudService {
* </pre>
*
* @param lifeSpan 有效期单位为秒最大7200
* @return .
* @return . qcloud token
* @throws WxErrorException .
*/
WxCloudGetQcloudTokenResult getQcloudToken(long lifeSpan) throws WxErrorException;
/**
* Database collection add.
*
* @param collectionName the collection name
* @throws WxErrorException the wx error exception
*/
void databaseCollectionAdd(String collectionName) throws WxErrorException;
/**
@ -354,6 +490,12 @@ public interface WxMaCloudService {
*/
void databaseCollectionAdd(String env, String collectionName) throws WxErrorException;
/**
* Database collection delete.
*
* @param collectionName the collection name
* @throws WxErrorException the wx error exception
*/
void databaseCollectionDelete(String collectionName) throws WxErrorException;
/**
@ -371,6 +513,14 @@ public interface WxMaCloudService {
*/
void databaseCollectionDelete(String env, String collectionName) throws WxErrorException;
/**
* Database collection get wx cloud database collection get result.
*
* @param limit the limit
* @param offset the offset
* @return the wx cloud database collection get result
* @throws WxErrorException the wx error exception
*/
WxCloudDatabaseCollectionGetResult databaseCollectionGet(Long limit, Long offset) throws WxErrorException;
/**
@ -385,7 +535,7 @@ public interface WxMaCloudService {
* @param env 云环境ID
* @param limit 获取数量限制默认值10
* @param offset 偏移量,默认值0
* @return .
* @return . wx cloud database collection get result
* @throws WxErrorException .
*/
WxCloudDatabaseCollectionGetResult databaseCollectionGet(String env, Long limit, Long offset) throws WxErrorException;

View File

@ -13,23 +13,6 @@ import java.util.List;
* @since 2018-04-26 19:43
*/
public interface WxMaCodeService {
/**
* 为授权的小程序帐号上传小程序代码.
*/
String COMMIT_URL = "https://api.weixin.qq.com/wxa/commit";
String GET_QRCODE_URL = "https://api.weixin.qq.com/wxa/get_qrcode";
String GET_CATEGORY_URL = "https://api.weixin.qq.com/wxa/get_category";
String GET_PAGE_URL = "https://api.weixin.qq.com/wxa/get_page";
String SUBMIT_AUDIT_URL = "https://api.weixin.qq.com/wxa/submit_audit";
String GET_AUDIT_STATUS_URL = "https://api.weixin.qq.com/wxa/get_auditstatus";
String GET_LATEST_AUDIT_STATUS_URL = "https://api.weixin.qq.com/wxa/get_latest_auditstatus";
String RELEASE_URL = "https://api.weixin.qq.com/wxa/release";
String CHANGE_VISIT_STATUS_URL = "https://api.weixin.qq.com/wxa/change_visitstatus";
String REVERT_CODE_RELEASE_URL = "https://api.weixin.qq.com/wxa/revertcoderelease";
String GET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/getweappsupportversion";
String SET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/setweappsupportversion";
String UNDO_CODE_AUDIT_URL = "https://api.weixin.qq.com/wxa/undocodeaudit";
/**
* 为授权的小程序帐号上传小程序代码仅仅支持第三方开放平台.
*

View File

@ -12,192 +12,128 @@ import java.util.List;
/**
* 小程序物流助手
*
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @since 2019-11-26
*/
public interface WxMaExpressService {
/**
* 获取支持的快递公司列表
*/
String ALL_DELIVERY_URL = "https://api.weixin.qq.com/cgi-bin/express/business/delivery/getall";
/**
* 获取所有绑定的物流账号
*/
String ALL_ACCOUNT_URL = "https://api.weixin.qq.com/cgi-bin/express/business/account/getall";
/**
* 绑定解绑物流账号
*/
String BIND_ACCOUNT_URL = "https://api.weixin.qq.com/cgi-bin/express/business/account/bind";
/**
* 获取电子面单余额
*/
String GET_QUOTA_URL = "https://api.weixin.qq.com/cgi-bin/express/business/quota/get";
/**
* 配置面单打印员
*/
String UPDATE_PRINTER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/printer/update";
/**
* 获取打印员
*/
String GET_PRINTER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/printer/getall";
/**
* 生成运单
*/
String ADD_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/add";
/**
* 批量获取运单数据
*/
String BATCH_GET_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/batchget";
/**
* 取消运单
*/
String CANCEL_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/cancel";
/**
* 获取运单数据
*/
String GET_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/get";
/**
* 查询运单轨迹
*/
String GET_PATH_URL = "https://api.weixin.qq.com/cgi-bin/express/business/path/get";
/**
* 模拟快递公司更新订单状态
*/
String TEST_UPDATE_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/test_update_order";
/**
* 获取支持的快递公司列表
* @return 快递公司列表
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getAllDelivery.html">查看文档</a>
*
* @return 快递公司列表
* @throws WxErrorException 获取失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getAllDelivery.html">查看文档</a>
* </pre>
*/
List<WxMaExpressDelivery> getAllDelivery() throws WxErrorException;
/**
* 获取所有绑定的物流账号
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getAllAccount.html">查看文档</a>
*
* @return 物流账号list
* @throws WxErrorException 获取失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getAllAccount.html">查看文档</a>
* </pre>
*/
List<WxMaExpressAccount> getAllAccount() throws WxErrorException;
/**
* 绑定解绑物流账号
*
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.bindAccount.html">查看文档</a>
*
* @param wxMaExpressBindAccountRequest 物流账号对象
* @throws WxErrorException 请求失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.bindAccount.html">查看文档</a>
* </pre>
*/
void bindAccount(WxMaExpressBindAccountRequest wxMaExpressBindAccountRequest) throws WxErrorException;
/**
* 获取电子面单余额仅在使用加盟类快递公司时才可以调用
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getQuota.html">查看文档</a>
*
* @param wxMaExpressBindAccountRequest 物流账号对象
* @return 电子面单余额
* @throws WxErrorException 获取失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getQuota.html">查看文档</a>
* </pre>
*/
Integer getQuota(WxMaExpressBindAccountRequest wxMaExpressBindAccountRequest) throws WxErrorException;
/**
* 配置面单打印员可以设置多个若需要使用微信打单 PC 软件才需要调用
* @param wxMaExpressPrinterUpdateRequest 面单打印员对象
*
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.updatePrinter.html">查看文档</a>
*
* @param wxMaExpressPrinterUpdateRequest 面单打印员对象
* @throws WxErrorException 请求失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.updatePrinter.html">查看文档</a>
* </pre>
*/
void updatePrinter(WxMaExpressPrinterUpdateRequest wxMaExpressPrinterUpdateRequest) throws WxErrorException;
/**
* 获取打印员若需要使用微信打单 PC 软件才需要调用
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getPrinter.html">查看文档</a>
*
* @return 打印员
* @throws WxErrorException 获取失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getPrinter.html">查看文档</a>
* </pre>
*/
WxMaExpressPrinter getPrinter() throws WxErrorException;
/**
* 生成运单
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.addOrder.html">查看文档</a>
*
* @param wxMaExpressAddOrderRequest 生成运单请求对象
* @return 生成运单结果
* @throws WxErrorException 请求失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.addOrder.html">查看文档</a>
* </pre>
*/
WxMaExpressOrderInfoResult addOrder(WxMaExpressAddOrderRequest wxMaExpressAddOrderRequest) throws WxErrorException;
/**
* 批量获取运单数据
*
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.batchGetOrder.html">查看文档</a>
*
* @param requests 获取运单请求对象集合最多不能超过1000个
* @return 运单信息集合
* @throws WxErrorException 获取失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.batchGetOrder.html">查看文档</a>
* </pre>
*/
List<WxMaExpressOrderInfoResult> batchGetOrder(List<WxMaExpressGetOrderRequest> requests) throws WxErrorException;
/**
* 取消运单
*
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.cancelOrder.html">查看文档</a>
*
* @param wxMaExpressGetOrderRequest 运单信息请求对象
* @throws WxErrorException 取消失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.cancelOrder.html">查看文档</a>
* </pre>
*/
void cancelOrder(WxMaExpressGetOrderRequest wxMaExpressGetOrderRequest) throws WxErrorException;
/**
* 获取运单数据
*
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getOrder.html">查看文档</a>
*
* @param wxMaExpressGetOrderRequest 运单信息请求对象
* @return 运单信息
* @throws WxErrorException 获取失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getOrder.html">查看文档</a>
* </pre>
*/
WxMaExpressOrderInfoResult getOrder(WxMaExpressGetOrderRequest wxMaExpressGetOrderRequest) throws WxErrorException;
/**
* 查询运单轨迹
*
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getPath.html">查看文档</a>
*
* @param wxMaExpressGetOrderRequest 运单信息请求对象
* @return 运单轨迹对象
* @throws WxErrorException 查询失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getPath.html">查看文档</a>
* </pre>
*/
WxMaExpressPath getPath(WxMaExpressGetOrderRequest wxMaExpressGetOrderRequest) throws WxErrorException;
/**
* 模拟快递公司更新订单状态, 该接口只能用户测试
* @param wxMaExpressTestUpdateOrderRequest 模拟快递公司更新订单状态请求对象
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.testUpdateOrder.html">查看文档</a>
*
* @param wxMaExpressTestUpdateOrderRequest 模拟快递公司更新订单状态请求对象
* @throws WxErrorException 模拟更新订单状态失败时返回
* <pre>
* <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.testUpdateOrder.html">查看文档</a>
* </pre>
*/
void testUpdateOrder(WxMaExpressTestUpdateOrderRequest wxMaExpressTestUpdateOrderRequest) throws WxErrorException;
}

View File

@ -12,15 +12,12 @@ import me.chanjar.weixin.common.error.WxErrorException;
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxMaJsapiService {
/**
* 获得jsapi_ticket的url
*/
String GET_JSAPI_TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket";
/**
* 获得卡券api_ticket,不强制刷新api_ticket
*
* @see #getJsapiTicket(boolean)
* @return the card api ticket
* @throws WxErrorException the wx error exception
* @see #getJsapiTicket(boolean) #getJsapiTicket(boolean)
*/
String getCardApiTicket() throws WxErrorException;
@ -33,13 +30,17 @@ public interface WxMaJsapiService {
* </pre>
*
* @param forceRefresh 强制刷新
* @return the card api ticket
* @throws WxErrorException the wx error exception
*/
String getCardApiTicket(boolean forceRefresh) throws WxErrorException;
/**
* 获得jsapi_ticket,不强制刷新jsapi_ticket
*
* @see #getJsapiTicket(boolean)
* @return the jsapi ticket
* @throws WxErrorException the wx error exception
* @see #getJsapiTicket(boolean) #getJsapiTicket(boolean)
*/
String getJsapiTicket() throws WxErrorException;
@ -52,6 +53,8 @@ public interface WxMaJsapiService {
* </pre>
*
* @param forceRefresh 强制刷新
* @return the jsapi ticket
* @throws WxErrorException the wx error exception
*/
String getJsapiTicket(boolean forceRefresh) throws WxErrorException;
@ -61,6 +64,10 @@ public interface WxMaJsapiService {
*
* 详情请见http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN
* </pre>
*
* @param url the url
* @return the wx jsapi signature
* @throws WxErrorException the wx error exception
*/
WxJsapiSignature createJsapiSignature(String url) throws WxErrorException;

View File

@ -16,14 +16,6 @@ import java.util.List;
* @author <a href="https://github.com/lipengjun92">lipengjun (939961241@qq.com)</a>
*/
public interface WxMaLiveGoodsService {
String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/add";
String RESET_AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/resetaudit";
String AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/audit";
String DELETE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete";
String UPDATE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/update";
String GET_GOODS_WARE_HOUSE = "https://api.weixin.qq.com/wxa/business/getgoodswarehouse";
String GET_APPROVED_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/getapproved";
/**
* 商品添加并提审
* <pre>

View File

@ -14,17 +14,6 @@ import java.util.List;
* @author <a href="https://github.com/yjwang3300300">yjwang</a>
*/
public interface WxMaLiveService {
String GET_LIVE_INFO = "https://api.weixin.qq.com/wxa/business/getliveinfo";
String CREATE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/create";
String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods";
String DELETE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/deleteroom";
String EDIT_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/editroom";
String GET_PUSH_URL = "https://api.weixin.qq.com/wxaapi/broadcast/room/getpushurl";
String GET_SHARED_CODE = "https://api.weixin.qq.com/wxaapi/broadcast/room/getsharedcode";
String ADD_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/addassistant";
String MODIFY_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/modifyassistant";
String REMOVE_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/removeassistant";
String GET_ASSISTANT_LIST = "https://api.weixin.qq.com/wxaapi/broadcast/room/getassistantlist";
/**
* 创建直播间
@ -95,6 +84,7 @@ public interface WxMaLiveService {
* @throws WxErrorException .
*/
String getSharedCode(Integer roomId, String params) throws WxErrorException;
/**
* 获取直播房间列表.分页
*
@ -153,6 +143,7 @@ public interface WxMaLiveService {
* @throws WxErrorException .
*/
boolean addGoodsToRoom(Integer roomId, List<Integer> goodsIds) throws WxErrorException;
/**
* 添加管理直播间小助手
* <p>
@ -168,6 +159,7 @@ public interface WxMaLiveService {
* @throws WxErrorException .
*/
boolean addAssistant(Integer roomId, List<WxMaLiveAssistantInfo> users) throws WxErrorException;
/**
* 修改直播间小助手昵称
* <p>
@ -183,7 +175,8 @@ public interface WxMaLiveService {
* @return 修改小助手昵称是否成功
* @throws WxErrorException .
*/
boolean modifyAssistant(Integer roomId, String username,String nickname) throws WxErrorException;
boolean modifyAssistant(Integer roomId, String username, String nickname) throws WxErrorException;
/**
* 删除直播间小助手
* <p>
@ -199,6 +192,7 @@ public interface WxMaLiveService {
* @throws WxErrorException .
*/
boolean removeAssistant(Integer roomId, String username) throws WxErrorException;
/**
* 查询直播间小助手
* <p>

View File

@ -15,8 +15,6 @@ import java.io.InputStream;
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxMaMediaService {
String MEDIA_UPLOAD_URL = "https://api.weixin.qq.com/cgi-bin/media/upload?type=%s";
String MEDIA_GET_URL = "https://api.weixin.qq.com/cgi-bin/media/get";
/**
* <pre>

View File

@ -13,12 +13,6 @@ import me.chanjar.weixin.common.error.WxErrorException;
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxMaMsgService {
String KEFU_MESSAGE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/custom/send";
String TEMPLATE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send";
String SUBSCRIBE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send";
String UNIFORM_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send";
String ACTIVITY_ID_CREATE_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/activityid/create";
String UPDATABLE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/updatablemsg/send";
/**
* <pre>

View File

@ -5,7 +5,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
/**
* 小程序插件管理 API
*
* <p>
* 详情请见https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/plugin-management/pluginManager.applyPlugin.html
* 或者https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/Plug-ins_Management.html
*
@ -13,11 +13,6 @@ import me.chanjar.weixin.common.error.WxErrorException;
*/
public interface WxMaPluginService {
/**
* The constant PLUGIN_URL.
*/
String PLUGIN_URL = "https://api.weixin.qq.com/wxa/plugin";
/**
* 向插件开发者发起使用插件的申请
*

View File

@ -17,9 +17,6 @@ import java.io.File;
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxMaQrcodeService {
String CREATE_QRCODE_URL = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode";
String GET_WXACODE_URL = "https://api.weixin.qq.com/wxa/getwxacode";
String GET_WXACODE_UNLIMIT_URL = "https://api.weixin.qq.com/wxa/getwxacodeunlimit";
/**
* 接口C: 获取小程序页面二维码.

View File

@ -1,16 +1,15 @@
package cn.binarywang.wx.miniapp.api;
import java.util.List;
import cn.binarywang.wx.miniapp.bean.WxMaRunStepInfo;
import java.util.List;
/**
* 微信运动相关操作接口.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxMaRunService {
/**
* 解密分享敏感数据.
* 文档地址https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html

View File

@ -14,8 +14,6 @@ import me.chanjar.weixin.common.error.WxErrorException;
* @date : 2021-01-26
*/
public interface WxMaSchemeService {
String GENERATE_SCHEME_URL = "https://api.weixin.qq.com/wxa/generatescheme";
/**
* 获取小程序scheme码
*

View File

@ -1,10 +1,10 @@
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.WxMaMediaAsyncCheckResult;
import java.io.File;
import me.chanjar.weixin.common.error.WxErrorException;
import java.io.File;
/**
* <pre>
* 内容安全相关接口.
@ -14,13 +14,6 @@ import me.chanjar.weixin.common.error.WxErrorException;
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxMaSecCheckService {
String IMG_SEC_CHECK_URL = "https://api.weixin.qq.com/wxa/img_sec_check";
String MSG_SEC_CHECK_URL = "https://api.weixin.qq.com/wxa/msg_sec_check";
String MEDIA_CHECK_ASYNC_URL = "https://api.weixin.qq.com/wxa/media_check_async";
/**
* <pre>
* 校验一张图片是否含有违法违规内容.
@ -29,13 +22,18 @@ public interface WxMaSecCheckService {
* 2敏感人脸识别用户头像媒体类用户文章里的图片检测社交类用户上传的图片检测等频率限制单个 appId 调用上限为 1000 /分钟100,000 /
* 详情请见: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sec-check/imgSecCheck.html
* </pre>
*
* @param file the file
* @return the boolean
* @throws WxErrorException the wx error exception
*/
boolean checkImage(File file) throws WxErrorException;
/**
* 校验一张图片是否含有违法违规内容
*
* @param fileUrl 文件网络地址
* @return 是否违规
* @return 是否违规 boolean
* @throws WxErrorException .
*/
boolean checkImage(String fileUrl) throws WxErrorException;
@ -49,6 +47,10 @@ public interface WxMaSecCheckService {
* 游戏类用户编辑上传的素材(如答题类小游戏用户上传的问题及答案)检测等 频率限制单个 appId 调用上限为 4000 /分钟2,000,000 /*
* 详情请见: https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sec-check/msgSecCheck.html
* </pre>
*
* @param msgString the msg string
* @return the boolean
* @throws WxErrorException the wx error exception
*/
boolean checkMessage(String msgString) throws WxErrorException;
@ -65,10 +67,12 @@ public interface WxMaSecCheckService {
* 详情请见:
* https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html
* </pre>
* @param mediaUrl 要检测的多媒体url
*
* @param mediaUrl 要检测的多媒体url
* @param mediaType 媒体类型,{@link cn.binarywang.wx.miniapp.constant.WxMaConstants.SecCheckMediaType}
* @return
* @return wx ma media async check result
* @throws WxErrorException the wx error exception
*/
WxMaMediaAsyncCheckResult mediaCheckAsync(String mediaUrl,int mediaType) throws WxErrorException;
WxMaMediaAsyncCheckResult mediaCheckAsync(String mediaUrl, int mediaType) throws WxErrorException;
}

View File

@ -2,9 +2,9 @@ package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.service.WxImgProcService;
import me.chanjar.weixin.common.service.WxOcrService;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.service.WxService;
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.RequestExecutor;
@ -13,6 +13,8 @@ import me.chanjar.weixin.common.util.http.RequestHttp;
import java.util.Map;
/**
* The interface Wx ma service.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxMaService extends WxService {
@ -21,6 +23,9 @@ public interface WxMaService extends WxService {
*/
String GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
/**
* The constant JSCODE_TO_SESSION_URL.
*/
String JSCODE_TO_SESSION_URL = "https://api.weixin.qq.com/sns/jscode2session";
/**
* getPaidUnionId
@ -36,6 +41,8 @@ public interface WxMaService extends WxService {
* 获取登录后的session信息.
*
* @param jsCode 登录时获取的 code
* @return the wx ma jscode 2 session result
* @throws WxErrorException the wx error exception
*/
WxMaJscode2SessionResult jsCode2SessionInfo(String jsCode) throws WxErrorException;
@ -47,10 +54,10 @@ public interface WxMaService extends WxService {
* http请求方式POST http(s)://api.weixin.qq.com/wxa/setdynamicdata?access_token=ACCESS_TOKEN
* </pre>
*
* @param data 推送到微信后台的数据列表该数据被微信用于流量分配注意该字段为string类型而不是object
* @param lifespan 数据有效时间秒为单位一般为86400一天一次导入的频率
* @param scene 1代表用于搜索的数据
* @param type 用于标识数据所属的服务类目
* @param scene 1代表用于搜索的数据
* @param data 推送到微信后台的数据列表该数据被微信用于流量分配注意该字段为string类型而不是object
* @throws WxErrorException .
*/
void setDynamicData(int lifespan, String type, int scene, String data) throws WxErrorException;
@ -60,13 +67,20 @@ public interface WxMaService extends WxService {
* 验证消息的确来自微信服务器.
* 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN
* </pre>
*
* @param timestamp the timestamp
* @param nonce the nonce
* @param signature the signature
* @return the boolean
*/
boolean checkSignature(String timestamp, String nonce, String signature);
/**
* 获取access_token, 不强制刷新access_token.
*
* @see #getAccessToken(boolean)
* @return the access token
* @throws WxErrorException the wx error exception
* @see #getAccessToken(boolean) #getAccessToken(boolean)
*/
String getAccessToken() throws WxErrorException;
@ -83,6 +97,8 @@ public interface WxMaService extends WxService {
* </pre>
*
* @param forceRefresh 强制刷新
* @return the access token
* @throws WxErrorException the wx error exception
*/
String getAccessToken(boolean forceRefresh) throws WxErrorException;
@ -99,7 +115,7 @@ public interface WxMaService extends WxService {
* @param transactionId 非必填 微信支付订单号
* @param mchId 非必填 微信支付分配的商户号和商户订单号配合使用
* @param outTradeNo 非必填 微信支付商户订单号和商户号配合使用
* @return UnionId.
* @return UnionId. paid union id
* @throws WxErrorException .
*/
String getPaidUnionId(String openid, String transactionId, String mchId, String outTradeNo) throws WxErrorException;
@ -111,12 +127,13 @@ public interface WxMaService extends WxService {
* 可以参考{@link MediaUploadRequestExecutor}的实现方法
* </pre>
*
* @param <E> .
* @param <T> .
* @param data 参数或请求数据
* @param <E> .
* @param executor 执行器
* @param uri 接口请求地址
* @return .
* @param data 参数或请求数据
* @return . t
* @throws WxErrorException the wx error exception
*/
<T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException;
@ -143,7 +160,7 @@ public interface WxMaService extends WxService {
/**
* 获取WxMaConfig 对象.
*
* @return WxMaConfig
* @return WxMaConfig wx ma config
*/
WxMaConfig getWxMaConfig();
@ -189,7 +206,7 @@ public interface WxMaService extends WxService {
* 进行相应的公众号切换.
*
* @param mpId 公众号标识
* @return 切换是否成功
* @return 切换是否成功 boolean
*/
boolean switchover(String mpId);
@ -197,104 +214,105 @@ public interface WxMaService extends WxService {
* 进行相应的公众号切换.
*
* @param miniappId 小程序标识
* @return 切换成功则返回当前对象方便链式调用否则抛出异常
* @return 切换成功 则返回当前对象方便链式调用否则抛出异常
*/
WxMaService switchoverTo(String miniappId);
/**
* 返回消息客服消息和模版消息发送接口方法实现类以方便调用其各个接口.
*
* @return WxMaMsgService
* @return WxMaMsgService msg service
*/
WxMaMsgService getMsgService();
/**
* 返回素材相关接口方法的实现类对象以方便调用其各个接口.
*
* @return WxMaMediaService
* @return WxMaMediaService media service
*/
WxMaMediaService getMediaService();
/**
* 返回用户相关接口方法的实现类对象以方便调用其各个接口.
*
* @return WxMaUserService
* @return WxMaUserService user service
*/
WxMaUserService getUserService();
/**
* 返回二维码相关接口方法的实现类对象以方便调用其各个接口.
*
* @return WxMaQrcodeService
* @return WxMaQrcodeService qrcode service
*/
WxMaQrcodeService getQrcodeService();
/**
* 返回获取小程序scheme码实现对象以方便调用其各个接口.
* @return WxMaSchemeService
*
* @return WxMaSchemeService wx ma scheme service
*/
WxMaSchemeService getWxMaSchemeService();
/**
* 返回订阅消息配置相关接口方法的实现类对象, 以方便调用其各个接口.
*
* @return WxMaSubscribeService
* @return WxMaSubscribeService subscribe service
*/
WxMaSubscribeService getSubscribeService();
/**
* 数据分析相关查询服务.
*
* @return WxMaAnalysisService
* @return WxMaAnalysisService analysis service
*/
WxMaAnalysisService getAnalysisService();
/**
* 返回代码操作相关的 API.
*
* @return WxMaCodeService
* @return WxMaCodeService code service
*/
WxMaCodeService getCodeService();
/**
* 返回jsapi操作相关的 API服务类对象.
*
* @return WxMaJsapiService
* @return WxMaJsapiService jsapi service
*/
WxMaJsapiService getJsapiService();
/**
* 小程序修改服务器地址成员管理 API.
*
* @return WxMaSettingService
* @return WxMaSettingService setting service
*/
WxMaSettingService getSettingService();
/**
* 返回分享相关查询服务.
*
* @return WxMaShareService
* @return WxMaShareService share service
*/
WxMaShareService getShareService();
/**
* 返回微信运动相关接口服务对象.
*
* @return WxMaShareService
* @return WxMaShareService run service
*/
WxMaRunService getRunService();
/**
* 返回内容安全相关接口服务对象.
*
* @return WxMaShareService
* @return WxMaShareService sec check service
*/
WxMaSecCheckService getSecCheckService();
/**
* 返回插件相关接口服务对象.
*
* @return WxMaPluginService
* @return WxMaPluginService plugin service
*/
WxMaPluginService getPluginService();
@ -306,35 +324,35 @@ public interface WxMaService extends WxService {
/**
* 请求http请求相关信息.
*
* @return .
* @return . request http
*/
RequestHttp getRequestHttp();
/**
* 获取物流助手接口服务对象
*
* @return .
* @return . express service
*/
WxMaExpressService getExpressService();
/**
* 获取云开发接口服务对象
*
* @return .
* @return . cloud service
*/
WxMaCloudService getCloudService();
/**
* 获取直播接口服务对象
*
* @return .
* @return . live service
*/
WxMaLiveService getLiveService();
/**
* 获取直播间商品服务对象
*
* @return .
* @return . live goods service
*/
WxMaLiveGoodsService getLiveGoodsService();
@ -348,7 +366,7 @@ public interface WxMaService extends WxService {
/**
* 返回图像处理接口的实现类对象以方便调用其各个接口.
*
* @return WxImgProcService
* @return WxImgProcService img proc service
*/
WxImgProcService getImgProcService();

View File

@ -10,18 +10,6 @@ import me.chanjar.weixin.common.error.WxErrorException;
* @since 2018-04-27 15:46
*/
public interface WxMaSettingService {
/**
* 修改服务器地址https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489138143_WPbOO&token=&lang=zh_CN
* access_token authorizer_access_token
*/
String MODIFY_DOMAIN_URL = "https://api.weixin.qq.com/wxa/modify_domain";
String SET_WEB_VIEW_DOMAIN_URL = "https://api.weixin.qq.com/wxa/setwebviewdomain";
/**
* 小程序成员管理https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489140588_nVUgx&token=&lang=zh_CN
* access_token authorizer_access_token
*/
String BIND_TESTER_URL = "https://api.weixin.qq.com/wxa/bind_tester";
String UNBIND_TESTER_URL = "https://api.weixin.qq.com/wxa/unbind_tester";
/**
* 操作服务器域名

View File

@ -16,40 +16,6 @@ import java.util.List;
* @date 2019-12-15
*/
public interface WxMaSubscribeService {
/**
* 获取模板标题下的关键词列表.
*/
String GET_PUB_TEMPLATE_TITLE_LIST_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles";
/**
* 获取模板标题下的关键词列表.
*/
String GET_PUB_TEMPLATE_KEY_WORDS_BY_ID_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords";
/**
* 组合模板并添加至帐号下的个人模板库.
*/
String TEMPLATE_ADD_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate";
/**
* 获取当前帐号下的个人模板列表.
*/
String TEMPLATE_LIST_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate";
/**
* 删除帐号下的某个模板.
*/
String TEMPLATE_DEL_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate";
/**
* 获取小程序账号的类目
*/
String GET_CATEGORY_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getcategory";
/**
* 发送订阅消息
*/
String SUBSCRIBE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send";
/**
* <pre>

View File

@ -13,7 +13,6 @@ import java.util.Map;
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxMaUserService {
String SET_USER_STORAGE = "https://api.weixin.qq.com/wxa/set_user_storage?appid=%s&signature=%s&openid=%s&sig_method=%s";
/**
* 获取登录后的session信息.

View File

@ -11,14 +11,14 @@ import com.google.gson.Gson;
import com.google.gson.JsonObject;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.service.WxImgProcService;
import me.chanjar.weixin.common.service.WxOcrService;
import me.chanjar.weixin.common.bean.ToJson;
import me.chanjar.weixin.common.bean.WxAccessToken;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.error.WxRuntimeException;
import me.chanjar.weixin.common.service.WxImgProcService;
import me.chanjar.weixin.common.service.WxOcrService;
import me.chanjar.weixin.common.util.DataUtils;
import me.chanjar.weixin.common.util.crypto.SHA1;
import me.chanjar.weixin.common.util.http.RequestExecutor;
@ -41,8 +41,7 @@ import java.util.concurrent.locks.Lock;
*/
@Slf4j
public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestHttp<H, P> {
private Map<String, WxMaConfig> configMap;
protected static final Gson GSON = new Gson();
private final WxMaMsgService kefuService = new WxMaMsgServiceImpl(this);
private final WxMaMediaService materialService = new WxMaMediaServiceImpl(this);
private final WxMaUserService userService = new WxMaUserServiceImpl(this);
@ -63,12 +62,10 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
private final WxMaLiveGoodsService liveGoodsService = new WxMaLiveGoodsServiceImpl(this);
private final WxOcrService ocrService = new WxMaOcrServiceImpl(this);
private final WxImgProcService imgProcService = new WxMaImgProcServiceImpl(this);
private Map<String, WxMaConfig> configMap;
private int retrySleepMillis = 1000;
private int maxRetryTimes = 5;
protected static final Gson GSON = new Gson();
@Override
public RequestHttp getRequestHttp() {
return this;
@ -188,6 +185,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
public String post(String url, Object obj) throws WxErrorException {
return this.execute(SimplePostRequestExecutor.create(this), url, WxGsonBuilder.create().toJson(obj));
}
@Override
public String post(String url, ToJson obj) throws WxErrorException {
return this.post(url, obj.toJson());
@ -197,6 +195,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
public String post(String url, JsonObject jsonObject) throws WxErrorException {
return this.post(url, jsonObject.toString());
}
/**
* 向微信端发送请求在这里执行的策略是当发生access_token过期时才去刷新然后重新执行请求而不是全局定时请求
*/
@ -244,8 +243,8 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
}
String accessToken = getAccessToken(false);
if(StringUtils.isNotEmpty(this.getWxMaConfig().getApiHostUrl())){
uri = uri.replace("https://api.weixin.qq.com",this.getWxMaConfig().getApiHostUrl() );
if (StringUtils.isNotEmpty(this.getWxMaConfig().getApiHostUrl())) {
uri = uri.replace("https://api.weixin.qq.com", this.getWxMaConfig().getApiHostUrl());
}
String uriWithAccessToken = uri + (uri.contains("?") ? "&" : "?") + "access_token=" + accessToken;

View File

@ -15,6 +15,8 @@ import java.lang.reflect.Type;
import java.util.Date;
import java.util.List;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Analysis.*;
/**
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-28
@ -23,6 +25,13 @@ import java.util.List;
public class WxMaAnalysisServiceImpl implements WxMaAnalysisService {
private final WxMaService service;
private static String toJson(Date beginDate, Date endDate) {
JsonObject param = new JsonObject();
param.addProperty("begin_date", DateFormatUtils.format(beginDate, "yyyyMMdd"));
param.addProperty("end_date", DateFormatUtils.format(endDate, "yyyyMMdd"));
return param.toString();
}
@Override
public List<WxMaSummaryTrend> getDailySummaryTrend(Date beginDate, Date endDate) throws WxErrorException {
return getAnalysisResultAsList(GET_DAILY_SUMMARY_TREND_URL, beginDate, endDate,
@ -108,11 +117,4 @@ public class WxMaAnalysisServiceImpl implements WxMaAnalysisService {
return null;
}
}
private static String toJson(Date beginDate, Date endDate) {
JsonObject param = new JsonObject();
param.addProperty("begin_date", DateFormatUtils.format(beginDate, "yyyyMMdd"));
param.addProperty("end_date", DateFormatUtils.format(endDate, "yyyyMMdd"));
return param.toString();
}
}

View File

@ -4,8 +4,8 @@ import cn.binarywang.wx.miniapp.api.WxMaCloudService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.cloud.*;
import cn.binarywang.wx.miniapp.constant.WxMaConstants;
import cn.binarywang.wx.miniapp.util.JoinerUtils;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import cn.binarywang.wx.miniapp.util.JoinerUtils;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
@ -20,7 +20,12 @@ import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Cloud.*;
/**
* 云开发相关接口实现类.

View File

@ -1,5 +1,20 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaCodeService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.code.*;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.BaseMediaDownloadRequestExecutor;
import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.common.util.json.GsonParser;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
@ -8,26 +23,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.util.json.GsonParser;
import org.apache.commons.lang3.StringUtils;
import cn.binarywang.wx.miniapp.api.WxMaCodeService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.code.WxMaCategory;
import cn.binarywang.wx.miniapp.bean.code.WxMaCodeAuditStatus;
import cn.binarywang.wx.miniapp.bean.code.WxMaCodeCommitRequest;
import cn.binarywang.wx.miniapp.bean.code.WxMaCodeSubmitAuditRequest;
import cn.binarywang.wx.miniapp.bean.code.WxMaCodeVersionDistribution;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.BaseMediaDownloadRequestExecutor;
import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.common.util.json.GsonHelper;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Code.*;
/**
* @author <a href="https://github.com/charmingoh">Charming</a>

View File

@ -16,6 +16,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Express.*;
/**
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
* @since 2019-11-26

View File

@ -2,12 +2,12 @@ package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.service.WxImgProcService;
import me.chanjar.weixin.common.bean.imgproc.WxImgProcAiCropResult;
import me.chanjar.weixin.common.bean.imgproc.WxImgProcQrCodeResult;
import me.chanjar.weixin.common.bean.imgproc.WxImgProcSuperResolutionResult;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.requestexecuter.ocr.OcrDiscernRequestExecutor;
import me.chanjar.weixin.common.service.WxImgProcService;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
@ -15,6 +15,8 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.ImgProc.*;
/**
* 图像处理接口实现.
@ -23,35 +25,6 @@ import java.nio.charset.StandardCharsets;
*/
@RequiredArgsConstructor
public class WxMaImgProcServiceImpl implements WxImgProcService {
/**
* 二维码/条码识别
*/
private static final String QRCODE = "/cv/img/qrcode?img_url=%s";
/**
* 二维码/条码识别(文件)
*/
private static final String FILE_QRCODE = "/cv/img/qrcode";
/**
* 图片高清化
*/
private static final String SUPER_RESOLUTION = "/cv/img/superresolution?img_url=%s";
/**
* 图片高清化(文件)
*/
private static final String FILE_SUPER_RESOLUTION = "/cv/img/superresolution";
/**
* 图片智能裁剪
*/
private static final String AI_CROP = "/cv/img/aicrop?img_url=%s&ratios=%s";
/**
* 图片智能裁剪(文件)
*/
private static final String FILE_AI_CROP = "/cv/img/aicrop?ratios=%s";
private final WxMaService service;
@Override

View File

@ -12,6 +12,8 @@ import me.chanjar.weixin.common.util.json.GsonParser;
import java.util.concurrent.locks.Lock;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Jsapi.GET_JSAPI_TICKET_URL;
/**
* <pre>
* Created by BinaryWang on 2018/8/5.
@ -30,7 +32,6 @@ public class WxMaJsapiServiceImpl implements WxMaJsapiService {
@Override
public String getCardApiTicket(boolean forceRefresh) throws WxErrorException {
if (forceRefresh) {
this.service.getWxMaConfig().expireCardApiTicket();
}

View File

@ -9,7 +9,6 @@ import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.GsonParser;
@ -19,6 +18,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.LiveGoods.*;
/**
* <pre>
* Created by lipengjun on 2020/6/29.

View File

@ -6,7 +6,6 @@ import cn.binarywang.wx.miniapp.bean.live.*;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.common.base.Joiner;
import com.google.gson.JsonObject;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.enums.WxType;
@ -19,6 +18,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Live.*;
/**
* <pre>
* Created by yjwang on 2020/4/5.

View File

@ -2,7 +2,6 @@ package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaMediaService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.error.WxError;
@ -18,6 +17,9 @@ import java.io.InputStream;
import java.nio.file.Files;
import java.util.UUID;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Media.MEDIA_GET_URL;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Media.MEDIA_UPLOAD_URL;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/

View File

@ -2,17 +2,21 @@ package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaMsgService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.*;
import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage;
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import cn.binarywang.wx.miniapp.bean.WxMaUniformMessage;
import cn.binarywang.wx.miniapp.bean.WxMaUpdatableMsg;
import cn.binarywang.wx.miniapp.constant.WxMaConstants;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.JsonObject;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.enums.WxType;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.GsonParser;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Msg.*;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/

View File

@ -2,16 +2,18 @@ package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.service.WxOcrService;
import me.chanjar.weixin.common.bean.ocr.*;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.requestexecuter.ocr.OcrDiscernRequestExecutor;
import me.chanjar.weixin.common.service.WxOcrService;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Ocr.*;
/**
* ocr 接口实现.
*
@ -20,18 +22,6 @@ import java.nio.charset.StandardCharsets;
*/
@RequiredArgsConstructor
public class WxMaOcrServiceImpl implements WxOcrService {
private static final String IDCARD = "https://api.weixin.qq.com/cv/ocr/idcard?img_url=%s";
private static final String FILEIDCARD = "https://api.weixin.qq.com/cv/ocr/idcard";
private static final String BANK_CARD = "https://api.weixin.qq.com/cv/ocr/bankcard?img_url=%s";
private static final String FILE_BANK_CARD = "https://api.weixin.qq.com/cv/ocr/bankcard";
private static final String DRIVING = "https://api.weixin.qq.com/cv/ocr/driving?img_url=%s";
private static final String FILE_DRIVING = "https://api.weixin.qq.com/cv/ocr/driving";
private static final String DRIVING_LICENSE = "https://api.weixin.qq.com/cv/ocr/drivinglicense?img_url=%s";
private static final String FILE_DRIVING_LICENSE = "https://api.weixin.qq.com/cv/ocr/drivinglicense";
private static final String BIZ_LICENSE = "https://api.weixin.qq.com/cv/ocr/bizlicense?img_url=%s";
private static final String FILE_BIZ_LICENSE = "https://api.weixin.qq.com/cv/ocr/bizlicense";
private static final String COMM = "https://api.weixin.qq.com/cv/ocr/comm?img_url=%s";
private static final String FILE_COMM = "https://api.weixin.qq.com/cv/ocr/comm";
private final WxMaService service;

View File

@ -10,6 +10,8 @@ import me.chanjar.weixin.common.error.WxErrorException;
import java.util.Map;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Plugin.PLUGIN_URL;
@AllArgsConstructor
public class WxMaPluginServiceImpl implements WxMaPluginService {
private final WxMaService service;

View File

@ -8,12 +8,13 @@ import cn.binarywang.wx.miniapp.bean.WxaCode;
import cn.binarywang.wx.miniapp.bean.WxaCodeUnlimit;
import cn.binarywang.wx.miniapp.executor.QrcodeBytesRequestExecutor;
import cn.binarywang.wx.miniapp.executor.QrcodeRequestExecutor;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;
import java.io.File;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Qrcode.*;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
@ -23,12 +24,14 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
@Override
public byte[] createQrcodeBytes(String path, int width) throws WxErrorException {
return this.service.execute(QrcodeBytesRequestExecutor.create(this.service.getRequestHttp()), CREATE_QRCODE_URL, new WxMaQrcode(path, width));
return this.service.execute(QrcodeBytesRequestExecutor.create(this.service.getRequestHttp()), CREATE_QRCODE_URL,
new WxMaQrcode(path, width));
}
@Override
public File createQrcode(String path, int width) throws WxErrorException {
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp()), CREATE_QRCODE_URL, new WxMaQrcode(path, width));
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp()), CREATE_QRCODE_URL,
new WxMaQrcode(path, width));
}
@Override
@ -39,25 +42,27 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
@Override
public byte[] createWxaCodeBytes(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline)
throws WxErrorException {
return this.service.execute(QrcodeBytesRequestExecutor.create(this.service.getRequestHttp()), GET_WXACODE_URL, WxaCode.builder()
.path(path)
.width(width)
.autoColor(autoColor)
.lineColor(lineColor)
.isHyaline(isHyaline)
.build());
return this.service.execute(QrcodeBytesRequestExecutor.create(this.service.getRequestHttp()), GET_WXACODE_URL,
WxaCode.builder()
.path(path)
.width(width)
.autoColor(autoColor)
.lineColor(lineColor)
.isHyaline(isHyaline)
.build());
}
@Override
public File createWxaCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline)
throws WxErrorException {
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp()), GET_WXACODE_URL, WxaCode.builder()
.path(path)
.width(width)
.autoColor(autoColor)
.lineColor(lineColor)
.isHyaline(isHyaline)
.build());
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp()), GET_WXACODE_URL,
WxaCode.builder()
.path(path)
.width(width)
.autoColor(autoColor)
.lineColor(lineColor)
.isHyaline(isHyaline)
.build());
}
@Override
@ -74,16 +79,14 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
public byte[] createWxaCodeUnlimitBytes(String scene, String page, int width, boolean autoColor,
WxMaCodeLineColor lineColor, boolean isHyaline) throws WxErrorException {
return this.service.execute(QrcodeBytesRequestExecutor.create(this.service.getRequestHttp()),
GET_WXACODE_UNLIMIT_URL,
this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
GET_WXACODE_UNLIMIT_URL, this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
}
@Override
public File createWxaCodeUnlimit(String scene, String page, int width, boolean autoColor,
WxMaCodeLineColor lineColor, boolean isHyaline) throws WxErrorException {
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp()),
GET_WXACODE_UNLIMIT_URL,
this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
GET_WXACODE_UNLIMIT_URL, this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
}
private WxaCodeUnlimit buildWxaCodeUnlimit(String scene, String page, int width, boolean autoColor,
@ -106,7 +109,8 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
@Override
public File createQrcode(String path, int width, String filePath) throws WxErrorException {
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp(), filePath), CREATE_QRCODE_URL, new WxMaQrcode(path, width));
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp(), filePath),
CREATE_QRCODE_URL, new WxMaQrcode(path, width));
}
@Override
@ -115,15 +119,17 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
}
@Override
public File createWxaCode(String path, int width, String filePath, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline)
public File createWxaCode(String path, int width, String filePath, boolean autoColor, WxMaCodeLineColor lineColor,
boolean isHyaline)
throws WxErrorException {
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp(), filePath), GET_WXACODE_URL, WxaCode.builder()
.path(path)
.width(width)
.autoColor(autoColor)
.lineColor(lineColor)
.isHyaline(isHyaline)
.build());
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp(), filePath), GET_WXACODE_URL,
WxaCode.builder()
.path(path)
.width(width)
.autoColor(autoColor)
.lineColor(lineColor)
.isHyaline(isHyaline)
.build());
}
@Override
@ -140,8 +146,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
public File createWxaCodeUnlimit(String scene, String page, String filePath, int width, boolean autoColor,
WxMaCodeLineColor lineColor, boolean isHyaline) throws WxErrorException {
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp(), filePath),
GET_WXACODE_UNLIMIT_URL,
this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
GET_WXACODE_UNLIMIT_URL, this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
}
@Override

View File

@ -1,14 +1,13 @@
package cn.binarywang.wx.miniapp.api.impl;
import java.util.List;
import cn.binarywang.wx.miniapp.api.WxMaRunService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaRunStepInfo;
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import java.util.List;
/**
* <pre>
* Created by Binary Wang on 2018/11/4.

View File

@ -10,6 +10,8 @@ import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.GsonParser;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Scheme.GENERATE_SCHEME_URL;
/**
* @author : cofedream
* @date : 2021-01-28

View File

@ -15,6 +15,8 @@ import java.io.File;
import java.io.IOException;
import java.net.URL;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.SecCheck.*;
/**
* <pre>
*

View File

@ -10,6 +10,8 @@ import me.chanjar.weixin.common.error.WxErrorException;
import java.util.HashMap;
import java.util.Map;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Setting.*;
/**
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-27 15:46

View File

@ -23,6 +23,8 @@ import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.List;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Subscribe.*;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2019-12-15

View File

@ -16,6 +16,8 @@ import org.apache.commons.codec.digest.DigestUtils;
import java.util.Map;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.User.SET_USER_STORAGE;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/

View File

@ -0,0 +1,281 @@
package cn.binarywang.wx.miniapp.constant;
import lombok.experimental.UtilityClass;
/**
* 小程序接口地址常量.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* @date 2021-01-28
*/
@UtilityClass
public class WxMaApiUrlConstants {
public interface Analysis {
String GET_DAILY_SUMMARY_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiddailysummarytrend";
String GET_DAILY_VISIT_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend";
String GET_WEEKLY_VISIT_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidweeklyvisittrend";
String GET_MONTHLY_VISIT_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyvisittrend";
String GET_VISIT_DISTRIBUTION_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidvisitdistribution";
String GET_DAILY_RETAIN_INFO_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyretaininfo";
String GET_WEEKLY_RETAIN_INFO_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidweeklyretaininfo";
String GET_MONTHLY_RETAIN_INFO_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyretaininfo";
String GET_VISIT_PAGE_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidvisitpage";
String GET_USER_PORTRAIT_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiduserportrait";
}
public interface Cloud {
String INVOKE_CLOUD_FUNCTION_URL = "https://api.weixin.qq.com/tcb/invokecloudfunction?env=%s&name=%s";
String DATABASE_COLLECTION_GET_URL = "https://api.weixin.qq.com/tcb/databasecollectionget";
String DATABASE_COLLECTION_DELETE_URL = "https://api.weixin.qq.com/tcb/databasecollectiondelete";
String DATABASE_COLLECTION_ADD_URL = "https://api.weixin.qq.com/tcb/databasecollectionadd";
String GET_QCLOUD_TOKEN_URL = "https://api.weixin.qq.com/tcb/getqcloudtoken";
String BATCH_DELETE_FILE_URL = "https://api.weixin.qq.com/tcb/batchdeletefile";
String BATCH_DOWNLOAD_FILE_URL = "https://api.weixin.qq.com/tcb/batchdownloadfile";
String UPLOAD_FILE_URL = "https://api.weixin.qq.com/tcb/uploadfile";
String DATABASE_MIGRATE_QUERY_INFO_URL = "https://api.weixin.qq.com/tcb/databasemigratequeryinfo";
String DATABASE_MIGRATE_EXPORT_URL = "https://api.weixin.qq.com/tcb/databasemigrateexport";
String DATABASE_MIGRATE_IMPORT_URL = "https://api.weixin.qq.com/tcb/databasemigrateimport";
String UPDATE_INDEX_URL = "https://api.weixin.qq.com/tcb/updateindex";
String DATABASE_COUNT_URL = "https://api.weixin.qq.com/tcb/databasecount";
String DATABASE_AGGREGATE_URL = "https://api.weixin.qq.com/tcb/databaseaggregate";
String DATABASE_QUERY_URL = "https://api.weixin.qq.com/tcb/databasequery";
String DATABASE_UPDATE_URL = "https://api.weixin.qq.com/tcb/databaseupdate";
String DATABASE_DELETE_URL = "https://api.weixin.qq.com/tcb/databasedelete";
String DATABASE_ADD_URL = "https://api.weixin.qq.com/tcb/databaseadd";
}
public interface Msg {
String KEFU_MESSAGE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/custom/send";
String TEMPLATE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send";
String SUBSCRIBE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send";
String UNIFORM_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send";
String ACTIVITY_ID_CREATE_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/activityid/create";
String UPDATABLE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/updatablemsg/send";
}
public interface Code {
/**
* 为授权的小程序帐号上传小程序代码.
*/
String COMMIT_URL = "https://api.weixin.qq.com/wxa/commit";
String GET_QRCODE_URL = "https://api.weixin.qq.com/wxa/get_qrcode";
String GET_CATEGORY_URL = "https://api.weixin.qq.com/wxa/get_category";
String GET_PAGE_URL = "https://api.weixin.qq.com/wxa/get_page";
String SUBMIT_AUDIT_URL = "https://api.weixin.qq.com/wxa/submit_audit";
String GET_AUDIT_STATUS_URL = "https://api.weixin.qq.com/wxa/get_auditstatus";
String GET_LATEST_AUDIT_STATUS_URL = "https://api.weixin.qq.com/wxa/get_latest_auditstatus";
String RELEASE_URL = "https://api.weixin.qq.com/wxa/release";
String CHANGE_VISIT_STATUS_URL = "https://api.weixin.qq.com/wxa/change_visitstatus";
String REVERT_CODE_RELEASE_URL = "https://api.weixin.qq.com/wxa/revertcoderelease";
String GET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/getweappsupportversion";
String SET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/setweappsupportversion";
String UNDO_CODE_AUDIT_URL = "https://api.weixin.qq.com/wxa/undocodeaudit";
}
public interface Express {
/**
* 获取支持的快递公司列表
*/
String ALL_DELIVERY_URL = "https://api.weixin.qq.com/cgi-bin/express/business/delivery/getall";
/**
* 获取所有绑定的物流账号
*/
String ALL_ACCOUNT_URL = "https://api.weixin.qq.com/cgi-bin/express/business/account/getall";
/**
* 绑定解绑物流账号
*/
String BIND_ACCOUNT_URL = "https://api.weixin.qq.com/cgi-bin/express/business/account/bind";
/**
* 获取电子面单余额
*/
String GET_QUOTA_URL = "https://api.weixin.qq.com/cgi-bin/express/business/quota/get";
/**
* 配置面单打印员
*/
String UPDATE_PRINTER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/printer/update";
/**
* 获取打印员
*/
String GET_PRINTER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/printer/getall";
/**
* 生成运单
*/
String ADD_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/add";
/**
* 批量获取运单数据
*/
String BATCH_GET_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/batchget";
/**
* 取消运单
*/
String CANCEL_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/cancel";
/**
* 获取运单数据
*/
String GET_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/get";
/**
* 查询运单轨迹
*/
String GET_PATH_URL = "https://api.weixin.qq.com/cgi-bin/express/business/path/get";
/**
* 模拟快递公司更新订单状态
*/
String TEST_UPDATE_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/test_update_order";
}
public interface ImgProc {
/**
* 二维码/条码识别
*/
String QRCODE = "https://api.weixin.qq.com/cv/img/qrcode?img_url=%s";
/**
* 二维码/条码识别(文件)
*/
String FILE_QRCODE = "https://api.weixin.qq.com/cv/img/qrcode";
/**
* 图片高清化
*/
String SUPER_RESOLUTION = "https://api.weixin.qq.com/cv/img/superresolution?img_url=%s";
/**
* 图片高清化(文件)
*/
String FILE_SUPER_RESOLUTION = "https://api.weixin.qq.com/cv/img/superresolution";
/**
* 图片智能裁剪
*/
String AI_CROP = "https://api.weixin.qq.com/cv/img/aicrop?img_url=%s&ratios=%s";
/**
* 图片智能裁剪(文件)
*/
String FILE_AI_CROP = "https://api.weixin.qq.com/cv/img/aicrop?ratios=%s";
}
public interface Jsapi {
/**
* 获得jsapi_ticket的url
*/
String GET_JSAPI_TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket";
}
public interface LiveGoods {
String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/add";
String RESET_AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/resetaudit";
String AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/audit";
String DELETE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete";
String UPDATE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/update";
String GET_GOODS_WARE_HOUSE = "https://api.weixin.qq.com/wxa/business/getgoodswarehouse";
String GET_APPROVED_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/getapproved";
}
public interface Live {
String GET_LIVE_INFO = "https://api.weixin.qq.com/wxa/business/getliveinfo";
String CREATE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/create";
String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods";
String DELETE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/deleteroom";
String EDIT_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/editroom";
String GET_PUSH_URL = "https://api.weixin.qq.com/wxaapi/broadcast/room/getpushurl";
String GET_SHARED_CODE = "https://api.weixin.qq.com/wxaapi/broadcast/room/getsharedcode";
String ADD_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/addassistant";
String MODIFY_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/modifyassistant";
String REMOVE_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/removeassistant";
String GET_ASSISTANT_LIST = "https://api.weixin.qq.com/wxaapi/broadcast/room/getassistantlist";
}
public interface Media {
String MEDIA_UPLOAD_URL = "https://api.weixin.qq.com/cgi-bin/media/upload?type=%s";
String MEDIA_GET_URL = "https://api.weixin.qq.com/cgi-bin/media/get";
}
public interface Plugin {
String PLUGIN_URL = "https://api.weixin.qq.com/wxa/plugin";
}
public interface Qrcode {
String CREATE_QRCODE_URL = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode";
String GET_WXACODE_URL = "https://api.weixin.qq.com/wxa/getwxacode";
String GET_WXACODE_UNLIMIT_URL = "https://api.weixin.qq.com/wxa/getwxacodeunlimit";
}
public interface Run {
}
public interface Scheme {
String GENERATE_SCHEME_URL = "https://api.weixin.qq.com/wxa/generatescheme";
}
public interface SecCheck {
String IMG_SEC_CHECK_URL = "https://api.weixin.qq.com/wxa/img_sec_check";
String MSG_SEC_CHECK_URL = "https://api.weixin.qq.com/wxa/msg_sec_check";
String MEDIA_CHECK_ASYNC_URL = "https://api.weixin.qq.com/wxa/media_check_async";
}
public interface Setting {
/**
* 修改服务器地址https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489138143_WPbOO&token=&lang=zh_CN
* access_token authorizer_access_token
*/
String MODIFY_DOMAIN_URL = "https://api.weixin.qq.com/wxa/modify_domain";
String SET_WEB_VIEW_DOMAIN_URL = "https://api.weixin.qq.com/wxa/setwebviewdomain";
/**
* 小程序成员管理https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489140588_nVUgx&token=&lang=zh_CN
* access_token authorizer_access_token
*/
String BIND_TESTER_URL = "https://api.weixin.qq.com/wxa/bind_tester";
String UNBIND_TESTER_URL = "https://api.weixin.qq.com/wxa/unbind_tester";
}
public interface Share {
}
public interface Subscribe {
/**
* 获取模板标题下的关键词列表.
*/
String GET_PUB_TEMPLATE_TITLE_LIST_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles";
/**
* 获取模板标题下的关键词列表.
*/
String GET_PUB_TEMPLATE_KEY_WORDS_BY_ID_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords";
/**
* 组合模板并添加至帐号下的个人模板库.
*/
String TEMPLATE_ADD_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate";
/**
* 获取当前帐号下的个人模板列表.
*/
String TEMPLATE_LIST_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate";
/**
* 删除帐号下的某个模板.
*/
String TEMPLATE_DEL_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate";
/**
* 获取小程序账号的类目
*/
String GET_CATEGORY_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getcategory";
/**
* 发送订阅消息
*/
String SUBSCRIBE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send";
}
public interface User {
String SET_USER_STORAGE = "https://api.weixin.qq.com/wxa/set_user_storage?appid=%s&signature=%s&openid=%s&sig_method=%s";
}
public interface Ocr {
String IDCARD = "https://api.weixin.qq.com/cv/ocr/idcard?img_url=%s";
String FILEIDCARD = "https://api.weixin.qq.com/cv/ocr/idcard";
String BANK_CARD = "https://api.weixin.qq.com/cv/ocr/bankcard?img_url=%s";
String FILE_BANK_CARD = "https://api.weixin.qq.com/cv/ocr/bankcard";
String DRIVING = "https://api.weixin.qq.com/cv/ocr/driving?img_url=%s";
String FILE_DRIVING = "https://api.weixin.qq.com/cv/ocr/driving";
String DRIVING_LICENSE = "https://api.weixin.qq.com/cv/ocr/drivinglicense?img_url=%s";
String FILE_DRIVING_LICENSE = "https://api.weixin.qq.com/cv/ocr/drivinglicense";
String BIZ_LICENSE = "https://api.weixin.qq.com/cv/ocr/bizlicense?img_url=%s";
String FILE_BIZ_LICENSE = "https://api.weixin.qq.com/cv/ocr/bizlicense";
String COMM = "https://api.weixin.qq.com/cv/ocr/comm?img_url=%s";
String FILE_COMM = "https://api.weixin.qq.com/cv/ocr/comm";
}
}