Procházet zdrojové kódy

account-service 添加 AccountRtmpController 作为 nginx-rtmp 的鉴权回调

reghao před 6 měsíci
rodič
revize
036295e2d3

+ 69 - 0
account/account-service/src/main/java/cn/reghao/tnb/account/app/controller/AccountRtmpController.java

@@ -0,0 +1,69 @@
+package cn.reghao.tnb.account.app.controller;
+
+import cn.reghao.tnb.account.app.model.vo.RtmpPlay;
+import cn.reghao.tnb.account.app.model.vo.RtmpRecord;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author reghao
+ * @date 2025-09-14 09:46:22
+ */
+@Tag(name = "nginx-rtmp 回调接口")
+@RestController
+@RequestMapping("/api/auth/rtmp")
+@Slf4j
+public class AccountRtmpController {
+    @Operation(summary = "rtmp publish 回调", description = "N")
+    @PostMapping(value = "/on_publish", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity<String> rtmpOnPublish(RtmpPlay rtmpPlay) {
+        log.info("rtmp publish event...");
+        int statusCode = HttpStatus.OK.value();
+        int statusCode1 = HttpStatus.UNAUTHORIZED.value();
+        String body = "";
+        return ResponseEntity.status(statusCode).body(body);
+    }
+
+    @Operation(summary = "rtmp publish done 回调", description = "N")
+    @PostMapping(value = "/on_publish_done", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity<String> rtmpOnPublishDone(RtmpPlay rtmpPlay) {
+        log.info("rtmp publish done event...");
+        int statusCode = 200;
+        String body = "";
+        return ResponseEntity.status(statusCode).body(body);
+    }
+
+    @Operation(summary = "rtmp play 回调", description = "N")
+    @PostMapping(value = "/on_play", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity<String> rtmpOnPlay(RtmpPlay rtmpPlay) {
+        log.info("rtmp play event...");
+        int statusCode = 200;
+        String body = "";
+        return ResponseEntity.status(statusCode).body(body);
+    }
+
+    @Operation(summary = "rtmp play done 回调", description = "N")
+    @PostMapping(value = "/on_play_done", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity<String> rtmpOnPlayDone(RtmpPlay rtmpPlay) {
+        log.info("rtmp play done event...");
+        int statusCode = 200;
+        String body = "";
+        return ResponseEntity.status(statusCode).body(body);
+    }
+
+    @Operation(summary = "rtmp record done 回调", description = "N")
+    @PostMapping(value = "/on_record_done", produces = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity<String> rtmpOnRecordDone(RtmpRecord rtmpRecord) {
+        log.info("rtmp record done event...");
+        int statusCode = 200;
+        String body = "";
+        return ResponseEntity.status(statusCode).body(body);
+    }
+}

+ 22 - 0
account/account-service/src/main/java/cn/reghao/tnb/account/app/model/vo/RtmpPlay.java

@@ -0,0 +1,22 @@
+package cn.reghao.tnb.account.app.model.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author reghao
+ * @date 2025-09-14 10:08:39
+ */
+@Setter
+@Getter
+public class RtmpPlay {
+    private String call;
+    private String addr;
+    private String clientid;
+    private String app;
+    private String name;
+    private String flashVer;
+    private String swfUrl;
+    private String tcUrl;
+    private String pageUrl;
+}

+ 15 - 0
account/account-service/src/main/java/cn/reghao/tnb/account/app/model/vo/RtmpRecord.java

@@ -0,0 +1,15 @@
+package cn.reghao.tnb.account.app.model.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author reghao
+ * @date 2025-09-14 10:12:42
+ */
+@Setter
+@Getter
+public class RtmpRecord {
+    private String recorder;
+    private String path;
+}