This commit is contained in:
wangjinlei
2024-08-07 15:02:14 +08:00
parent c57077e35f
commit 1f7220f36e
6 changed files with 179 additions and 23 deletions

View File

@@ -20,6 +20,37 @@ class Article extends Base
parent::__construct($request);
}
public function refusePassword()
{
$data = $this->request->post();
$rule = new Validate([
"password" => "require"
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$password = $data['password'];
if (function_exists('openssl_random_pseudo_bytes')) {
$salt = substr(str_replace('+', '.', base64_encode(openssl_random_pseudo_bytes(6))), 0, 8);
} else {
// 使用 mt_rand 作为后备方法
$salt = '';
for ($i = 0; $i < 8; $i++) {
$salt .= chr(mt_rand(33, 126)); // 生成随机字符
}
}
$hashed_password = crypt($password, '$1$' . $salt . '$');
return jsonSuccess(["result"=>$hashed_password]);
// return $hashed_password;
}
/**
* 获取文章列表(作者)
*/
@@ -1097,6 +1128,24 @@ class Article extends Base
}
public function checkArticleStart(){
$data = $this->request->post();
$rule = new Validate([
"article_id" => "require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$article_info = $this->article_obj->where("article_id",$data['article_id'])->find();
$journal_info = $this->journal_obj->where("journal_id",$article_info['journal_id'])->find();
if($article_info['scoring'] < $journal_info['kfen']){
return jsonError("The initial review score for ".$journal_info['title']." is ".$journal_info['kfen'].". The current article's initial review score is ".$article_info['scoring'].", and the manuscript will be automatically rejected while it is in the with editor status.");
}else{
return jsonSuccess([]);
}
}
/**
* @title 修改文章状态(编辑)
* @description 修改文章状态(编辑)
@@ -1768,6 +1817,10 @@ class Article extends Base
return jsonError("Invitation record already exists!");
}
if($article_info['state']==0){
return jsonError("The article can only be added in state with editor at least");
}
//增加信息到文章审稿表
$insert_data['reviewer_id'] = $data['uid'];
$insert_data['article_id'] = $data['articleId'];