洪城义警-正式版后台
zengh
2021-08-13 ccc6e51f22bf0b2b0cebb84e32f55a5cebdb9692
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package org.springblade.modules.webscoket.controller;
 
import org.springblade.core.tool.api.R;
import org.springblade.modules.webscoket.service.IPushMsgService;
import org.springframework.beans.factory.annotation.Autowired;
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;
 
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
 
/**
 * @author lq
 * @date 2020/4/1 11:22
 */
@RestController
@RequestMapping("pushMsg")
public class PushMsgController {
 
    @Autowired
    private IPushMsgService pushMsgService;
 
    @PostMapping("/pushUser")
    public String pushUser(String userId, String msg) {
        pushMsgService.pushMsg(userId, msg);
        return "消息发送成功:" + msg;
    }
 
    @PostMapping("/pushAll")
    public String pushAll(String msg) {
        pushMsgService.pushMsg(msg);
        return "消息发送成功:" + msg;
    }
 
    @GetMapping("/inviteVideoCall")
    public R<Map> inviteVideoCall(String userId, String type, String name,String faqiid) {
        //获取当前时间戳作为房间号
        String roomId = "";
        Map<String, Object> map = new HashMap<String, Object>();
        String time = String.valueOf(new Date().getTime());
        int msg = pushMsgService.inviteVideoCall(userId, time, type, name,faqiid);
        map.put("type", type);
        map.put("roomId", time);
        map.put("res", msg);
 
        return R.data(map);
    }
 
    @GetMapping("/closeVideoCall")
    public void closeVideoCall(String sentId, String acceptId) {
 
        pushMsgService.closeVideoCall(sentId, acceptId);
 
    }
 
}