28 lines
1.1 KiB
PHP
28 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace web\api;
|
|
|
|
class thirdapi {
|
|
static function checkbadword($wordstr, $strict = 1) {
|
|
$http = new \ciy\http();
|
|
$post = array();
|
|
$post['ColaKey'] = 'V0txKKBrP8xzyN1761587699258qq6ro7N0sC'; //2025-12-27 1:54:59 https://luckycola.com.cn/public/dist/#/userCenter
|
|
$post['wordStr'] = $wordstr;
|
|
$post['isStrict'] = $strict;
|
|
$http->request('https://luckycola.com.cn/tools/sensiWords', json_encode($post));
|
|
$result = $http->get_data();
|
|
$json = json_decode($result, true);
|
|
if ($json === null)
|
|
return '内容分析请求失败';
|
|
if ($json['code'] != 0)
|
|
return $json['msg'];
|
|
if($json['isPass'] == true)
|
|
return true;
|
|
savelogfile('bakword', $result);
|
|
return '有违禁词,不能发布';
|
|
//{"code":-99,"msg":"colaKey无效","data":{}}
|
|
//{"code":0,"msg":"检测成功","isPass":true,"data":{"words":[],"text":"asdfsadf"}}
|
|
//{"code":0,"msg":"检测成功","isPass":false,"data":{"words":["法轮","法轮大法"],"text":"法轮大法好啊啊阿萨德"}}
|
|
}
|
|
}
|