1
This commit is contained in:
@@ -282,6 +282,102 @@ class Preaccept extends Base
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function positioningImage(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"am_id"=>"require",
|
||||
"ami_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||
$ami_info = $this->article_main_image_obj->where("ami_id",$data['ami_id'])->find();
|
||||
$check = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("ami_id",$data['ami_id'])->whereIn("state",[0,2])->find();
|
||||
if($check){
|
||||
return jsonError("Repeat operation");
|
||||
}
|
||||
|
||||
$sort_check = $this->article_main_obj->where("article_id",$am_info['article_id'])->whereIn("state",[0,2])->where("sort",$am_info['sort']+1)->find();
|
||||
if($sort_check){
|
||||
$this->article_main_obj->where("article_id",$am_info['article_id'])->whereIn("state",[0,2])->where("sort",">",$am_info['sort'])->inc("sort",1)->update();
|
||||
}
|
||||
$insert['article_id'] = $am_info['article_id'];
|
||||
$insert['type'] = 1;
|
||||
$insert['content'] = "<img src='https://submission.tmrjournals.com/public/articleImage/".$ami_info['url']."' imageId='".$ami_info['ami_id']."'/>";
|
||||
$insert['ami_id'] = $data['ami_id'];
|
||||
$insert['sort'] = $am_info['sort']+1;
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function removeImage(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"am_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||
if($am_info['type']!=1){
|
||||
return jsonError("error");
|
||||
}
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function removeTable(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"am_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||
if($am_info['type']!=2){
|
||||
return jsonError("error");
|
||||
}
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
|
||||
}
|
||||
|
||||
public function positioningTable(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"am_id" => "require",
|
||||
"amt_id" => "require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||
$amt_info = $this->article_main_table_obj->where("amt_id",$data['amt_id'])->find();
|
||||
$check = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("amt_id",$data['amt_id'])->whereIn('state',[0,2])->find();
|
||||
if($check){
|
||||
return jsonError("Repeat operation");
|
||||
}
|
||||
$sort_check = $this->article_main_obj->where("article_id",$amt_info['article_id'])->whereIn("state",[0,2])->where("sort",$am_info['sort']+1)->find();
|
||||
if ($sort_check){
|
||||
$this->article_main_obj->where("article_id",$am_info['article_id'])->whereIn("state",[0,2])->where('sort',">",$am_info['sort'])->inc("sort",1)->update();
|
||||
}
|
||||
$insert['article_id'] = $am_info['article_id'];
|
||||
$insert['type'] = 2;
|
||||
$insert['amt_id'] = $data['amt_id'];
|
||||
$insert["content"] = "<table tableId='".$amt_info['amt_id']."' />";
|
||||
$insert['sort'] = $am_info['sort']+1;
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**编辑refer
|
||||
* @return \think\response\Json
|
||||
* @throws \think\Exception
|
||||
@@ -337,6 +433,23 @@ class Preaccept extends Base
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function addMainsRemark(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"am_id"=>"require",
|
||||
"remark"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['remark'] = trim($data['remark']);
|
||||
$update['state'] = 2;
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function searchDoi()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
@@ -369,6 +482,23 @@ class Preaccept extends Base
|
||||
}
|
||||
|
||||
|
||||
public function mytt(){
|
||||
|
||||
$ss[] = "this id test <b>this id <sub>3</sub>test <sup>55</sup>this <i>id test</i></b> this id test this id test this id test";
|
||||
$ss[] = "this id test <b>this id <sub>3</sub>test <sup>55</sup>this <i>id test</i></b> this id test this id test this id test";
|
||||
$ss[] = "<img src='https://submission.tmrjournals.com/public/articleImage/4477/image-44089.tif'/>";
|
||||
$ss[] = "this id test <b>this id <sub>3</sub>test <sup>55</sup>this <i>id test</i></b> this id <blue>test this</blue> id test this id test";
|
||||
$ss[] = "this id test <b>this id <sub>3</sub>test <sup>55</sup>this <i>id test</i></b> this id test this id test this id test";
|
||||
|
||||
|
||||
$re['detail'] = json_encode($ss);
|
||||
|
||||
return jsonSuccess($re);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getArticleMains(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
@@ -401,6 +531,59 @@ class Preaccept extends Base
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
public function getMainImages(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$list = $this->article_main_image_obj
|
||||
->field("*,if((select am_id from t_article_main where ami_id = t_article_main_image.ami_id and state <>1)>0 ,1,0) as has_selected")
|
||||
->where("t_article_main_image.article_id",$data['article_id'])
|
||||
->where("t_article_main_image.state",0)
|
||||
->select();
|
||||
$re['list'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
public function getNotes(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$list = $this->article_main_obj->where("article_id",$data['article_id'])->where("state",2)->select();
|
||||
$re['list'] = $list;
|
||||
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
public function getMainTables(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$list = $this->article_main_table_obj
|
||||
->field("*,if((select am_id from t_article_main where amt_id = t_article_main_table.amt_id and state <>1)>0 ,1,0) as has_selected")
|
||||
->where("t_article_main_table.article_id",$data['article_id'])
|
||||
->where("t_article_main_table.state",0)
|
||||
->select();
|
||||
|
||||
$re['list'] = $list;
|
||||
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delArticleMains(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
@@ -437,13 +620,123 @@ class Preaccept extends Base
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$list = $this->article_main_obj->where("article_id",$data['article_id'])->where("state",1)->select();
|
||||
$list = $this->article_main_obj->where("article_id",$data['article_id'])->where("type",0)->where("state",1)->select();
|
||||
$re['list'] = $list;
|
||||
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
public function addMainImage(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require",
|
||||
"url"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$insert['article_id'] = $data['article_id'];
|
||||
$insert['url'] = $data['url'];
|
||||
if(isset($data['note'])){
|
||||
$insert['note'] = $data['note'];
|
||||
}
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_image_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function editMainImage(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"ami_id"=>"require",
|
||||
"url"=>"require",
|
||||
"note"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['url'] = $data['url'];
|
||||
$update['note'] = $data['note'];
|
||||
$this->article_main_image_obj->where("ami_id",$data['ami_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function addMainTable(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require",
|
||||
"table_data"=>"require",
|
||||
"title"=>"require",
|
||||
"note"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
$insert['article_id'] = $data['article_id'];
|
||||
$insert['type'] = 0;
|
||||
$insert['table_data'] = $data['table_data'];
|
||||
if(isset($data['html_data'])){
|
||||
$insert['html_data'] = $data['html_data'];
|
||||
}
|
||||
$insert['title']=$data['title'];
|
||||
$insert['note'] = $data['note'];
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_table_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function editMainTable(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"amt_id"=>"require",
|
||||
"table_data"=>"require",
|
||||
"html_data"=>"require",
|
||||
"title"=>"require",
|
||||
"note"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['table_data'] = $data['table_data'];
|
||||
$update['html_data'] = $data['html_data'];
|
||||
$update['title'] = $data['title'];
|
||||
$update['note'] = $data['note'];
|
||||
$this->article_main_table_obj->where("amt_id",$data['amt_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function up_img_mainImage(){
|
||||
$article_id = input('post.article_id');
|
||||
$file = request()->file('mainImage');
|
||||
// 检查文件是否有效
|
||||
if (!$file) {
|
||||
return jsonError("error");
|
||||
}
|
||||
|
||||
// 定义上传目录
|
||||
$uploadDir = ROOT_PATH . 'public' . DS . "articleImage".DS.$article_id;
|
||||
|
||||
// 生成自定义文件名,使用 uniqid 生成唯一的文件名
|
||||
$fileName = uniqid('file_') . '.' . pathinfo($file->getInfo("name"),PATHINFO_EXTENSION);
|
||||
|
||||
// 移动文件到指定目录,并重命名
|
||||
$info = $file->move($uploadDir, $fileName);
|
||||
|
||||
// 检查文件是否上传成功
|
||||
if ($info) {
|
||||
$re['upurl'] = $article_id."/".$fileName;
|
||||
return jsonSuccess($re);
|
||||
} else {
|
||||
return jsonError("error");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function replyArticleRecycle(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
@@ -455,7 +748,7 @@ class Preaccept extends Base
|
||||
$info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||
$check = $this->article_main_obj->where("article_id",$info['article_id'])->where("sort",$info['sort'])->whereIn("state",[0,2])->find();
|
||||
if($check){
|
||||
$this->article_main_obj->where("article_id",$data['article_id'])->where("sort",">=",$info['sort'])->inc('sort',1)->update();
|
||||
$this->article_main_obj->where("article_id",$info['article_id'])->where("sort",">=",$info['sort'])->inc('sort',1)->update();
|
||||
}
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(['state'=>0]);
|
||||
return jsonSuccess([]);
|
||||
|
||||
Reference in New Issue
Block a user