办学质量监测教学评价系统
ageer
2024-03-01 cead269b199ed502b6dc5d9dc34e463cd7d5ffd5
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
package com.xmzs.controller;
 
import cn.dev33.satoken.annotation.SaIgnore;
import com.xmzs.common.wechat.Wechat;
import com.xmzs.system.cofing.KeywordConfig;
import com.xmzs.system.cofing.QqConfig;
import com.xmzs.system.cofing.WechatConfig;
import com.xmzs.system.handler.WechatMessageHandler;
import com.xmzs.system.service.ISseService;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * 个人微信扩展控制器
 *
 * @author WangLe
 */
@SaIgnore
@Slf4j
@Validated
@RequiredArgsConstructor
@RestController
public class WeChatController {
 
    @Getter
    private Wechat wechatBot;
 
    private final WechatConfig wechatConfig;
 
    private final ISseService sseService;
 
    private final  KeywordConfig keywordConfig;
 
    /**
     * 获取微信登录二维码
     *
     */
    @PostMapping("/getQr")
    public void getQr() {
        //微信
        if (wechatConfig.getEnable()){
            log.info("正在登录微信,请按提示操作:");
            wechatBot = new Wechat(new WechatMessageHandler(sseService, keywordConfig), wechatConfig.getQrPath());
            wechatBot.start();
        }
    }
}