20201112
This commit is contained in:
@@ -106,6 +106,39 @@ class Article extends Controller {
|
||||
$re['cite'] = $cite;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取关键词相关文章
|
||||
* @description 获取关键词相关文章
|
||||
* @author wangjinlei
|
||||
* @url /api/Article/getArticleByKeywords
|
||||
* @method POST
|
||||
*
|
||||
* @param name:article_id type:int require:1 desc:文章id
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function getArticleByKeywords(){
|
||||
$data = $this->request->post();
|
||||
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
||||
if($article_info['keywords']==''){
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
$keywords = explode(',', $article_info['keywords']);
|
||||
$where = '';
|
||||
foreach ($keywords as $v){
|
||||
$where .= ' keywords like "%'.$v.'%" or';
|
||||
}
|
||||
$whe = substr($where,0, -2);
|
||||
$wstr = 'journal_id = '.$article_info['journal_id'].' and state = 0 and article_id<>'.$data['article_id'].' and ('.$whe.')';
|
||||
$res = $this->article_obj->where($wstr)->limit(5)->select();
|
||||
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();
|
||||
}
|
||||
return jsonSuccess($res);
|
||||
}
|
||||
|
||||
private function sys_author($authors, $organs, $atto) {
|
||||
$cache = [];
|
||||
foreach ($organs as $k => $v) {
|
||||
@@ -195,17 +228,6 @@ class Article extends Controller {
|
||||
return $frag;
|
||||
}
|
||||
|
||||
// private function getAuthor($article){
|
||||
// $where['article_id'] = $article['article_id'];
|
||||
// $where['state'] = 0;
|
||||
// $list = $this->article_author_obj->where($where)->select();
|
||||
// $frag = '';
|
||||
// foreach ($list as $k=>$v){
|
||||
// $frag .= $v['author_name'].',';
|
||||
// }
|
||||
// return substr($frag,0, -1);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @title 获取stage文章列表
|
||||
* @description 获取stage文章列表
|
||||
@@ -605,19 +627,4 @@ class Article extends Controller {
|
||||
return $st[2].'/'.$yf.'/'.$st[0].'/';
|
||||
}
|
||||
|
||||
|
||||
// public function ggname(){
|
||||
// $list = $this->article_author_obj->where('article_author_id >= 1500')->select();
|
||||
// foreach ($list as $v){
|
||||
// $cache = explode(' ', $v['author_name']);
|
||||
// $first = str_replace('-', '', $cache[0]);
|
||||
// $last = isset($cache[1])?$cache[1]:'';
|
||||
// $this->article_author_obj->where('article_author_id',$v['article_author_id'])->update(['first_name'=>$first,'last_name'=>$last]);
|
||||
// }
|
||||
// echo '<pre>';
|
||||
// var_dump($list);
|
||||
// echo '</pre>';
|
||||
// die;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -125,6 +125,22 @@ class Journal extends Controller {
|
||||
return json(['code' => 0, 'msg' => 'success', 'data' => ['journal' => $journal_info, 'relats' => $relatelist, 'journalAbs' => $absList, 'journalStage' => $stageList]]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊信息通过issn
|
||||
* @description 获取期刊信息通过issn
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getJournalByIssn
|
||||
* @method POST
|
||||
*
|
||||
* @param name:issn type:string require:1 desc:issn号
|
||||
*
|
||||
*/
|
||||
public function getJournalByIssn(){
|
||||
$data = $this->request->post();
|
||||
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
|
||||
return jsonSuccess($journal_info);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊话题
|
||||
* @description 获取期刊话题
|
||||
@@ -724,13 +740,6 @@ class Journal extends Controller {
|
||||
public function getTopicForSubscribe() {
|
||||
$data = $this->request->post();
|
||||
$list = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('state', 0)->where('level', 2)->select();
|
||||
// $pids = [];
|
||||
// foreach ($list as $k => $v){
|
||||
// if(!in_array($v['parent_id'], $pids)){
|
||||
// $pids[] = $v['parent_id'];
|
||||
// }
|
||||
// }
|
||||
// $tlist = $this->journal_topic_obj->where('journal_topic_id','in',$pids)->where('state',0)->select();
|
||||
|
||||
$re['topics'] = $list;
|
||||
return jsonSuccess($re);
|
||||
@@ -778,6 +787,49 @@ class Journal extends Controller {
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加期刊订阅通过issn
|
||||
* @description 添加期刊订阅通过issn
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/addSubscribeByIssn
|
||||
* @method POST
|
||||
*
|
||||
* @param name:issn type:string require:1 desc:issn号
|
||||
* @param name:email type:string require:1 desc:邮件地址
|
||||
*/
|
||||
public function addSubscribeByIssn(){
|
||||
$data = $this->request->post();
|
||||
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
|
||||
//去重
|
||||
$repeat = $this->subscribe_journal_obj
|
||||
->where('journal_id', $journal_info['journal_id'])
|
||||
->where('email', $data['email'])
|
||||
->where('state', 0)
|
||||
->find();
|
||||
if ($repeat) {
|
||||
return jsonError('repeat subscribe!');
|
||||
}
|
||||
$insert['journal_id'] = $journal_info['journal_id'];
|
||||
$insert['email'] = $data['email'];
|
||||
$id = $this->subscribe_journal_obj->insertGetId($insert);
|
||||
//发送邮件感谢
|
||||
$tt = 'Dear Researcher,<br><br>';
|
||||
$tt .= 'Welcome you to the email alert for the latest research and more. Thank you for your interest in our publications and topics.<br>';
|
||||
$tt .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeJournal/snum/' . $id . '">Unsubscribe</a><br>';
|
||||
$tt .= 'This service is provided by TMR Publishing Group | New Zealand<br>';
|
||||
$tt .= 'Telephone: +64 02108293806';
|
||||
$tt .= 'Email: publisher@tmrjournals.com';
|
||||
$tt .= 'www.tmrjournals.com';
|
||||
$maidata['email'] = $data['email'];
|
||||
$maidata['title'] = 'Traditional Medicine Research ISSN 2413-3973';
|
||||
$maidata['content'] = $tt;
|
||||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||||
$maidata['tpassword'] = 'pRWU999999';
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function pushEmail(){
|
||||
die;
|
||||
$list = $this->subscribe_journal_obj->where('journal_id',1)->select();
|
||||
@@ -911,12 +963,15 @@ class Journal extends Controller {
|
||||
// phpinfo();die;
|
||||
|
||||
|
||||
$tt = 'mytestemail.';
|
||||
$tt = '<form action="https://www.baidu.com" method="post">
|
||||
Email: <input type="text" name="fname"><br>
|
||||
<input type="submit" value="提交">
|
||||
</form>';
|
||||
$maidata['email'] = '751475802@qq.com';
|
||||
$maidata['title'] = '测试邮件1';
|
||||
$maidata['title'] = 'test';
|
||||
$maidata['content'] = $tt;
|
||||
$maidata['tmail'] = 'tmr@tmrjournals.com';
|
||||
$maidata['tpassword'] = 'Wu999999tm';
|
||||
$maidata['tpassword'] = 'Wu9999999999';
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
}
|
||||
|
||||
|
||||
@@ -568,20 +568,9 @@ class Main extends Controller {
|
||||
$ip_obj = new iplimit();
|
||||
$re['country'] = $ip_obj->setup($data['ip']);
|
||||
return jsonSuccess($re);
|
||||
// $ip_obj = new IpLocation('UTFWry.dat');
|
||||
// $res = $ip_obj->getlocation($data['ip']);
|
||||
// return jsonSuccess($res);
|
||||
}
|
||||
|
||||
|
||||
// public function checkIp(){
|
||||
// $ip_obj = new iplimit();
|
||||
// $res = $ip_obj->setup('180.149.130.16');
|
||||
// echo '<pre>';
|
||||
// var_dump($res);
|
||||
// echo '</pre>';
|
||||
// die;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,25 @@ function authcode($str) {
|
||||
return md5($key . $str1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象 转 数组
|
||||
*
|
||||
* @param object $obj 对象
|
||||
* @return array
|
||||
*/
|
||||
function object_to_array($obj) {
|
||||
$obj = (array)$obj;
|
||||
foreach ($obj as $k => $v) {
|
||||
if (gettype($v) == 'resource') {
|
||||
return;
|
||||
}
|
||||
if (gettype($v) == 'object' || gettype($v) == 'array') {
|
||||
$obj[$k] = (array)object_to_array($v);
|
||||
}
|
||||
}
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @function sendEmail
|
||||
* @intro 发送邮件(带附件)
|
||||
|
||||
@@ -153,6 +153,9 @@ class Publish extends Controller{
|
||||
* @param name:end type:string require:1 desc:结束时间
|
||||
*
|
||||
* @return dates:数据@
|
||||
* @dates SGRSL:审稿人数量
|
||||
* @dates SUBJOURNAL:订阅期刊数
|
||||
* @dates SUBTOPIC:订阅话题数
|
||||
* @dates LYL:录用率
|
||||
* @dates CC:查重
|
||||
* @dates WS:外审
|
||||
@@ -162,8 +165,14 @@ class Publish extends Controller{
|
||||
$data = $this->request->post();
|
||||
$pa['start'] = $data['start'];
|
||||
$pa['end'] = $data['end'];
|
||||
$res = myPost(self::TJ_URL,$pa);
|
||||
return $res;
|
||||
$res = $this->object_to_array(json_decode(myPost(self::TJ_URL,$pa)));
|
||||
foreach ($res as $k =>$v){
|
||||
$cache_info = $this->journal_obj->where('issn',$v['issn'])->find();
|
||||
$res[$k]['SUBJOURNAL'] = $this->subscribe_journal_obj->where('journal_id',$cache_info['journal_id'])->where('state',0)->count();
|
||||
$topics = $this->journal_topic_obj->where('journal_id',$cache_info['journal_id'])->where('state',0)->column('journal_topic_id');
|
||||
$res[$k]['SUBTOPIC'] = $this->subscribe_topic_obj->where('topic_id','in',$topics)->where('state',0)->count();
|
||||
}
|
||||
return jsonSuccess($res) ;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user