101captain
2022-01-14 2bc69b919ef626e6093d598d7eae07c8f9e3e0e4
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
package com.panzhihua.applets.weixin;
 
import javax.annotation.Resource;
 
import org.springframework.stereotype.Service;
 
import com.panzhihua.applets.config.WxMaConfiguration;
 
import cn.binarywang.wx.miniapp.api.WxMaSecCheckService;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
 
/**
 * @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;
    }
}