|
|
@@ -5,9 +5,12 @@ import com.ruoyi.common.annotation.Anonymous;
|
|
|
import com.ruoyi.system.omgpay.service.OmgIpnAuditService;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
+import org.springframework.core.io.Resource;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@@ -19,6 +22,8 @@ import java.nio.charset.StandardCharsets;
|
|
|
@RequestMapping("/pay/omg")
|
|
|
public class OmgPaymentReturnController {
|
|
|
private static final Logger log = LoggerFactory.getLogger(OmgPaymentReturnController.class);
|
|
|
+ private static final Resource UNI_APP_BRIDGE =
|
|
|
+ new ClassPathResource("static/omg/uni.webview.1.5.8.js");
|
|
|
private final OmgPaymentClientReturnService service;
|
|
|
private final OmgIpnAuditService ipnAuditService;
|
|
|
|
|
|
@@ -37,6 +42,16 @@ public class OmgPaymentReturnController {
|
|
|
return html(service.paymentResult(request));
|
|
|
}
|
|
|
|
|
|
+ @Anonymous
|
|
|
+ @GetMapping(value = "/bridge.js", produces = "application/javascript;charset=UTF-8")
|
|
|
+ public ResponseEntity<Resource> bridge() {
|
|
|
+ return ResponseEntity.ok()
|
|
|
+ .contentType(new MediaType("application", "javascript", StandardCharsets.UTF_8))
|
|
|
+ .header(HttpHeaders.CACHE_CONTROL, "no-store")
|
|
|
+ .header("X-Content-Type-Options", "nosniff")
|
|
|
+ .body(UNI_APP_BRIDGE);
|
|
|
+ }
|
|
|
+
|
|
|
private static String sourceIp(OmgNotifyRequest request) {
|
|
|
return request == null ? "unknown" : request.getSourceIp();
|
|
|
}
|