Skip to content

Commit 478b956

Browse files
committed
feat(返回结果):控制层返回组装的BaseResult
1 parent ad015de commit 478b956

File tree

32 files changed

+84
-52
lines changed

32 files changed

+84
-52
lines changed

api-gateway/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
<artifactId>spring-cloud-starter-eureka</artifactId>
4848
</dependency>
4949

50+
<!--<dependency>-->
51+
<!--<groupId>org.springframework.cloud</groupId>-->
52+
<!--<artifactId>spring-cloud-starter-ribbon</artifactId>-->
53+
<!--</dependency>-->
54+
5055
</dependencies>
5156

5257
<dependencyManagement>

api-gateway/src/main/resources/application.properties

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ spring.application.name=api-gateway
22
server.port=9090
33
eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka
44

5+
# 禁止服务自动添加
6+
zuul.ignoredServices='*'
7+
58
zuul.routes.api-a.path=/customer/**
6-
zuul.routes.api-a.serviceId=spring-customer
9+
zuul.routes.api-a.serviceId=eureka-customer
710

811
zuul.routes.api-b.path=/order/**
9-
zuul.routes.api-b.serviceId=spring-order
12+
zuul.routes.api-b.serviceId=eureka-order
13+
14+
#ribbon.ConnectTimeout=6000
15+
#ribbon.ReadTimeout=6000
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55

66
<groupId>com.coderqian</groupId>
7-
<artifactId>spring-customer</artifactId>
7+
<artifactId>eureka-customer</artifactId>
88
<version>0.0.1-SNAPSHOT</version>
99
<packaging>jar</packaging>
1010

spring-customer/src/main/java/com/coderqian/springcustomer/SpringCustomerApplication.java renamed to eureka-customer/src/main/java/com/coderqian/eurekacustomer/EurekaCustomerApplication.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package com.coderqian.springcustomer;
1+
package com.coderqian.eurekacustomer;
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
55
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
66

77
@SpringBootApplication
88
@EnableEurekaClient
9-
public class SpringCustomerApplication {
9+
public class EurekaCustomerApplication {
1010

1111
public static void main(String[] args) {
12-
SpringApplication.run(SpringCustomerApplication.class, args);
12+
SpringApplication.run(EurekaCustomerApplication.class, args);
1313
}
1414
}

spring-customer/src/main/java/com/coderqian/springcustomer/common/BaseResult.java renamed to eureka-customer/src/main/java/com/coderqian/eurekacustomer/common/BaseResult.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
package com.coderqian.springcustomer.common;
2-
3-
import com.coderqian.springcustomer.util.DateUtils;
1+
package com.coderqian.eurekacustomer.common;
42

53
/**
64
* @author qianliqing

spring-customer/src/main/java/com/coderqian/springcustomer/common/constant/Code.java renamed to eureka-customer/src/main/java/com/coderqian/eurekacustomer/common/constant/Code.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.coderqian.springcustomer.common.constant;
1+
package com.coderqian.eurekacustomer.common.constant;
22

33
/**
44
* @author qianliqing

spring-customer/src/main/java/com/coderqian/springcustomer/common/exception/BaseException.java renamed to eureka-customer/src/main/java/com/coderqian/eurekacustomer/common/exception/BaseException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.coderqian.springcustomer.common.exception;
1+
package com.coderqian.eurekacustomer.common.exception;
22

3-
import com.coderqian.springcustomer.common.BaseResult;
3+
import com.coderqian.eurekacustomer.common.BaseResult;
44

55
/**
66
* @author qianliqing

spring-customer/src/main/java/com/coderqian/springcustomer/common/exception/BusinessException.java renamed to eureka-customer/src/main/java/com/coderqian/eurekacustomer/common/exception/BusinessException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package com.coderqian.springcustomer.common.exception;
1+
package com.coderqian.eurekacustomer.common.exception;
22

3-
import com.coderqian.springcustomer.common.BaseResult;
4-
import com.coderqian.springcustomer.common.constant.Code;
3+
import com.coderqian.eurekacustomer.common.BaseResult;
4+
import com.coderqian.eurekacustomer.common.constant.Code;
55

66
/**
77
* @author qianliqing

spring-customer/src/main/java/com/coderqian/springcustomer/common/exception/GlobalExceptionHandlerAdvice.java renamed to eureka-customer/src/main/java/com/coderqian/eurekacustomer/common/exception/GlobalExceptionHandlerAdvice.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package com.coderqian.springcustomer.common.exception;
1+
package com.coderqian.eurekacustomer.common.exception;
22

3-
import com.coderqian.springcustomer.common.BaseResult;
4-
import com.coderqian.springcustomer.util.LogUtils;
3+
import com.coderqian.eurekacustomer.common.BaseResult;
4+
import com.coderqian.eurekacustomer.util.LogUtils;
55
import org.springframework.web.bind.annotation.ExceptionHandler;
66
import org.springframework.web.bind.annotation.ResponseBody;
77
import org.springframework.web.bind.annotation.RestControllerAdvice;

0 commit comments

Comments
 (0)