admin
2024-09-05 ab35ac8b769b2d9816dffb33a64f2c6f7bd5dd6e
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.yeshi.buwan.util.api;
 
import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicCOSCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.region.Region;
import com.yeshi.buwan.util.HttpUtil;
import com.yeshi.buwan.util.StringUtil;
 
/**
 * @author hxh
 * @title: 文本审核
 * @description: TODO
 * @date 2023/7/13 14:58
 */
public class StringVerifyUtil {
 
    static long appId = 1255749512L;
    static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
    static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo";
    // 设置要操作的bucket
    static String bucketName = "buwan";
    static COSClient cosClient;
    static String totalBucketName = "";
 
    static {
        COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
        ClientConfig clientConfig = new ClientConfig(new Region("ap-guangzhou"));
        cosClient = new COSClient(cred, clientConfig);
        // bucket的命名规则为{name}-{appid} ,此处填写的存储桶名称必须为此格式
        totalBucketName = bucketName + "-" + appId;
    }
 
    public static void verifyText(String text) {
        if (StringUtil.isNullOrEmpty(text)) {
            return;
        }
        String base64 = StringUtil.getBase64(text);
        String url = String.format("http://%s.ci.%s.myqcloud.com",totalBucketName,"ap-guangzhou");
        String result =  HttpUtil.post(url);
    }
 
    public static void main(String[] args){
        verifyText("习近平");
 
 
    }
 
 
}