完善几个接口
This commit is contained in:
parent
1ef6fec71a
commit
ac7475f5c5
|
|
@ -119,7 +119,7 @@ graph TD
|
|||
|
||||
+ `security`:公共权限验证模块
|
||||
|
||||
#### 2.2 api
|
||||
#### 2.2 gateway
|
||||
网关项目,负责微服务接口转发,前端统一通过网关调用其他微服务接口;
|
||||
|
||||
采用`gateway`进行api分发,引入Sentinel进行流量治理。
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<version>3.0.2</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<artifactId>api</artifactId>
|
||||
<artifactId>gateway</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>2.0.0</version>
|
||||
<name>api</name>
|
||||
|
|
@ -3,7 +3,6 @@ package com.qihang.api;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
|
|
@ -11,12 +10,12 @@ import org.springframework.context.annotation.Bean;
|
|||
*/
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class Api
|
||||
public class Gateway
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello api! " );
|
||||
SpringApplication.run(Api.class, args);
|
||||
SpringApplication.run(Gateway.class, args);
|
||||
}
|
||||
|
||||
// @Bean
|
||||
|
|
@ -2,7 +2,7 @@ server:
|
|||
port: 8080
|
||||
spring:
|
||||
application:
|
||||
name: api-service
|
||||
name: gateway
|
||||
# security:
|
||||
# user:
|
||||
# name: admin
|
||||
|
|
@ -37,42 +37,13 @@ spring:
|
|||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
- id: tao_api_route
|
||||
uri: lb://tao-api
|
||||
predicates:
|
||||
- Path=/api/tao-api/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
- id: jd_api_route
|
||||
uri: lb://jd-api
|
||||
predicates:
|
||||
- Path=/api/jd-api/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
- id: sys_api_route
|
||||
uri: lb://sys-api
|
||||
predicates:
|
||||
- Path=/api/sys-api/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
- id: dou_api_route
|
||||
uri: lb://dou-api
|
||||
predicates:
|
||||
- Path=/api/dou-api/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
- id: pdd_api_route
|
||||
uri: lb://pdd-api
|
||||
predicates:
|
||||
- Path=/api/pdd-api/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
- id: wei_api_route
|
||||
uri: lb://wei-api
|
||||
predicates:
|
||||
- Path=/api/wei-api/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# - TokenFilter
|
||||
# default-filters:
|
||||
# - TokenFilter
|
||||
Binary file not shown.
|
|
@ -134,7 +134,13 @@
|
|||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/kuaishou-merchant-open-sdk-1.0.10.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.qihangerp.open</groupId>
|
||||
<artifactId>open-sdk</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/open-sdk-1.0.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package cn.qihangerp.open.pdd.controller;
|
||||
|
||||
import cn.qihangerp.open.common.ApiResultVo;
|
||||
import cn.qihangerp.open.pdd.PddTokenApiHelper;
|
||||
import cn.qihangerp.open.pdd.domain.bo.TokenCreateBo;
|
||||
import cn.qihangerp.open.pdd.model.Token;
|
||||
import cn.qihangerp.open.service.SShopPlatformService;
|
||||
import cn.qihangerp.open.service.SShopService;
|
||||
import com.qihang.common.common.AjaxResult;
|
||||
|
|
@ -46,29 +49,16 @@ public class PddOAuthController {
|
|||
@PostMapping("/getToken")
|
||||
public AjaxResult getToken(@RequestBody TokenCreateBo bo) throws IOException, InterruptedException {
|
||||
log.info("/**********获取拼多多授权token*********/");
|
||||
// var shop = shopService.selectShopById(bo.getShopId());
|
||||
var shop = shopService.selectShopById(bo.getShopId());
|
||||
var platform = platformService.getById(EnumShopType.PDD.getIndex());
|
||||
String appKey = platform.getAppKey();
|
||||
String appSercet = platform.getAppSecret();
|
||||
|
||||
// PopAccessTokenClient accessTokenClient = new PopAccessTokenClient(appKey, appSercet);
|
||||
//
|
||||
// // 生成AccessToken
|
||||
// try {
|
||||
// AccessTokenResponse response = accessTokenClient.generate(bo.getCode());
|
||||
// if(response.getErrorResponse()!=null){
|
||||
// log.info("/***************获取拼多多授权token错误:"+response.getErrorResponse().getErrorMsg()+"**************/");
|
||||
// }else{
|
||||
// //保存accessToken
|
||||
// shopService.updateSessionKey(bo.getShopId(),response.getAccessToken());
|
||||
//
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// e.printStackTrace();
|
||||
//
|
||||
// }
|
||||
ApiResultVo<Token> token = PddTokenApiHelper.getToken(appKey, appSercet, bo.getCode());
|
||||
if(token.getCode()==0){
|
||||
shopService.updateSessionKey(shop.getId(),token.getData().getAccess_token());
|
||||
return AjaxResult.success("SUCCESS");
|
||||
}else
|
||||
return AjaxResult.error(token.getMsg());
|
||||
}
|
||||
|
||||
// /**
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class TokenCreateBo {
|
||||
private Integer shopId;
|
||||
private Long shopId;
|
||||
private Integer platform;
|
||||
private String code;
|
||||
}
|
||||
|
|
|
|||
5
pom.xml
5
pom.xml
|
|
@ -11,12 +11,9 @@
|
|||
<url>http://maven.apache.org</url>
|
||||
<modules>
|
||||
<module>sys-api</module>
|
||||
<module>api</module>
|
||||
<module>gateway</module>
|
||||
<module>core</module>
|
||||
<module>oms-api</module>
|
||||
<module>open-api2</module>
|
||||
<!-- <module>eureka-server</module>-->
|
||||
<!-- <module>gateway</module>-->
|
||||
<module>open-api</module>
|
||||
</modules>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue