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