diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java index 8c0eab800..7d06a16b1 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java @@ -66,7 +66,7 @@ public class TtMerchantReciverSchedule { List wxAppinfoList = wxAppinfoService.getList(appQ); for (WxAppinfo wxAppinfo:wxAppinfoList) { appIdMap.put(wxAppinfo.getTenantId(),wxAppinfo.getAppId()); - WxPayAccount wxPayAccount = payAccountService.getById(wxAppinfo.getId()); + WxPayAccount wxPayAccount = payAccountService.getById(wxAppinfo.getPayId()); payAccountKeyMap.put(wxAppinfo.getTenantId(),wxPayAccount.getApiKey()); } diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebService.java b/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebService.java new file mode 100644 index 000000000..eef1b9fc1 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebService.java @@ -0,0 +1,115 @@ +package com.iformall.douyin.web.api; + +import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; +import cn.binarywang.wx.miniapp.config.WxMaConfig; +import com.iformall.douyin.miniapp.api.TtMaQrcodeService; +import com.iformall.douyin.miniapp.api.TtMaUserService; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor; +import me.chanjar.weixin.common.util.http.RequestExecutor; +import me.chanjar.weixin.common.util.http.RequestHttp; + +/** + * @author Binary Wang + */ +public interface TtWebService { + + /** + * 获取access_token. + */ + String GET_ACCESS_TOKEN_URL = "oauth/client_token"; + + + /** + *
+   * 获取access_token,本方法线程安全.
+   * 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限
+   *
+   * 另:本service的所有方法都会在access_token过期是调用此方法
+   *
+   * 程序员在非必要情况下尽量不要主动调用此方法
+   *
+   * 详情请见: https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/server/interface-request-credential/get-access-token
+   * 
+ * + * @param forceRefresh 强制刷新 + */ + String getAccessToken(boolean forceRefresh) throws WxErrorException; + + /** + * 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求. + */ + String get(String url, String queryParam) throws WxErrorException; + + /** + * 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求. + */ + String post(String url, String postData) throws WxErrorException; + + /** + * 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求. + */ + String post(String url, Object obj) throws WxErrorException; + + /** + *
+   * Service没有实现某个API的时候,可以用这个,
+   * 比{@link #get}和{@link #post}方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。
+   * 可以参考,{@link MediaUploadRequestExecutor}的实现方法
+   * 
+ */ + T execute(RequestExecutor executor, String uri, E data) throws WxErrorException; + + /** + *
+   * 设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试.
+   * 默认:1000ms
+   * 
+ */ + void setRetrySleepMillis(int retrySleepMillis); + + /** + *
+   * 设置当微信系统响应系统繁忙时,最大重试次数.
+   * 默认:5次
+   * 
+ */ + void setMaxRetryTimes(int maxRetryTimes); + + /** + * 获取WxMaConfig 对象. + * + * @return WxMaConfig + */ + WxMaConfig getWxMaConfig(); + + /** + * 注入 {@link WxMaConfig} 的实现. + */ + void setWxMaConfig(WxMaConfig wxConfigProvider); + + /** + * 初始化http请求对象. + */ + void initHttp(); + + /** + * 请求http请求相关信息. + */ + RequestHttp getRequestHttp(); + + /** + * 返回用户相关接口方法的实现类对象,以方便调用其各个接口. + * + * @return TtMaUserService + */ + TtMaUserService getUserService(); + + /** + * 返回用户相关接口方法的实现类对象,以方便调用其各个接口. + * + * @return TtMaUserService + */ + TtMaQrcodeService getQrcodeService(); + +} diff --git a/mallinkService/src/main/java/com/iformall/douyin/web/enums/TtWebApiBeginEnum.java b/mallinkService/src/main/java/com/iformall/douyin/web/enums/TtWebApiBeginEnum.java new file mode 100644 index 000000000..9fcae7e77 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/douyin/web/enums/TtWebApiBeginEnum.java @@ -0,0 +1,41 @@ +package com.iformall.douyin.web.enums; + +/** + * tt平台 + * @author alascor + */ +public enum TtWebApiBeginEnum { + DY(1,"https://open.douyin.com/"), + TT(2,"https://open.snssdk.com/"), + XG(3,"https://open-api.ixigua.com/"), + ; + + TtWebApiBeginEnum(Integer code, String prefix) { + this.code = code; + this.prefix = prefix; + } + + private Integer code; + private String prefix; + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + public String getPrefix() { + return prefix; + } + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public static TtWebApiBeginEnum getByCode(Integer code) { + for (TtWebApiBeginEnum e : TtWebApiBeginEnum.values()) { + if (e.getCode().intValue() == code.intValue()) { + return e; + } + } + return null; + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumAppType.java b/mallinkService/src/main/java/com/iformall/enums/EnumAppType.java index 7a3deafc3..9b05f9458 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumAppType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumAppType.java @@ -11,6 +11,7 @@ public enum EnumAppType { C(2, "C端"), MP_S(3,"公众号-服务号"), MP_P(4, "公众号-订阅号"), + A(5, "A端"), ; public static EnumAppType getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/TtMiniAppPayAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/TtMiniAppPayAdapterService.java index d8e68538f..f0aa39ec2 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/TtMiniAppPayAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/TtMiniAppPayAdapterService.java @@ -131,6 +131,7 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen try { String response = ttappService.post(ttappService.ORDER_PUSH, map); + log.info("订单同步结果{}"+response); JSONObject jsonObject = JSON.parseObject(response); Integer code = jsonObject.getInteger("err_code"); if (null != code && code.intValue() == 0 ) {