修改文章摘要加字数最低限制200,文章列表新增字段ai审核内容返回
This commit is contained in:
@@ -106,6 +106,13 @@ class Article extends Base
|
||||
->limit($limit_start, $data['pageSize'])->select();
|
||||
$count = $this->article_obj->where($where)->count();
|
||||
|
||||
//查询AI审核内容 chengxiaoling 20250328 start
|
||||
$aAiReview = array();
|
||||
if(!empty($res)){
|
||||
$aArticleId = array_column($res, 'article_id');
|
||||
$aAiReview = Db::table('t_article_ai_review')->field('article_id,content')->whereIn('article_id',$aArticleId)->column('article_id,content');
|
||||
}
|
||||
//查询AI审核内容 chengxiaoling 20250328 end
|
||||
|
||||
foreach ($res as $key => $val) {
|
||||
//查询建议转投详情
|
||||
@@ -131,6 +138,10 @@ class Article extends Base
|
||||
}
|
||||
}
|
||||
$res[$key]['proof'] = $proof_state;
|
||||
|
||||
//返回AI审核内容 chengxiaoling 20250328 start
|
||||
$res[$key]['ai_review'] = empty($aAiReview[$val['article_id']]) ? '' : $aAiReview[$val['article_id']];
|
||||
//返回AI审核内容 chengxiaoling 20250328 end
|
||||
}
|
||||
|
||||
//返回数据
|
||||
@@ -613,6 +624,13 @@ class Article extends Base
|
||||
$user_res = $this->user_obj->where(['account' => $username])->find();
|
||||
$article_old_info = $this->article_obj->where('article_id', $data['articleId'])->find();
|
||||
|
||||
|
||||
//判断简介字符串长度是否不低于200 chengxiaoling 20250327 start
|
||||
if(!$this->checkMinChars($data['abstrart'],200)){
|
||||
return jsonError("The abstract should not be less than 200 Chinese characters or English words!");
|
||||
}
|
||||
//判断简介字符串长度是否不低于200 chengxiaoling 20250327 end
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
//更新文章信息
|
||||
@@ -2482,7 +2500,6 @@ class Article extends Base
|
||||
//接受参数,查询信息
|
||||
$data = $this->request->post();
|
||||
|
||||
|
||||
$user_res = $this->user_obj->where('account', $data['username'])->find();
|
||||
|
||||
//确定用户是否属于黑名单
|
||||
@@ -2916,6 +2933,12 @@ class Article extends Base
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
//判断简介字符串长度是否不低于200 chengxiaoling 20250327 start
|
||||
if(!$this->checkMinChars($data['abstrart'],200)){
|
||||
return jsonError("The abstract should not be less than 200 Chinese characters or English words!");
|
||||
}
|
||||
//判断简介字符串长度是否不低于200 chengxiaoling 20250327 end
|
||||
|
||||
$user_info = $this->user_obj->where('user_id', $data['user_id'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id', $data['journal'])->find();
|
||||
|
||||
@@ -4254,4 +4277,19 @@ class Article extends Base
|
||||
$this->user_msg_obj->where("user_id", $data['editor_id'])->update(["state" => 1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证字符长度
|
||||
* @param $str 字符串
|
||||
* @param $num 字符长度
|
||||
* @return void
|
||||
*/
|
||||
private function checkMinChars($str = '',$num = 200) {
|
||||
// 过滤非汉字和英文的字符(保留汉字、大小写字母)
|
||||
$filteredStr = preg_replace('/[^\x{4e00}-\x{9fa5}a-zA-Z0-9]/u', '', $str);
|
||||
|
||||
// 计算有效字符总数(汉字按1个字符计,英文和数字同理)
|
||||
$total = mb_strlen($filteredStr, 'UTF-8');
|
||||
return $total >= $num;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user