Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions edit/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
$msg = $_GET['msg'];
$ie = $_GET['image_exist'];

$res = \lib\SensitiveWordDetection::send($title.$msg);
$res = \lib\SensitiveWordDetection::sendSwc($title.$msg);

if($res['status']='00000'){
if($res['result']==true){
$rr->send(-2,"您所发的内容包含敏感词汇!",$res);
}
if($res['status']=='00000'){
// if($res['result']==true){
// $rr->send(-2,"您所发的内容包含敏感词汇!",$res);
// }
$msg = $res['result'];
}else{
$rr->send(-1,"网络错误,请稍后重试!",$res);
}
Expand Down
2 changes: 1 addition & 1 deletion getopenid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$data = $_GET;
//echo json_encode($data);
$appid="wxd8d5a2f6fa7f1878";
$appsecret="064157612113b2490b1941c7b0e77fda";
$appsecret="001gjwq00HrkqH14SDs00PXMq00gjwq4";
$code=$_GET['code'];
$get_url="https://api.weixin.qq.com/sns/jscode2session?appid=".$appid."&secret=".$appsecret."&js_code=".$code."&grant_type=authorization_code";
$get_return = file_get_contents($get_url);
Expand Down
38 changes: 36 additions & 2 deletions lib/SensitiveWordDetection.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ public function __construct()
$this->log = new \lib\Log();
}

public static function send($querys){
public static function sendSwc($querys){
$host = "http://apistore.tongchengyue.com";
// $path = "/sw/isContains";
$path = "/swc/doFilter";
$method = "POST";
$appcode = "f560138f1b514ca98e7cf8ca12a23d85";
Expand Down Expand Up @@ -56,4 +55,39 @@ public static function send($querys){
$resBody = json_decode($resBody,true);
return $resBody;
}

public static function send($querys){
$host = "http://apistore.tongchengyue.com";
$path = "/sw/isContains";
// $path = "/swc/doFilter";
$method = "POST";
$appcode = "f560138f1b514ca98e7cf8ca12a23d85";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
//根据API的要求,定义相对应的Content-Type
array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");
// $querys = "";
$bodys = "src=".$querys;
$url = $host . $path;

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
if (1 == strpos("$".$host, "https://"))
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);
$response = curl_exec($curl);
if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == '200') {
list($resHeader, $resBody) = explode("\r\n\r\n", $response, 2);
}
$resBody = json_decode($resBody,true);
return $resBody;
}
}