小bug修复

This commit is contained in:
wangjinlei
2025-09-22 11:24:42 +08:00
parent 73ac097d01
commit c8b5f77c2a
2 changed files with 30 additions and 6 deletions

View File

@@ -47,6 +47,33 @@ class Preaccept extends Base
return jsonSuccess($re);
}
public function spiltContent(){
$data = $this->request->post();
$rule = new Validate([
"content"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$text = $data['content'];
$text = preg_replace('/(\d+)([a-zA-Z%℃°]+)/', '$1 $2', $text);
$text = preg_replace('/\s*%\s*/', '%', $text);
$pattern_en_dash = '/(\d+)(\d+)/';
$text = preg_replace($pattern_en_dash, '$1-$2', $text);
$pattern_em_dash = '/(\d+)—(\d+)/';
$text = preg_replace($pattern_em_dash, '$1-$2', $text);
}
/**清空引用文献
* @return \think\response\Json
* @throws \think\Exception