$value) { if (!isset($info[$value]) || empty($info[$value])) { return backarr(0, "请求错误"); } } foreach ($fillFieldNum as $key => $value) { if (!isset($info[$value]) || !is_numeric($info[$value])) { return backarr(0, "请求错误"); } } $label = $info['Label']; $suggestion = $info['Suggestion']; $score = $info['Score']; $type = $info['type']; $contentid = $info['DataId']; $insertData = [ 'label' => $info['Label'], 'suggestion' => $info['Suggestion'], 'score' => $info['Score'], 'contentid' => $contentid, 'createtime' => date("Y-m-d H:i:s"), ]; //招工,找活 $tablensme = ''; switch ($type) { case '1': $tablensme = "invent"; break; case '2': $tablensme = "jobhunting"; break; } $insertData['tablename'] = $tablensme; log::info($insertData); $m_s = new safenotemodel(); $id = $m_s->insertData($insertData); if (!$id) { return backarr(0, "操作失败"); } return backarr(1, "操作成功", ['id' => $id]); } public function getresult($content, $dataid = null, $userid = null) { $type = 'wc'; $data = [ 'content' => $content, 'type' => $type, ]; if ($dataid) { $data['dataid'] = $dataid; } if ($userid) { $data['userid'] = $userid; } log::info($data); $url = 'https://app.tjzhxx.cn:5443/api/tencent_cloud/safenote'; $header = ['Content-Type:application/x-www-form-urlencoded']; $result = requestCurl($url, 'post', $data, $header); log::info($result); $result = json_decode($result, true); log::info($result); if (empty($result)) { return backarr(0, "无文本校验结果"); } return $result; } //根据接口返回数据 自动审核 // public function automaticcheck($data, $type = 1, $strict = true) { if ($strict) { //相应时间段 不严格校验 //招工高峰时间段 13:00 - 17:00 //找活高峰时间段 5:00 - 10:00 $inventTime = ['0500', '1000']; $jobhuntingTime = ['1300', '1700']; $time = date('Hi'); switch ($type) { case 1: if ($time >= $inventTime[0] && $time <= $inventTime[1]) { $strict = false; } break; case 2: if ($time >= $jobhuntingTime[0] && $time <= $jobhuntingTime[1]) { $strict = false; } break; } } //总是模糊校验的label $noStrictLabel = ['Ad', 'Normal']; $label = $data['Label']; $isNoStrictLabel = false; if (in_array($label, $noStrictLabel)) { $strict = false; $isNoStrictLabel = true; } //$suggestion = $data['Suggestion']; $suggestion = 'Block'; if ($strict) { //Pass 审核通过 $allowSuggestion = ['Pass']; if (in_array($suggestion, $allowSuggestion)) { return true; } } else { //Review Pass 审核通过 $allowSuggestion = ['Review', 'Pass']; if ($isNoStrictLabel) { array_push($allowSuggestion, 'Block'); } if (in_array($suggestion, $allowSuggestion)) { return true; } } return false; } public function replaceTel($str) { if (!is_string($str)) { return false; } preg_match_all("(1[3-9]{1}\d{9})", $str, $matches); $matches = $matches[0]; if (is_array($matches)) { foreach ($matches as $key => $value) { $telno = $value; $endNum = substr($telno, -4, 4); $str = str_replace($endNum, "****", $str); } } elseif (is_string($matches)) { $telno = $matches; $endNum = substr($telno, -4, 4); $telstr = str_replace($endNum, "****", $str); $str = str_replace($telno, $telstr, $str); } return $str; } }