Browse Source

update tto

master
xhxu 2 years ago
parent
commit
f734990d3c
4 changed files with 51 additions and 1 deletions
  1. +7
    -0
      mallinkService/src/main/java/com/iformall/service/toutiao/api/TtOpenMaService.java
  2. +1
    -1
      mallinkService/src/main/java/com/iformall/service/toutiao/api/impl/TtOpenComponentServiceImpl.java
  3. +10
    -0
      mallinkService/src/main/java/com/iformall/service/toutiao/api/impl/TtOpenMaServiceImpl.java
  4. +33
    -0
      mlToutiaoOpen/src/main/java/com/iformall/controller/TtMerchantPoiController.java

+ 7
- 0
mallinkService/src/main/java/com/iformall/service/toutiao/api/TtOpenMaService.java View File

@@ -248,6 +248,11 @@ public interface TtOpenMaService extends TtMaService {
*/
String APIQUERY_SHOP_MATERIAL = "https://open.microapp.bytedance.com/openapi/v1//microapp/operation/poi/query_shop_material";

/**
* 获取客服链接
*/
String CUSTOMER_SERVICE_URL = "https://developer.toutiao.com/api/apps/customer_service/url";


/**
* 获得小程序的域名配置信息
@@ -505,6 +510,8 @@ public interface TtOpenMaService extends TtMaService {

String queryShopMeaterial(String supplierExtId)throws WxErrorException ;

String queryCustomerServiceUrl(String openid, String type)throws WxErrorException ;

// /**
// * 小程序用户隐私保护指引服务
// *


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/toutiao/api/impl/TtOpenComponentServiceImpl.java View File

@@ -325,7 +325,7 @@ public class TtOpenComponentServiceImpl implements TtOpenComponentService {
log.info("获取authorizerAccessToken-----------------"+responseContent);

TtOpenAuthorizationInfo queryAuth = TtOpenGsonBuilder.create().fromJson(responseContent, TtOpenAuthorizationInfo.class);
log.info("获取authorizerAccessToken-----------------"+queryAuth.getAuthorizerAccessToken());
log.info("获取authorizerAccessToken-----------------"+TtOpenGsonBuilder.create().toJson(queryAuth));
if (queryAuth.getAuthorizerAccessToken() != null) {
config.updateAuthorizerAccessToken(queryAuth.getAuthorizerAppid(),
queryAuth.getAuthorizerAccessToken(), queryAuth.getExpiresIn());


+ 10
- 0
mallinkService/src/main/java/com/iformall/service/toutiao/api/impl/TtOpenMaServiceImpl.java View File

@@ -710,6 +710,16 @@ public class TtOpenMaServiceImpl extends TtMaServiceImpl implements TtOpenMaServ
return response;
}

@Override
public String queryCustomerServiceUrl(String openid, String type) throws WxErrorException {
String uri = CUSTOMER_SERVICE_URL + "?appid=" + ttOpenComponentService.getWxOpenConfigStorage().getComponentAppId()
+"&openid="+openid
+"&type="+type
+"&scene=1";
String response = ttOpenComponentService.getByAppAccessToken(appId, uri, "access_token");
return response;
}


/**
* 将字符串对象转化为GsonArray对象


+ 33
- 0
mlToutiaoOpen/src/main/java/com/iformall/controller/TtMerchantPoiController.java View File

@@ -307,4 +307,37 @@ public class TtMerchantPoiController extends BaseController {

}

@ApiOperation("获取客服链接")
@PostMapping("/query_customer_service_url")
public ResultData queryCustomerServiceUrl(@RequestBody Map<String, String> param) {
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::queryCustomerServiceUrl");
String appid = param.get("appid");
String openid = param.get("openid");
if(StringUtils.isBlank(appid) || StringUtils.isBlank(openid)){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
String type = param.get("type");
if(StringUtils.isBlank(type)){//来源,抖音传 1128,抖音极速版传 2329
type = "1128";
}
if(!type.equals("1128") && !type.equals("2329")){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
}
WxAppinfo appinfo = appinfoService.getByAppId(appid);

if(appinfo == null){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"找不到小程序信息");
}

try{
TtOpenMaService openMaService = openService.getTtOpenComponentService().getTtMaServiceByAppid(appid);
String res = openMaService.queryCustomerServiceUrl(openid,type);
return new ResultData(res);
}catch(Exception e){
logger.error("获取客服链接 error"+ e.getMessage());
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"获取客服链接失败");
}

}

}

Loading…
Cancel
Save