DESKTOP-71BH0QO\L、ming
2021-04-20 26cd8c7b2bc7a725a3de28d3ed883a6f54da84f1
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
package com.panzhihua.applets.weixin;
 
import cn.binarywang.wx.miniapp.api.WxMaSecCheckService;
import com.panzhihua.applets.config.WxMaConfiguration;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 微信内容审查
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2021-02-25 10:57
 **/
@Slf4j
@Service
public class CheckService {
    @Resource
    private WxMaConfiguration wxMaConfiguration;
 
    public boolean checkMessage(String msg){
        WxMaSecCheckService wxMaSecCheckService=wxMaConfiguration.getMaService().getSecCheckService();
        try {
            boolean b = wxMaSecCheckService.checkMessage(msg);
            return b;
        } catch (WxErrorException e) {
            log.error("微信审核文字内容出错【{}】",e.getMessage());
            e.printStackTrace();
        }
        return false;
    }
}