Просмотр исходного кода

//TTreciver

release_toaliyun_real
xhxu 4 лет назад
Родитель
Сommit
9a7c59e783
5 измененных файлов: 159 добавлений и 1 удалений
  1. +1
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java
  2. +115
    -0
      mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebService.java
  3. +41
    -0
      mallinkService/src/main/java/com/iformall/douyin/web/enums/TtWebApiBeginEnum.java
  4. +1
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumAppType.java
  5. +1
    -0
      mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/TtMiniAppPayAdapterService.java

+ 1
- 1
mallinkSchedule/src/main/java/com/iformall/schedule/TtMerchantReciverSchedule.java Просмотреть файл

@@ -66,7 +66,7 @@ public class TtMerchantReciverSchedule {
List<WxAppinfo> 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());
}



+ 115
- 0
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 <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface TtWebService {

/**
* 获取access_token.
*/
String GET_ACCESS_TOKEN_URL = "oauth/client_token";


/**
* <pre>
* 获取access_token,本方法线程安全.
* 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限
*
* 另:本service的所有方法都会在access_token过期是调用此方法
*
* 程序员在非必要情况下尽量不要主动调用此方法
*
* 详情请见: https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/server/interface-request-credential/get-access-token
* </pre>
*
* @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;

/**
* <pre>
* Service没有实现某个API的时候,可以用这个,
* 比{@link #get}和{@link #post}方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。
* 可以参考,{@link MediaUploadRequestExecutor}的实现方法
* </pre>
*/
<T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException;

/**
* <pre>
* 设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试.
* 默认:1000ms
* </pre>
*/
void setRetrySleepMillis(int retrySleepMillis);

/**
* <pre>
* 设置当微信系统响应系统繁忙时,最大重试次数.
* 默认:5次
* </pre>
*/
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();

}

+ 41
- 0
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;
}
}

+ 1
- 0
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) {


+ 1
- 0
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 ) {


Загрузка…
Отмена
Сохранить