whyclxw
2024-01-27 cf2df97ee7c5bb861526ef0ec9beaa174c04c872
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.lxw.test3d.controller;
 
import com.lxw.test3d.Service.SocketCmdService;
import com.lxw.test3d.dto.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@Api(tags = "socket数据通讯")
@RestController
@RequestMapping("socket")
public class SocketController {
    @Autowired
    private SocketCmdService service;
 
    @ApiOperation("启动socket通讯")
    @GetMapping("startSocket")
    public Response startSocket(@RequestParam String ip,@RequestParam int port){
        return  service.startSocket(ip,port);
    }
 
    @ApiOperation("获取socket命令")
    @GetMapping("getSocket")
    public Response getSocket(){
        int cmd= service.getCmd();
        return new Response().set(1,cmd);
    }
}