Mr.Yang 11 months ago
parent
commit
68e2f1b527

+ 35 - 0
zfjg-gateway/src/main/java/com/zfjg/gateway/controller/VersionController.java

@@ -0,0 +1,35 @@
+package com.zfjg.gateway.controller;
+
+import com.zfjg.common.core.constant.Constants;
+import com.zfjg.gateway.config.VersionConfiguration;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Author: Mr.Yang
+ * @CreateTime: 2024-02-26
+ * @Description:
+ */
+@RestController
+@RequestMapping(value = "version")
+public class VersionController {
+
+
+    @Autowired
+    private VersionConfiguration versionConfiguration;
+
+    @GetMapping("v1")
+    public VersionConfiguration version() {
+        return versionConfiguration;
+    }
+    @GetMapping("v2")
+    public String version(ServerHttpRequest request) {
+        String req_version = request.getHeaders().getFirst(Constants.SYS_VERSION_HEANDER);
+        return req_version;
+    }
+}