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("习近平");
|
|
|
}
|
|
|
}
|