From 4ce4deb4aa89b74a27ffc62bd481535456bbd034 Mon Sep 17 00:00:00 2001
From: wangjinlei <751475802@qq.com>
Date: Thu, 27 Jan 2022 18:15:35 +0800
Subject: [PATCH] 20201112
---
application/api/controller/Article.php | 44 ++++++++++++++++++----
application/api/controller/Journal.php | 5 ++-
application/master/controller/Datebase.php | 2 +-
3 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php
index 44a71ca..a340611 100644
--- a/application/api/controller/Article.php
+++ b/application/api/controller/Article.php
@@ -156,8 +156,8 @@ class Article extends Controller {
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
$res_key = [];
- $res_rel = $this->article_obj->where("article_id","in", object_to_array(json_decode($article_info['related'])))->where('state',0)->select();
- if ($article_info['keywords'] != ''&& count($res_rel)<5){
+ $res_rel = $this->article_obj->where("article_id", "in", object_to_array(json_decode($article_info['related'])))->where('state', 0)->select();
+ if ($article_info['keywords'] != '' && count($res_rel) < 5) {
$keywords = explode(',', $article_info['keywords']);
$where = '';
foreach ($keywords as $v) {
@@ -165,15 +165,43 @@ class Article extends Controller {
}
$whe = substr($where, 0, -2);
$wstr = 'journal_id = ' . $article_info['journal_id'] . ' and state = 0 and article_id<>' . $data['article_id'] . ' and (' . $whe . ')';
- $res_key = $this->article_obj->where($wstr)->limit(5-count($res_rel))->select();
+ $res_key = $this->article_obj->where($wstr)->limit(5 - count($res_rel))->select();
}
-
- $res = array_merge($res_key,$res_rel);
+
+ $res = array_merge($res_rel, $res_key);
+ $frag = [];
foreach ($res as $k => $v) {
- $res[$k]['journal'] = $this->journal_obj->where('journal_id', $v['journal_id'])->find();
- $res[$k]['stage'] = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find();
+ $frag[$v['article_id']] = $v;
+ $frag[$v['article_id']]['journal'] = $this->journal_obj->where('journal_id', $v['journal_id'])->find();
+ $frag[$v['article_id']]['stage'] = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find();
+
+ if ($frag[$v['article_id']]['stage']['stage_year'] == (date('Y') - 1)) {
+ $frag[$v['article_id']]['ysort'] = 1;
+ } else if ($frag[$v['article_id']]['stage']['stage_year'] == (date('Y') - 2)) {
+ $frag[$v['article_id']]['ysort'] = 2;
+ } else if ($frag[$v['article_id']]['stage']['stage_year'] == date('Y')) {
+ $frag[$v['article_id']]['ysort'] = 3;
+ } else {
+ $frag[$v['article_id']]['ysort'] = 4;
+ }
}
- return jsonSuccess($res);
+ $f = [];
+ foreach ($frag as $v){
+ $f[] = $v;
+ }
+
+ for ($i = 0; $i < count($f); $i++) {
+ for ($j = $i + 1; $j < count($f); $j++) {
+ if ($f[$i]['ysort'] > $f[$j]['ysort']) {
+ $tmp = $f[$j];
+ $f[$j] = $f[$i];
+ $f[$i] = $tmp;
+ }
+ }
+ }
+
+
+ return jsonSuccess($f);
}
private function sys_author($authors, $organs, $atto) {
diff --git a/application/api/controller/Journal.php b/application/api/controller/Journal.php
index 6f519c8..21a5b92 100644
--- a/application/api/controller/Journal.php
+++ b/application/api/controller/Journal.php
@@ -1066,6 +1066,7 @@ class Journal extends Controller {
$insert['journal_id'] = $data['journal_id'];
$insert['email'] = $data['email'];
$id = $this->subscribe_journal_obj->insertGetId($insert);
+ $journal_info = $this->journal_obj->where("journal_id",$data['journal_id'])->find();
//发送邮件感谢
$tt = 'Dear Researcher,
';
$tt .= 'Welcome you to the email alert for the latest research and more. Thank you for your interest in our publications and topics.
';
@@ -1075,7 +1076,7 @@ class Journal extends Controller {
$tt .= 'Email: publisher@tmrjournals.com';
$tt .= 'www.tmrjournals.com';
$maidata['email'] = $data['email'];
- $maidata['title'] = 'Traditional Medicine Research ISSN 2413-3973';
+ $maidata['title'] = $journal_info['title']." ISSN ".$journal_info['issn'];//'Traditional Medicine Research ISSN 2413-3973';
$maidata['content'] = $tt;
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
$maidata['tpassword'] = 'pRWU999999';
@@ -1118,7 +1119,7 @@ class Journal extends Controller {
$tt .= 'Email: publisher@tmrjournals.com';
$tt .= 'www.tmrjournals.com';
$maidata['email'] = $data['email'];
- $maidata['title'] = 'Traditional Medicine Research ISSN 2413-3973';
+ $maidata['title'] = $journal_info['title']." ISSN ".$journal_info['issn'];//'Traditional Medicine Research ISSN 2413-3973';
$maidata['content'] = $tt;
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
$maidata['tpassword'] = 'pRWU999999';
diff --git a/application/master/controller/Datebase.php b/application/master/controller/Datebase.php
index 6a6b7d1..7d0c3c4 100644
--- a/application/master/controller/Datebase.php
+++ b/application/master/controller/Datebase.php
@@ -220,7 +220,7 @@ class Datebase extends Controller{
*/
public function dataPush(){
$data = $this->request->post();
-// $data["journal_stage_id"] = 294;
+// $data["journal_stage_id"] = 305;
$stage_info = $this->journal_stage_obj->where("journal_stage_id",$data["journal_stage_id"])->find();
$this->createEmailFile($data["journal_stage_id"]);
$journal_info = $this->journal_obj->where("journal_id",$stage_info["journal_id"])->find();