This commit is contained in:
wangjinlei
2025-01-07 10:07:35 +08:00
parent a54a837670
commit 28a0c44dab
5 changed files with 203 additions and 73 deletions

View File

@@ -439,7 +439,7 @@ class Base extends Controller
if($refer_start&&$v!=""){
if (strlen($v) > 500) {
$refer_start = false;
$cc_t = $this->replaceChinesePunctuation($this->removeExtraSpaces(trim($v)));
$cc_t = $this->formatMain($v);
$insert['article_id'] = $article_id;
$insert['type'] = 0;
$insert['content'] = $cc_t;
@@ -455,7 +455,7 @@ class Base extends Controller
continue;
}
$c_t = $this->replaceChinesePunctuation($this->removeExtraSpaces(trim($v)));
$c_t = $this->formatMain($v);
$insert['article_id'] = $article_id;
$insert['type'] = 0;
$insert['content'] = $c_t;
@@ -574,6 +574,11 @@ class Base extends Controller
}
public function formatMain($string){
return $this->blueIntegerChange($this->replaceChinesePunctuation($this->removeExtraSpaces($string)));
}
public function replaceChinesePunctuation($str) {
// 定义中文标点和对应的英文标点替换
$replacements = [
@@ -598,6 +603,13 @@ class Base extends Controller
return str_replace(array_keys($replacements), array_values($replacements), $str);
}
public function blueIntegerChange($string){
return preg_replace_callback('/\[(\d+)\]/', function($matches) {
return '<blue>[' . $matches[1] . ']</blue>';
}, $string);
}
public function getBoardsForJournal($journal_id, $aar = false)
{
$ca_board = [];