no message
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
package com.sczx.order.controller;
|
||||
|
||||
import com.sczx.order.common.Result;
|
||||
import com.meituan.sdk.auth.MeituanTokenResponse;
|
||||
import com.sczx.order.service.DouyinService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -21,24 +21,24 @@ public class VerifyController {
|
||||
|
||||
@ApiOperation(value = "接收需同步数据接口")
|
||||
@GetMapping("/authorization")
|
||||
public Result authorization(@RequestParam("code") String code, @RequestParam("sign") String sign, @RequestParam("developerId") Long developerId, @RequestParam("businessId") int businessId,
|
||||
public String authorization(@RequestParam("code") String code, @RequestParam("sign") String sign, @RequestParam("developerId") Long developerId, @RequestParam("businessId") int businessId,
|
||||
@RequestParam("state") String state){
|
||||
|
||||
log.info("接收美团授权数据 - code: {}, sign: {}, developerId: {}, businessId: {}, state: {}",
|
||||
code, sign, developerId, businessId, state);
|
||||
|
||||
return null;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "接收需据接口")
|
||||
@GetMapping("/Prepare")
|
||||
public Result prepare(@RequestParam("code") String code) throws Exception {
|
||||
@GetMapping("/prepare")
|
||||
public String prepare(@RequestParam("code") String code) throws Exception {
|
||||
|
||||
|
||||
douyinService.getAccessToken( code);
|
||||
MeituanTokenResponse response = douyinService.getAccessToken( code);
|
||||
|
||||
return null;
|
||||
return response.getData().getAccessToken();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.sczx.order.service;
|
||||
|
||||
import com.meituan.sdk.auth.MeituanTokenResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DouyinService {
|
||||
@ -9,5 +11,5 @@ public interface DouyinService {
|
||||
|
||||
void prepare(List<String> orderIds) throws Exception;
|
||||
|
||||
void getAccessToken(String code);
|
||||
MeituanTokenResponse getAccessToken(String code);
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ public class DouyinServiceImpl implements DouyinService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAccessToken(String code) {
|
||||
public MeituanTokenResponse getAccessToken(String code) {
|
||||
try {
|
||||
// 使用美团SDK构建客户端
|
||||
MeituanClient client = DefaultMeituanClient.builder(DeveloperId, Signkey).build();
|
||||
@ -145,9 +145,12 @@ public class DouyinServiceImpl implements DouyinService {
|
||||
|
||||
log.info("获取access_token响应结果: {}", JSONObject.toJSONString(response));
|
||||
|
||||
return response;
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("获取access_token异常", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user