mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-06-28 13:16:19 +08:00
🎨 优化部分代码
This commit is contained in:
parent
c4a87961af
commit
6811bffa18
@ -14,6 +14,11 @@ import com.thoughtworks.xstream.security.WildcardTypePermission;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
* The type X stream initializer.
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
public class XStreamInitializer {
|
||||
private static final XppDriver XPP_DRIVER = new XppDriver() {
|
||||
@Override
|
||||
@ -45,6 +50,11 @@ public class XStreamInitializer {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets instance.
|
||||
*
|
||||
* @return the instance
|
||||
*/
|
||||
public static XStream getInstance() {
|
||||
XStream xstream = new XStream(new PureJavaReflectionProvider(), XPP_DRIVER) {
|
||||
// only register the converters we need; other converters generate a private access warning in the console on Java9+...
|
||||
|
@ -5,12 +5,17 @@ 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
|
||||
*
|
||||
* @author ArBing
|
||||
*/
|
||||
public interface WxMaPluginService {
|
||||
|
||||
/**
|
||||
* The constant PLUGIN_URL.
|
||||
*/
|
||||
String PLUGIN_URL = "https://api.weixin.qq.com/wxa/plugin";
|
||||
|
||||
/**
|
||||
@ -25,8 +30,8 @@ public interface WxMaPluginService {
|
||||
/**
|
||||
* 查询已添加的插件
|
||||
*
|
||||
* @return
|
||||
* @throws WxErrorException
|
||||
* @return plugin list
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxMaPluginListResult getPluginList() throws WxErrorException;
|
||||
|
||||
@ -34,7 +39,7 @@ public interface WxMaPluginService {
|
||||
* 删除已添加的插件
|
||||
*
|
||||
* @param pluginAppId 插件 appId
|
||||
* @throws WxErrorException
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
void unbindPlugin(String pluginAppId) throws WxErrorException;
|
||||
|
||||
@ -43,7 +48,7 @@ public interface WxMaPluginService {
|
||||
*
|
||||
* @param pluginAppId 插件 appid
|
||||
* @param userVersion 升级至版本号,要求此插件版本支持快速更新
|
||||
* @throws WxErrorException
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
void updatePlugin(String pluginAppId, String userVersion) throws WxErrorException;
|
||||
|
||||
|
@ -18,6 +18,7 @@ public interface WxMaRunService {
|
||||
* @param sessionKey 会话密钥
|
||||
* @param encryptedData 消息密文
|
||||
* @param ivStr 加密算法的初始向量
|
||||
* @return the run step info
|
||||
*/
|
||||
List<WxMaRunStepInfo> getRunStepInfo(String sessionKey, String encryptedData, String ivStr);
|
||||
|
||||
|
@ -2,16 +2,11 @@ package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaAnalysisService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
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 cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
@ -24,10 +19,9 @@ import java.util.List;
|
||||
* @author <a href="https://github.com/charmingoh">Charming</a>
|
||||
* @since 2018-04-28
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaAnalysisServiceImpl implements WxMaAnalysisService {
|
||||
|
||||
private WxMaService wxMaService;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public List<WxMaSummaryTrend> getDailySummaryTrend(Date beginDate, Date endDate) throws WxErrorException {
|
||||
@ -59,7 +53,7 @@ public class WxMaAnalysisServiceImpl implements WxMaAnalysisService {
|
||||
|
||||
@Override
|
||||
public WxMaVisitDistribution getVisitDistribution(Date beginDate, Date endDate) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_VISIT_DISTRIBUTION_URL, toJson(beginDate, endDate));
|
||||
String responseContent = this.service.post(GET_VISIT_DISTRIBUTION_URL, toJson(beginDate, endDate));
|
||||
return WxMaVisitDistribution.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@ -87,12 +81,12 @@ public class WxMaAnalysisServiceImpl implements WxMaAnalysisService {
|
||||
|
||||
@Override
|
||||
public WxMaUserPortrait getUserPortrait(Date beginDate, Date endDate) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_USER_PORTRAIT_URL, toJson(beginDate, endDate));
|
||||
String responseContent = this.service.post(GET_USER_PORTRAIT_URL, toJson(beginDate, endDate));
|
||||
return WxMaUserPortrait.fromJson(responseContent);
|
||||
}
|
||||
|
||||
private WxMaRetainInfo getRetainInfo(Date beginDate, Date endDate, String url) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(url, toJson(beginDate, endDate));
|
||||
String responseContent = this.service.post(url, toJson(beginDate, endDate));
|
||||
return WxMaRetainInfo.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@ -105,7 +99,7 @@ public class WxMaAnalysisServiceImpl implements WxMaAnalysisService {
|
||||
* @return List 类型的数据
|
||||
*/
|
||||
private <T> List<T> getAnalysisResultAsList(String url, Date beginDate, Date endDate, Type returnType) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(url, toJson(beginDate, endDate));
|
||||
String responseContent = this.service.post(url, toJson(beginDate, endDate));
|
||||
JsonObject response = GsonParser.parse(responseContent);
|
||||
boolean hasList = response.has("list");
|
||||
if (hasList) {
|
||||
|
@ -31,7 +31,6 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaCloudServiceImpl implements WxMaCloudService {
|
||||
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
|
@ -9,6 +9,7 @@ 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;
|
||||
|
||||
@ -32,30 +33,29 @@ import me.chanjar.weixin.common.util.json.GsonHelper;
|
||||
* @author <a href="https://github.com/charmingoh">Charming</a>
|
||||
* @since 2018-04-26 20:00
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaCodeServiceImpl implements WxMaCodeService {
|
||||
|
||||
private WxMaService wxMaService;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public void commit(WxMaCodeCommitRequest commitRequest) throws WxErrorException {
|
||||
this.wxMaService.post(COMMIT_URL, commitRequest.toJson());
|
||||
this.service.post(COMMIT_URL, commitRequest.toJson());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getQrCode(String path) throws WxErrorException {
|
||||
String appId = this.wxMaService.getWxMaConfig().getAppid();
|
||||
String appId = this.service.getWxMaConfig().getAppid();
|
||||
Path qrCodeFilePath = null;
|
||||
try {
|
||||
RequestExecutor<File, String> executor = BaseMediaDownloadRequestExecutor
|
||||
.create(this.wxMaService.getRequestHttp(), Files.createTempDirectory("wxjava-ma-" + appId).toFile());
|
||||
.create(this.service.getRequestHttp(), Files.createTempDirectory("wxjava-ma-" + appId).toFile());
|
||||
|
||||
final StringBuilder url = new StringBuilder(GET_QRCODE_URL);
|
||||
if (StringUtils.isNotBlank(path)) {
|
||||
url.append("?path=").append(URLEncoder.encode(path, StandardCharsets.UTF_8.name()));
|
||||
}
|
||||
|
||||
qrCodeFilePath = this.wxMaService.execute(executor, url.toString(), null).toPath();
|
||||
qrCodeFilePath = this.service.execute(executor, url.toString(), null).toPath();
|
||||
return Files.readAllBytes(qrCodeFilePath);
|
||||
} catch (IOException e) {
|
||||
throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e);
|
||||
@ -72,7 +72,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
|
||||
|
||||
@Override
|
||||
public List<WxMaCategory> getCategory() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.get(GET_CATEGORY_URL, null);
|
||||
String responseContent = this.service.get(GET_CATEGORY_URL, null);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
boolean hasCategoryList = jsonObject.has("category_list");
|
||||
if (hasCategoryList) {
|
||||
@ -86,7 +86,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
|
||||
|
||||
@Override
|
||||
public List<String> getPage() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.get(GET_PAGE_URL, null);
|
||||
String responseContent = this.service.get(GET_PAGE_URL, null);
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
boolean hasPageList = jsonObject.has("page_list");
|
||||
if (hasPageList) {
|
||||
@ -100,7 +100,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
|
||||
|
||||
@Override
|
||||
public long submitAudit(WxMaCodeSubmitAuditRequest auditRequest) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(SUBMIT_AUDIT_URL, auditRequest.toJson());
|
||||
String responseContent = this.service.post(SUBMIT_AUDIT_URL, auditRequest.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
return GsonHelper.getLong(jsonObject, "auditid");
|
||||
}
|
||||
@ -109,36 +109,36 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
|
||||
public WxMaCodeAuditStatus getAuditStatus(long auditId) throws WxErrorException {
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("auditid", auditId);
|
||||
String responseContent = this.wxMaService.post(GET_AUDIT_STATUS_URL, param.toString());
|
||||
String responseContent = this.service.post(GET_AUDIT_STATUS_URL, param.toString());
|
||||
return WxMaCodeAuditStatus.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaCodeAuditStatus getLatestAuditStatus() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.get(GET_LATEST_AUDIT_STATUS_URL, null);
|
||||
String responseContent = this.service.get(GET_LATEST_AUDIT_STATUS_URL, null);
|
||||
return WxMaCodeAuditStatus.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() throws WxErrorException {
|
||||
this.wxMaService.post(RELEASE_URL, "{}");
|
||||
this.service.post(RELEASE_URL, "{}");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeVisitStatus(String action) throws WxErrorException {
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("action", action);
|
||||
this.wxMaService.post(CHANGE_VISIT_STATUS_URL, param.toString());
|
||||
this.service.post(CHANGE_VISIT_STATUS_URL, param.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revertCodeRelease() throws WxErrorException {
|
||||
this.wxMaService.get(REVERT_CODE_RELEASE_URL, null);
|
||||
this.service.get(REVERT_CODE_RELEASE_URL, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaCodeVersionDistribution getSupportVersion() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_SUPPORT_VERSION_URL, "{}");
|
||||
String responseContent = this.service.post(GET_SUPPORT_VERSION_URL, "{}");
|
||||
return WxMaCodeVersionDistribution.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@ -146,11 +146,11 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
|
||||
public void setSupportVersion(String version) throws WxErrorException {
|
||||
JsonObject param = new JsonObject();
|
||||
param.addProperty("version", version);
|
||||
this.wxMaService.post(SET_SUPPORT_VERSION_URL, param.toString());
|
||||
this.service.post(SET_SUPPORT_VERSION_URL, param.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undoCodeAudit() throws WxErrorException {
|
||||
this.wxMaService.get(UNDO_CODE_AUDIT_URL, null);
|
||||
this.service.get(UNDO_CODE_AUDIT_URL, null);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import cn.binarywang.wx.miniapp.bean.express.WxMaExpressPrinter;
|
||||
import cn.binarywang.wx.miniapp.bean.express.request.*;
|
||||
import cn.binarywang.wx.miniapp.bean.express.result.WxMaExpressOrderInfoResult;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -20,49 +20,48 @@ import java.util.Map;
|
||||
* @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a>
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaExpressServiceImpl implements WxMaExpressService {
|
||||
|
||||
private WxMaService wxMaService;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public List<WxMaExpressDelivery> getAllDelivery() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.get(ALL_DELIVERY_URL, null);
|
||||
String responseContent = this.service.get(ALL_DELIVERY_URL, null);
|
||||
return WxMaExpressDelivery.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WxMaExpressAccount> getAllAccount() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.get(ALL_ACCOUNT_URL, null);
|
||||
String responseContent = this.service.get(ALL_ACCOUNT_URL, null);
|
||||
return WxMaExpressAccount.fromJsonList(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindAccount(WxMaExpressBindAccountRequest wxMaExpressBindAccountRequest) throws WxErrorException {
|
||||
this.wxMaService.post(BIND_ACCOUNT_URL,wxMaExpressBindAccountRequest.toJson());
|
||||
this.service.post(BIND_ACCOUNT_URL, wxMaExpressBindAccountRequest.toJson());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getQuota(WxMaExpressBindAccountRequest wxMaExpressBindAccountRequest) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_QUOTA_URL,wxMaExpressBindAccountRequest.toJson());
|
||||
String responseContent = this.service.post(GET_QUOTA_URL, wxMaExpressBindAccountRequest.toJson());
|
||||
WxMaExpressAccount account = WxMaExpressAccount.fromJson(responseContent);
|
||||
return account.getQuotaNum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePrinter(WxMaExpressPrinterUpdateRequest wxMaExpressPrinterUpdateRequest) throws WxErrorException {
|
||||
this.wxMaService.post(UPDATE_PRINTER_URL,wxMaExpressPrinterUpdateRequest.toJson());
|
||||
this.service.post(UPDATE_PRINTER_URL, wxMaExpressPrinterUpdateRequest.toJson());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaExpressPrinter getPrinter() throws WxErrorException {
|
||||
String responseContent = this.wxMaService.get(GET_PRINTER_URL, null);
|
||||
String responseContent = this.service.get(GET_PRINTER_URL, null);
|
||||
return WxMaExpressPrinter.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaExpressOrderInfoResult addOrder(WxMaExpressAddOrderRequest wxMaExpressAddOrderRequest) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(ADD_ORDER_URL,wxMaExpressAddOrderRequest.toJson());
|
||||
String responseContent = this.service.post(ADD_ORDER_URL, wxMaExpressAddOrderRequest.toJson());
|
||||
return WxMaExpressOrderInfoResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@ -70,29 +69,29 @@ public class WxMaExpressServiceImpl implements WxMaExpressService {
|
||||
public List<WxMaExpressOrderInfoResult> batchGetOrder(List<WxMaExpressGetOrderRequest> requests) throws WxErrorException {
|
||||
Map<String, Object> param = new HashMap<>(1);
|
||||
param.put("order_list", requests);
|
||||
String responseContent = this.wxMaService.post(BATCH_GET_ORDER_URL, WxMaGsonBuilder.create().toJson(param));
|
||||
String responseContent = this.service.post(BATCH_GET_ORDER_URL, WxMaGsonBuilder.create().toJson(param));
|
||||
return WxMaExpressOrderInfoResult.toList(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelOrder(WxMaExpressGetOrderRequest wxMaExpressGetOrderRequest) throws WxErrorException {
|
||||
this.wxMaService.post(CANCEL_ORDER_URL,wxMaExpressGetOrderRequest.toJson());
|
||||
this.service.post(CANCEL_ORDER_URL, wxMaExpressGetOrderRequest.toJson());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaExpressOrderInfoResult getOrder(WxMaExpressGetOrderRequest wxMaExpressGetOrderRequest) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_ORDER_URL,wxMaExpressGetOrderRequest.toJson());
|
||||
String responseContent = this.service.post(GET_ORDER_URL, wxMaExpressGetOrderRequest.toJson());
|
||||
return WxMaExpressOrderInfoResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaExpressPath getPath(WxMaExpressGetOrderRequest wxMaExpressGetOrderRequest) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(GET_PATH_URL,wxMaExpressGetOrderRequest.toJson());
|
||||
String responseContent = this.service.post(GET_PATH_URL, wxMaExpressGetOrderRequest.toJson());
|
||||
return WxMaExpressPath.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testUpdateOrder(WxMaExpressTestUpdateOrderRequest wxMaExpressTestUpdateOrderRequest) throws WxErrorException {
|
||||
this.wxMaService.post(TEST_UPDATE_ORDER_URL,wxMaExpressTestUpdateOrderRequest.toJson());
|
||||
this.service.post(TEST_UPDATE_ORDER_URL, wxMaExpressTestUpdateOrderRequest.toJson());
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package cn.binarywang.wx.miniapp.api.impl;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaJsapiService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.bean.WxJsapiSignature;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.RandomUtils;
|
||||
@ -19,11 +19,9 @@ import java.util.concurrent.locks.Lock;
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaJsapiServiceImpl implements WxMaJsapiService {
|
||||
|
||||
|
||||
private WxMaService wxMaService;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public String getCardApiTicket() throws WxErrorException {
|
||||
@ -34,25 +32,25 @@ public class WxMaJsapiServiceImpl implements WxMaJsapiService {
|
||||
public String getCardApiTicket(boolean forceRefresh) throws WxErrorException {
|
||||
|
||||
if (forceRefresh) {
|
||||
this.wxMaService.getWxMaConfig().expireCardApiTicket();
|
||||
this.service.getWxMaConfig().expireCardApiTicket();
|
||||
}
|
||||
|
||||
if (this.wxMaService.getWxMaConfig().isCardApiTicketExpired()) {
|
||||
Lock lock = this.wxMaService.getWxMaConfig().getCardApiTicketLock();
|
||||
if (this.service.getWxMaConfig().isCardApiTicketExpired()) {
|
||||
Lock lock = this.service.getWxMaConfig().getCardApiTicketLock();
|
||||
lock.lock();
|
||||
try {
|
||||
if (this.wxMaService.getWxMaConfig().isCardApiTicketExpired()) {
|
||||
String responseContent = this.wxMaService.get(GET_JSAPI_TICKET_URL + "?type=wx_card", null);
|
||||
if (this.service.getWxMaConfig().isCardApiTicketExpired()) {
|
||||
String responseContent = this.service.get(GET_JSAPI_TICKET_URL + "?type=wx_card", null);
|
||||
JsonObject tmpJsonObject = GsonParser.parse(responseContent);
|
||||
String jsapiTicket = tmpJsonObject.get("ticket").getAsString();
|
||||
int expiresInSeconds = tmpJsonObject.get("expires_in").getAsInt();
|
||||
this.wxMaService.getWxMaConfig().updateCardApiTicket(jsapiTicket, expiresInSeconds);
|
||||
this.service.getWxMaConfig().updateCardApiTicket(jsapiTicket, expiresInSeconds);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return this.wxMaService.getWxMaConfig().getCardApiTicket();
|
||||
return this.service.getWxMaConfig().getCardApiTicket();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,24 +60,24 @@ public class WxMaJsapiServiceImpl implements WxMaJsapiService {
|
||||
|
||||
@Override
|
||||
public String getJsapiTicket(boolean forceRefresh) throws WxErrorException {
|
||||
Lock lock = this.wxMaService.getWxMaConfig().getJsapiTicketLock();
|
||||
Lock lock = this.service.getWxMaConfig().getJsapiTicketLock();
|
||||
lock.lock();
|
||||
try {
|
||||
if (forceRefresh) {
|
||||
this.wxMaService.getWxMaConfig().expireJsapiTicket();
|
||||
this.service.getWxMaConfig().expireJsapiTicket();
|
||||
}
|
||||
|
||||
if (this.wxMaService.getWxMaConfig().isJsapiTicketExpired()) {
|
||||
String responseContent = this.wxMaService.get(GET_JSAPI_TICKET_URL + "?type=jsapi", null);
|
||||
if (this.service.getWxMaConfig().isJsapiTicketExpired()) {
|
||||
String responseContent = this.service.get(GET_JSAPI_TICKET_URL + "?type=jsapi", null);
|
||||
JsonObject tmpJsonObject = GsonParser.parse(responseContent);
|
||||
String jsapiTicket = tmpJsonObject.get("ticket").getAsString();
|
||||
int expiresInSeconds = tmpJsonObject.get("expires_in").getAsInt();
|
||||
this.wxMaService.getWxMaConfig().updateJsapiTicket(jsapiTicket, expiresInSeconds);
|
||||
this.service.getWxMaConfig().updateJsapiTicket(jsapiTicket, expiresInSeconds);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return this.wxMaService.getWxMaConfig().getJsapiTicket();
|
||||
return this.service.getWxMaConfig().getJsapiTicket();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,7 +89,7 @@ public class WxMaJsapiServiceImpl implements WxMaJsapiService {
|
||||
"noncestr=" + randomStr, "timestamp=" + timestamp, "url=" + url);
|
||||
return WxJsapiSignature
|
||||
.builder()
|
||||
.appId(this.wxMaService.getWxMaConfig().getAppid())
|
||||
.appId(this.service.getWxMaConfig().getAppid())
|
||||
.timestamp(timestamp)
|
||||
.nonceStr(randomStr)
|
||||
.url(url)
|
||||
|
@ -10,6 +10,7 @@ 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;
|
||||
|
||||
@ -25,7 +26,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author <a href="https://github.com/lipengjun92">lipengjun (939961241@qq.com)</a>
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaLiveGoodsServiceImpl implements WxMaLiveGoodsService {
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
|
@ -7,6 +7,7 @@ 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;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
@ -26,7 +27,7 @@ import java.util.Map;
|
||||
* @author <a href="https://github.com/yjwang3300300">yjwang</a>
|
||||
*/
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaLiveServiceImpl implements WxMaLiveService {
|
||||
private static final String ERR_CODE = "errcode";
|
||||
private static final String ROOM_ID = "roomId";
|
||||
|
@ -3,6 +3,7 @@ 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;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@ -20,7 +21,7 @@ import java.util.UUID;
|
||||
/**
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaMediaServiceImpl implements WxMaMediaService {
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
|
@ -7,6 +7,7 @@ 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;
|
||||
@ -15,19 +16,19 @@ import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
/**
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaMsgServiceImpl implements WxMaMsgService {
|
||||
private final WxMaService wxMaService;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public boolean sendKefuMsg(WxMaKefuMessage message) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(KEFU_MESSAGE_SEND_URL, message.toJson());
|
||||
String responseContent = this.service.post(KEFU_MESSAGE_SEND_URL, message.toJson());
|
||||
return responseContent != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSubscribeMsg(WxMaSubscribeMessage subscribeMessage) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(SUBSCRIBE_MSG_SEND_URL, subscribeMessage.toJson());
|
||||
String responseContent = this.service.post(SUBSCRIBE_MSG_SEND_URL, subscribeMessage.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
@ -36,7 +37,7 @@ public class WxMaMsgServiceImpl implements WxMaMsgService {
|
||||
|
||||
@Override
|
||||
public void sendUniformMsg(WxMaUniformMessage uniformMessage) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(UNIFORM_MSG_SEND_URL, uniformMessage.toJson());
|
||||
String responseContent = this.service.post(UNIFORM_MSG_SEND_URL, uniformMessage.toJson());
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get(WxMaConstants.ERRCODE).getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
@ -45,13 +46,13 @@ public class WxMaMsgServiceImpl implements WxMaMsgService {
|
||||
|
||||
@Override
|
||||
public JsonObject createUpdatableMessageActivityId() throws WxErrorException {
|
||||
final String responseContent = this.wxMaService.get(ACTIVITY_ID_CREATE_URL, null);
|
||||
final String responseContent = this.service.get(ACTIVITY_ID_CREATE_URL, null);
|
||||
return GsonParser.parse(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUpdatableMsg(WxMaUpdatableMsg msg) throws WxErrorException {
|
||||
this.wxMaService.post(UPDATABLE_MSG_SEND_URL, WxMaGsonBuilder.create().toJson(msg));
|
||||
this.service.post(UPDATABLE_MSG_SEND_URL, WxMaGsonBuilder.create().toJson(msg));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class WxMaOcrServiceImpl implements WxOcrService {
|
||||
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 mainService;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public WxOcrIdCardResult idCard(String imgUrl) throws WxErrorException {
|
||||
@ -43,13 +43,13 @@ public class WxMaOcrServiceImpl implements WxOcrService {
|
||||
// ignore cannot happen
|
||||
}
|
||||
|
||||
final String result = this.mainService.post(String.format(IDCARD, imgUrl), (String) null);
|
||||
final String result = this.service.post(String.format(IDCARD, imgUrl), (String) null);
|
||||
return WxOcrIdCardResult.fromJson(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxOcrIdCardResult idCard(File imgFile) throws WxErrorException {
|
||||
String result = this.mainService.execute(OcrDiscernRequestExecutor.create(this.mainService.getRequestHttp()),
|
||||
String result = this.service.execute(OcrDiscernRequestExecutor.create(this.service.getRequestHttp()),
|
||||
FILEIDCARD, imgFile);
|
||||
return WxOcrIdCardResult.fromJson(result);
|
||||
}
|
||||
@ -62,13 +62,13 @@ public class WxMaOcrServiceImpl implements WxOcrService {
|
||||
// ignore cannot happen
|
||||
}
|
||||
|
||||
final String result = this.mainService.post(String.format(BANK_CARD, imgUrl), (String) null);
|
||||
final String result = this.service.post(String.format(BANK_CARD, imgUrl), (String) null);
|
||||
return WxOcrBankCardResult.fromJson(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxOcrBankCardResult bankCard(File imgFile) throws WxErrorException {
|
||||
String result = this.mainService.execute(OcrDiscernRequestExecutor.create(this.mainService.getRequestHttp()),
|
||||
String result = this.service.execute(OcrDiscernRequestExecutor.create(this.service.getRequestHttp()),
|
||||
FILE_BANK_CARD, imgFile);
|
||||
return WxOcrBankCardResult.fromJson(result);
|
||||
}
|
||||
@ -81,13 +81,13 @@ public class WxMaOcrServiceImpl implements WxOcrService {
|
||||
// ignore cannot happen
|
||||
}
|
||||
|
||||
final String result = this.mainService.post(String.format(DRIVING, imgUrl), (String) null);
|
||||
final String result = this.service.post(String.format(DRIVING, imgUrl), (String) null);
|
||||
return WxOcrDrivingResult.fromJson(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxOcrDrivingResult driving(File imgFile) throws WxErrorException {
|
||||
String result = this.mainService.execute(OcrDiscernRequestExecutor.create(this.mainService.getRequestHttp()),
|
||||
String result = this.service.execute(OcrDiscernRequestExecutor.create(this.service.getRequestHttp()),
|
||||
FILE_DRIVING, imgFile);
|
||||
return WxOcrDrivingResult.fromJson(result);
|
||||
}
|
||||
@ -100,13 +100,13 @@ public class WxMaOcrServiceImpl implements WxOcrService {
|
||||
// ignore cannot happen
|
||||
}
|
||||
|
||||
final String result = this.mainService.post(String.format(DRIVING_LICENSE, imgUrl), (String) null);
|
||||
final String result = this.service.post(String.format(DRIVING_LICENSE, imgUrl), (String) null);
|
||||
return WxOcrDrivingLicenseResult.fromJson(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxOcrDrivingLicenseResult drivingLicense(File imgFile) throws WxErrorException {
|
||||
String result = this.mainService.execute(OcrDiscernRequestExecutor.create(this.mainService.getRequestHttp()),
|
||||
String result = this.service.execute(OcrDiscernRequestExecutor.create(this.service.getRequestHttp()),
|
||||
FILE_DRIVING_LICENSE, imgFile);
|
||||
return WxOcrDrivingLicenseResult.fromJson(result);
|
||||
}
|
||||
@ -119,13 +119,13 @@ public class WxMaOcrServiceImpl implements WxOcrService {
|
||||
// ignore cannot happen
|
||||
}
|
||||
|
||||
final String result = this.mainService.post(String.format(BIZ_LICENSE, imgUrl), (String) null);
|
||||
final String result = this.service.post(String.format(BIZ_LICENSE, imgUrl), (String) null);
|
||||
return WxOcrBizLicenseResult.fromJson(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxOcrBizLicenseResult bizLicense(File imgFile) throws WxErrorException {
|
||||
String result = this.mainService.execute(OcrDiscernRequestExecutor.create(this.mainService.getRequestHttp()),
|
||||
String result = this.service.execute(OcrDiscernRequestExecutor.create(this.service.getRequestHttp()),
|
||||
FILE_BIZ_LICENSE, imgFile);
|
||||
return WxOcrBizLicenseResult.fromJson(result);
|
||||
}
|
||||
@ -138,13 +138,13 @@ public class WxMaOcrServiceImpl implements WxOcrService {
|
||||
// ignore cannot happen
|
||||
}
|
||||
|
||||
final String result = this.mainService.post(String.format(COMM, imgUrl), (String) null);
|
||||
final String result = this.service.post(String.format(COMM, imgUrl), (String) null);
|
||||
return WxOcrCommResult.fromJson(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxOcrCommResult comm(File imgFile) throws WxErrorException {
|
||||
String result = this.mainService.execute(OcrDiscernRequestExecutor.create(this.mainService.getRequestHttp()),
|
||||
String result = this.service.execute(OcrDiscernRequestExecutor.create(this.service.getRequestHttp()),
|
||||
FILE_COMM, imgFile);
|
||||
return WxOcrCommResult.fromJson(result);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import java.util.Map;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class WxMaPluginServiceImpl implements WxMaPluginService {
|
||||
private WxMaService wxMaService;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public void applyPlugin(String pluginAppId, String reason) throws WxErrorException {
|
||||
@ -20,21 +20,21 @@ public class WxMaPluginServiceImpl implements WxMaPluginService {
|
||||
"plugin_appid", pluginAppId,
|
||||
"reason", reason);
|
||||
|
||||
this.wxMaService.post(PLUGIN_URL, WxMaGsonBuilder.create().toJson(params));
|
||||
this.service.post(PLUGIN_URL, WxMaGsonBuilder.create().toJson(params));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaPluginListResult getPluginList() throws WxErrorException {
|
||||
Map<String, String> params = ImmutableMap.of("action", "list");
|
||||
|
||||
String responseContent = this.wxMaService.post(PLUGIN_URL, WxMaGsonBuilder.create().toJson(params));
|
||||
String responseContent = this.service.post(PLUGIN_URL, WxMaGsonBuilder.create().toJson(params));
|
||||
return WxMaPluginListResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbindPlugin(String pluginAppId) throws WxErrorException {
|
||||
Map<String, String> params = ImmutableMap.of("action", "unbind", "plugin_appid", pluginAppId);
|
||||
this.wxMaService.post(PLUGIN_URL, WxMaGsonBuilder.create().toJson(params));
|
||||
this.service.post(PLUGIN_URL, WxMaGsonBuilder.create().toJson(params));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,6 +43,6 @@ public class WxMaPluginServiceImpl implements WxMaPluginService {
|
||||
"plugin_appid", pluginAppId,
|
||||
"user_version", userVersion);
|
||||
|
||||
this.wxMaService.post(PLUGIN_URL, WxMaGsonBuilder.create().toJson(params));
|
||||
this.service.post(PLUGIN_URL, WxMaGsonBuilder.create().toJson(params));
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ 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;
|
||||
@ -16,18 +17,18 @@ import java.io.File;
|
||||
/**
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
private WxMaService wxMaService;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public byte[] createQrcodeBytes(String path, int width) throws WxErrorException {
|
||||
return this.wxMaService.execute(QrcodeBytesRequestExecutor.create(this.wxMaService.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.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.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
|
||||
@ -38,7 +39,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public byte[] createWxaCodeBytes(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline)
|
||||
throws WxErrorException {
|
||||
return this.wxMaService.execute(QrcodeBytesRequestExecutor.create(this.wxMaService.getRequestHttp()), GET_WXACODE_URL, WxaCode.builder()
|
||||
return this.service.execute(QrcodeBytesRequestExecutor.create(this.service.getRequestHttp()), GET_WXACODE_URL, WxaCode.builder()
|
||||
.path(path)
|
||||
.width(width)
|
||||
.autoColor(autoColor)
|
||||
@ -50,7 +51,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public File createWxaCode(String path, int width, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline)
|
||||
throws WxErrorException {
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp()), GET_WXACODE_URL, WxaCode.builder()
|
||||
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp()), GET_WXACODE_URL, WxaCode.builder()
|
||||
.path(path)
|
||||
.width(width)
|
||||
.autoColor(autoColor)
|
||||
@ -72,7 +73,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public byte[] createWxaCodeUnlimitBytes(String scene, String page, int width, boolean autoColor,
|
||||
WxMaCodeLineColor lineColor, boolean isHyaline) throws WxErrorException {
|
||||
return this.wxMaService.execute(QrcodeBytesRequestExecutor.create(this.wxMaService.getRequestHttp()),
|
||||
return this.service.execute(QrcodeBytesRequestExecutor.create(this.service.getRequestHttp()),
|
||||
GET_WXACODE_UNLIMIT_URL,
|
||||
this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
|
||||
}
|
||||
@ -80,7 +81,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public File createWxaCodeUnlimit(String scene, String page, int width, boolean autoColor,
|
||||
WxMaCodeLineColor lineColor, boolean isHyaline) throws WxErrorException {
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp()),
|
||||
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp()),
|
||||
GET_WXACODE_UNLIMIT_URL,
|
||||
this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
|
||||
}
|
||||
@ -105,7 +106,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
|
||||
@Override
|
||||
public File createQrcode(String path, int width, String filePath) throws WxErrorException {
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.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
|
||||
@ -116,7 +117,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public File createWxaCode(String path, int width, String filePath, boolean autoColor, WxMaCodeLineColor lineColor, boolean isHyaline)
|
||||
throws WxErrorException {
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp(), filePath), GET_WXACODE_URL, WxaCode.builder()
|
||||
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp(), filePath), GET_WXACODE_URL, WxaCode.builder()
|
||||
.path(path)
|
||||
.width(width)
|
||||
.autoColor(autoColor)
|
||||
@ -138,7 +139,7 @@ public class WxMaQrcodeServiceImpl implements WxMaQrcodeService {
|
||||
@Override
|
||||
public File createWxaCodeUnlimit(String scene, String page, String filePath, int width, boolean autoColor,
|
||||
WxMaCodeLineColor lineColor, boolean isHyaline) throws WxErrorException {
|
||||
return this.wxMaService.execute(QrcodeRequestExecutor.create(this.wxMaService.getRequestHttp(), filePath),
|
||||
return this.service.execute(QrcodeRequestExecutor.create(this.service.getRequestHttp(), filePath),
|
||||
GET_WXACODE_UNLIMIT_URL,
|
||||
this.buildWxaCodeUnlimit(scene, page, width, autoColor, lineColor, isHyaline));
|
||||
}
|
||||
|
@ -7,18 +7,18 @@ 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;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
*
|
||||
* Created by Binary Wang on 2018/11/4.
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaRunServiceImpl implements WxMaRunService {
|
||||
private WxMaService service;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public List<WxMaRunStepInfo> getRunStepInfo(String sessionKey, String encryptedData, String ivStr) {
|
||||
|
@ -4,7 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaSecCheckService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaMediaAsyncCheckResult;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@ -23,9 +23,9 @@ import java.net.URL;
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaSecCheckServiceImpl implements WxMaSecCheckService {
|
||||
private WxMaService service;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public boolean checkImage(File file) throws WxErrorException {
|
||||
|
@ -4,7 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaSettingService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaDomainAction;
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -14,9 +14,9 @@ import java.util.Map;
|
||||
* @author <a href="https://github.com/charmingoh">Charming</a>
|
||||
* @since 2018-04-27 15:46
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaSettingServiceImpl implements WxMaSettingService {
|
||||
private WxMaService wxMaService;
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
public WxMaDomainAction modifyDomain(WxMaDomainAction domainAction) throws WxErrorException {
|
||||
|
@ -4,14 +4,14 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaShareService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaShareInfo;
|
||||
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author zhfish
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaShareServiceImpl implements WxMaShareService {
|
||||
private WxMaService service;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public WxMaShareInfo getShareInfo(String sessionKey, String encryptedData, String ivStr) {
|
||||
|
@ -7,7 +7,7 @@ import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -19,9 +19,9 @@ import java.util.List;
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* @date 2019-12-15
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaSubscribeServiceImpl implements WxMaSubscribeService {
|
||||
private WxMaService wxMaService;
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
public WxMaPubTemplateTitleListResult getPubTemplateTitleList(String[] ids, int start, int limit) throws WxErrorException {
|
||||
|
@ -9,7 +9,7 @@ import cn.binarywang.wx.miniapp.config.WxMaConfig;
|
||||
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
|
||||
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.SignUtils;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
@ -19,9 +19,9 @@ import java.util.Map;
|
||||
/**
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
public class WxMaUserServiceImpl implements WxMaUserService {
|
||||
private WxMaService service;
|
||||
private final WxMaService service;
|
||||
|
||||
@Override
|
||||
public WxMaJscode2SessionResult getSessionInfo(String jsCode) throws WxErrorException {
|
||||
|
Loading…
Reference in New Issue
Block a user