1
This commit is contained in:
@@ -391,151 +391,6 @@ class Admin extends Controller {
|
|||||||
return json($res);
|
return json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导入reviewer
|
|
||||||
*/
|
|
||||||
public function reviewerImport() {
|
|
||||||
|
|
||||||
die("server stoped");
|
|
||||||
//接收信息
|
|
||||||
$data = $this->request->post();
|
|
||||||
|
|
||||||
// $data['journal'] = 5;
|
|
||||||
// $data['url'] = 'reviewer/import/20210819/beb6de5c69e4878d995fd8de192d17af.xlsx';
|
|
||||||
|
|
||||||
$journal = $data['journal'];
|
|
||||||
$journal_info = $this->journal_obj->where('journal_id', $journal)->find();
|
|
||||||
|
|
||||||
//读取excel
|
|
||||||
$path = ROOT_PATH . 'public' . DS . $data['url'];
|
|
||||||
$frag = self::readExcel($path);
|
|
||||||
|
|
||||||
//check数据分开存储
|
|
||||||
$su_data = [];
|
|
||||||
$er_data = [];
|
|
||||||
foreach ($frag as $v) {
|
|
||||||
|
|
||||||
if($v['username']==''){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//验证数据完整性
|
|
||||||
if ($v['username'] == '' || $v['email'] == '' || $v['realname'] == '' || $v['major'] == '' || $v['username'] == null || $v['email'] == null || $v['realname'] == null || $v['major'] == null) {
|
|
||||||
$er_data[] = [
|
|
||||||
'username' => trim($v['username']),
|
|
||||||
'realname' => trim($v['realname']),
|
|
||||||
'email' => $v['email'],
|
|
||||||
'reason' => 'Missing data'
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//验证major
|
|
||||||
$major = self::get_major($v['major']);
|
|
||||||
if ($major === null) {
|
|
||||||
$er_data[] = [
|
|
||||||
'username' => trim($v['username']),
|
|
||||||
'realname' => trim($v['realname']),
|
|
||||||
'email' => $v['email'],
|
|
||||||
'reason' => 'major is error'
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//验证是否存在此用户并且存在对应关系
|
|
||||||
$this_reviewer = self::get_username(trim($v['username']));
|
|
||||||
$mme = self::get_userByEmail(trim($v['email']));
|
|
||||||
if ($this_reviewer == null && $mme != null) {
|
|
||||||
$er_data[] = [
|
|
||||||
'username' => trim($v['username']),
|
|
||||||
'realname' => trim($v['realname']),
|
|
||||||
'email' => $v['email'],
|
|
||||||
'reason' => 'Email occupied,and username is:'.$mme['account']
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ($this_reviewer != null && $this_reviewer['type'] == 2) {
|
|
||||||
$er_data[] = [
|
|
||||||
'username' => $v['username'],
|
|
||||||
'realname' => $v['realname'],
|
|
||||||
'email' => $v['email'],
|
|
||||||
'reason' => "Editor can't become reviewer"
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ($this_reviewer != null && self::get_retojo($this_reviewer['user_id'], $journal) != null) {
|
|
||||||
$su_data[] = [
|
|
||||||
'username' => trim($v['username']),
|
|
||||||
'realname' => trim($v['realname']),
|
|
||||||
'email' => $v['email'],
|
|
||||||
'reason' => 'success(has register)'
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//执行存储,按实际逻辑存储
|
|
||||||
$cache_id = 0;
|
|
||||||
if ($this_reviewer == null) {
|
|
||||||
//添加user主体基本信息
|
|
||||||
$cache_reviewer['account'] = trim($v['username']);
|
|
||||||
$cache_reviewer['password'] = md5('123456qwe');
|
|
||||||
$cache_reviewer['email'] = trim($v['email']);
|
|
||||||
$cache_reviewer['realname'] = trim($v['realname']);
|
|
||||||
$cache_reviewer['is_reviewer'] = 1;
|
|
||||||
$cache_reviewer['ctime'] = time();
|
|
||||||
$cache_id = $this->user_obj->insertGetId($cache_reviewer);
|
|
||||||
//添加reviewer_info信息
|
|
||||||
$cache_insert_info['reviewer_id'] = $cache_id;
|
|
||||||
$cache_insert_info['gender'] = $v['gender'] == '女' ? 2 : 1;
|
|
||||||
$cache_insert_info['technical'] = $v['technical'] == null ? '' : $v['technical'];
|
|
||||||
$cache_insert_info['country'] = $v['country'] == null ? '' : $v['country'];
|
|
||||||
$cache_insert_info['introduction'] = $v['introduction'] == null ? '' : $v['introduction'];
|
|
||||||
$cache_insert_info['company'] = $v['company'] == null ? '' : $v['company'];
|
|
||||||
$cache_insert_info['major'] = $major['major_id'];
|
|
||||||
$cache_insert_info['field'] = $v['field'] == null ? '' : $v['field'];
|
|
||||||
$this->user_reviewer_info_obj->insert($cache_insert_info);
|
|
||||||
} else if ($this_reviewer != null && $this_reviewer['is_reviewer'] == 0) {
|
|
||||||
$this->user_obj->where('user_id', $this_reviewer['user_id'])->update(['is_reviewer' => 1]);
|
|
||||||
//添加reviewer_info信息
|
|
||||||
$cache_insert_info['reviewer_id'] = $this_reviewer['user_id'];
|
|
||||||
$cache_insert_info['gender'] = $v['gender'] == '女' ? 2 : 1;
|
|
||||||
$cache_insert_info['technical'] = $v['technical'] == null ? '' : $v['technical'];
|
|
||||||
$cache_insert_info['country'] = $v['country'] == null ? '' : $v['country'];
|
|
||||||
$cache_insert_info['introduction'] = $v['introduction'] == null ? '' : $v['introduction'];
|
|
||||||
$cache_insert_info['company'] = $v['company'] == null ? '' : $v['company'];
|
|
||||||
$cache_insert_info['major'] = $major['major_id'];
|
|
||||||
$cache_insert_info['field'] = $v['field'] == null ? '' : $v['field'];
|
|
||||||
$this->user_reviewer_info_obj->insert($cache_insert_info);
|
|
||||||
}
|
|
||||||
//存储关系表信息
|
|
||||||
$cache_insert_rtj['reviewer_id'] = $this_reviewer == null ? $cache_id : $this_reviewer['user_id'];
|
|
||||||
$cache_insert_rtj['journal_id'] = $journal;
|
|
||||||
$cache_insert_rtj['account'] = trim($v['username']);
|
|
||||||
$cache_insert_rtj['journal_title'] = $journal_info['title'];
|
|
||||||
$cache_insert_rtj['ctime'] = time();
|
|
||||||
$this->reviewer_to_journal_obj->insert($cache_insert_rtj);
|
|
||||||
|
|
||||||
//增加成功信息
|
|
||||||
$su_data[] = [
|
|
||||||
'username' => trim($v['username']),
|
|
||||||
'realname' => trim($v['realname']),
|
|
||||||
'email' => $v['email'],
|
|
||||||
'reason' => 'success'
|
|
||||||
];
|
|
||||||
|
|
||||||
//发送邮件提醒审稿人
|
|
||||||
$content = "Thank you for registering as a " . $journal_info['title'] . " reviewer<br/>". "At present, you have passed our examination<br/>";
|
|
||||||
$content .= '<a href="https://submission.tmrjournals.com">Submission System</a><br>';
|
|
||||||
$content .= '<p>username:' . trim($v['username']) . '</p>';
|
|
||||||
$content .= '<p>Original Password: 123456qwe</p>';//$has_res ? '' : '<p>password:123456qwe</p>';
|
|
||||||
|
|
||||||
$maidata['email'] = $v['email'];
|
|
||||||
$maidata['title'] = $journal_info['title'];
|
|
||||||
$maidata['content'] = $content;
|
|
||||||
$maidata['tmail'] = $journal_info['email'];
|
|
||||||
$maidata['tpassword'] = $journal_info['epassword'];
|
|
||||||
Queue::push( 'app\api\job\mail@fire' , $maidata , "tmail" );
|
|
||||||
}
|
|
||||||
return json(['sudata' => $su_data, 'erdata' => $er_data]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取领域分类
|
* 获取领域分类
|
||||||
|
|||||||
@@ -1478,7 +1478,7 @@ class Article extends Controller {
|
|||||||
public function addRecommentReviewer($reivewe,$journal_id,$user_id,$article_id){
|
public function addRecommentReviewer($reivewe,$journal_id,$user_id,$article_id){
|
||||||
$journal_info = $this->journal_obj->where('journal_id',$journal_id)->find();
|
$journal_info = $this->journal_obj->where('journal_id',$journal_id)->find();
|
||||||
//判断此用户是否存在
|
//判断此用户是否存在
|
||||||
$reviewer_info = $this->user_obj->where('email', $reivewe['email'])->where('state', 0)->find();
|
$reviewer_info = $this->user_obj->where('email', trim($reivewe['email']))->where('state', 0)->find();
|
||||||
if ($reviewer_info == null) { //添加用户
|
if ($reviewer_info == null) { //添加用户
|
||||||
$insert_user['account'] = $reivewe['email'];
|
$insert_user['account'] = $reivewe['email'];
|
||||||
$insert_user['password'] = md5('123456qwe');
|
$insert_user['password'] = md5('123456qwe');
|
||||||
@@ -1768,6 +1768,9 @@ class Article extends Controller {
|
|||||||
->join('t_user_reviewer_info', 't_article_reviewer.reviewer_id = t_user_reviewer_info.reviewer_id', 'LEFT')
|
->join('t_user_reviewer_info', 't_article_reviewer.reviewer_id = t_user_reviewer_info.reviewer_id', 'LEFT')
|
||||||
->join('t_reviewer_major', 't_reviewer_major.major_id = t_user_reviewer_info.major', 'LEFT')
|
->join('t_reviewer_major', 't_reviewer_major.major_id = t_user_reviewer_info.major', 'LEFT')
|
||||||
->where($where)->limit($limit_start, $data['pageSize'])->select();
|
->where($where)->limit($limit_start, $data['pageSize'])->select();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$count = $this->article_reviewer_obj->where($where)->count();
|
$count = $this->article_reviewer_obj->where($where)->count();
|
||||||
if ($res) {
|
if ($res) {
|
||||||
return json(['code' => 0, 'data' => $res, 'totle' => $count]);
|
return json(['code' => 0, 'data' => $res, 'totle' => $count]);
|
||||||
|
|||||||
@@ -50,47 +50,47 @@ class Inbox extends Controller{
|
|||||||
|
|
||||||
$insertData=[];
|
$insertData=[];
|
||||||
|
|
||||||
foreach ($emailNums as $key=>$value){
|
// foreach ($emailNums as $key=>$value){
|
||||||
|
|
||||||
//2.1 获取邮件头部信息
|
// //2.1 获取邮件头部信息
|
||||||
$head = $server->getHeaders($value);
|
// $head = $server->getHeaders($value);
|
||||||
|
|
||||||
//2.2 处理邮件附件
|
// //2.2 处理邮件附件
|
||||||
$files = $server->getAttach($value);
|
// $files = $server->getAttach($value);
|
||||||
// 附件
|
// // 附件
|
||||||
$head['url'] =[];
|
// $head['url'] =[];
|
||||||
|
|
||||||
//2.3 处理正文中的图片
|
// //2.3 处理正文中的图片
|
||||||
$imageList=array();
|
// $imageList=array();
|
||||||
$section = 2;
|
// $section = 2;
|
||||||
if($files){
|
// if($files){
|
||||||
foreach($files as $k => $file)
|
// foreach($files as $k => $file)
|
||||||
{
|
// {
|
||||||
|
|
||||||
//type=1为附件,0为邮件内容图片
|
// //type=1为附件,0为邮件内容图片
|
||||||
if($file['type'] == 0)
|
// if($file['type'] == 0)
|
||||||
{
|
// {
|
||||||
$imageList[$k]=$file['pathname'];
|
// $imageList[$k]=$file['pathname'];
|
||||||
}
|
// }
|
||||||
|
|
||||||
if($file['type'] == 1)
|
// if($file['type'] == 1)
|
||||||
{
|
// {
|
||||||
array_push($head['url'],$file['url']);
|
// array_push($head['url'],$file['url']);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(($file['type'] == 0 || $file['type'] == 1) && !empty($file['url'])){
|
// if(($file['type'] == 0 || $file['type'] == 1) && !empty($file['url'])){
|
||||||
|
|
||||||
$section = 1.2 ;
|
// $section = 1.2 ;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
$webPath = ROOT_PATH.'public' . DS . 'contentImg' . DS . date('Ymd') .DS ;
|
// $webPath = ROOT_PATH.'public' . DS . 'contentImg' . DS . date('Ymd') .DS ;
|
||||||
// 正文内容
|
// // 正文内容
|
||||||
$head['content'] = $server->getBody($value,$webPath,$imageList,$section);
|
// $head['content'] = $server->getBody($value,$webPath,$imageList,$section);
|
||||||
array_push($insertData,$head);
|
// array_push($insertData,$head);
|
||||||
}
|
// }
|
||||||
$this->insertData($insertData,$journal);
|
$this->insertData($insertData,$journal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -548,7 +548,7 @@ class Special extends Controller
|
|||||||
$journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
|
$journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
//判断此用户是否存在
|
//判断此用户是否存在
|
||||||
$reviewer_info = $this->user_obj->where('email', $data['email'])->where('state', 0)->find();
|
$reviewer_info = $this->user_obj->where('email', trim($data['email']))->where('state', 0)->find();
|
||||||
if ($reviewer_info == null) { //添加用户
|
if ($reviewer_info == null) { //添加用户
|
||||||
$insert_user['account'] = $data['email'];
|
$insert_user['account'] = $data['email'];
|
||||||
$insert_user['password'] = md5('123456qwe');
|
$insert_user['password'] = md5('123456qwe');
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ use think\Validate;
|
|||||||
* @title 公共管理相关
|
* @title 公共管理相关
|
||||||
* @description 公共管理相关
|
* @description 公共管理相关
|
||||||
*/
|
*/
|
||||||
class Typeset extends Controller {
|
class Typeset extends Controller
|
||||||
|
{
|
||||||
protected $article_obj = '';
|
protected $article_obj = '';
|
||||||
protected $user_obj = '';
|
protected $user_obj = '';
|
||||||
protected $user_act_obj = '';
|
protected $user_act_obj = '';
|
||||||
@@ -38,7 +39,8 @@ class Typeset extends Controller {
|
|||||||
protected $ts_obj = '';
|
protected $ts_obj = '';
|
||||||
protected $ts_refer_obj = '';
|
protected $ts_refer_obj = '';
|
||||||
|
|
||||||
public function __construct(\think\Request $request = null) {
|
public function __construct(\think\Request $request = null)
|
||||||
|
{
|
||||||
parent::__construct($request);
|
parent::__construct($request);
|
||||||
$this->user_obj = Db::name('user');
|
$this->user_obj = Db::name('user');
|
||||||
$this->user_act_obj = Db::name('user_act');
|
$this->user_act_obj = Db::name('user_act');
|
||||||
@@ -67,64 +69,422 @@ class Typeset extends Controller {
|
|||||||
$this->ts_refer_obj = Db::name('ts_refer');
|
$this->ts_refer_obj = Db::name('ts_refer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTypeSet()
|
||||||
public function createTypeSet(){
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
// 验证规则
|
// 验证规则
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'article_id'=>'require|number'
|
'article_id' => 'require|number'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
|
||||||
|
$ts_info = $this->ts_obj->where('article_id', $article_info['article_id'])->where('ts_state', 0)->find();
|
||||||
|
if (!$ts_info) {
|
||||||
|
return jsonError('get ts error');
|
||||||
|
}
|
||||||
|
$refers = $this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_state', 0)->select();
|
||||||
|
$ts_info['references'] = $refers;
|
||||||
|
$re['ts'] = $ts_info;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取排版实例列表
|
||||||
|
*/
|
||||||
|
public function getTsList()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'editor_id' => 'require|number',
|
||||||
|
'journal_id' => 'require',
|
||||||
|
'ts_state' => 'require',
|
||||||
|
'pageIndex' => 'require',
|
||||||
|
'pageSize' => 'require'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$journals = [];
|
||||||
|
if ($data['journal_id'] == 0) { //获取全部编辑名下的期刊
|
||||||
|
$journals = $this->journal_obj->where('editor_id', $data['editor_id'])->where('state', 0)->column('journal_id');
|
||||||
|
} else {
|
||||||
|
$journals[] = $data['journal_id'];
|
||||||
|
}
|
||||||
|
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||||
|
$ts_list = $this->ts_obj->join('t_article', 't_article.article_id = t_ts.article_id', 'left')
|
||||||
|
->where('t_ts.ts_state', $data['ts_state'])
|
||||||
|
->where('t_article.journal_id', 'in', $journals)
|
||||||
|
->limit($limit_start, $data['pageSize'])
|
||||||
|
->select();
|
||||||
|
$count = $this->ts_obj->join('t_article', 't_article.article_id = t_ts.article_id', 'left')->where('t_ts.ts_state', $data['ts_state'])->where('t_article.journal_id', 'in', $journals)->count();
|
||||||
|
$re['ts_list'] = $ts_list;
|
||||||
|
$re['count'] = $count;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑参考文献
|
||||||
|
*/
|
||||||
|
public function editRefer()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'ts_refer_id' => 'require|number',
|
||||||
|
'refer_content' => 'require'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$update['refer_content'] = $data['refer_content'];
|
||||||
|
if (isset($data['refer_doi']) && $data['refer_doi'] != '') {
|
||||||
|
$update['refer_doi'] = $data['refer_doi'];
|
||||||
|
}
|
||||||
|
if (isset($data['refer_frag']) && $data['refer_frag'] != '') {
|
||||||
|
$update['refer_frag'] = $data['refer_frag'];
|
||||||
|
}
|
||||||
|
$this->ts_refer_obj->where('ts_refer_id', $data['ts_refer_id'])->update($update);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除参考文献
|
||||||
|
*/
|
||||||
|
public function delRefer()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'ts_refer_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$this->ts_refer_obj->where('ts_refer_id', $data['ts_refer_id'])->update(['refer_state' => 1]);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参考文献识别doi
|
||||||
|
*/
|
||||||
|
public function referToDoi()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||||
|
$refers = $this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_state', 0)->select();
|
||||||
|
foreach ($refers as $v) { //处理doi
|
||||||
|
if (strpos($v['refer_content'], 'doi:') == false && strpos($v['refer_content'], 'doi.org/') == false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$doi = '';
|
||||||
|
if (strpos($v['refer_content'], 'doi.org/') != false) {
|
||||||
|
$cache_arr = explode(' ', trim(substr($v['refer_content'], strpos($v['refer_content'], 'doi.org/') + 8)));
|
||||||
|
if (substr($cache_arr[0], -1) == '.') {
|
||||||
|
$doi = substr($cache_arr[0], 0, -1);
|
||||||
|
} else {
|
||||||
|
$doi = $cache_arr[0];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$cache_arr = explode(' ', trim(substr($v['refer_content'], strpos($v['refer_content'], 'doi:') + 4)));
|
||||||
|
if (substr($cache_arr[0], -1) == '.') {
|
||||||
|
$doi = substr($cache_arr[0], 0, -1);
|
||||||
|
} else {
|
||||||
|
$doi = $cache_arr[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->ts_refer_obj->where('ts_refer_id', $v['ts_refer_id'])->update(['refer_doi' => $doi]);
|
||||||
|
}
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* doi获取格式化的参考文献信息
|
||||||
|
*/
|
||||||
|
public function doiTofrag()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||||
|
$refers = $this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_state', 0)->select();
|
||||||
|
//清空frag,百分比用
|
||||||
|
$this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_doi', '<>', '')->update(['refer_frag' => '']);
|
||||||
|
foreach ($refers as $v) {
|
||||||
|
Queue::push('app\api\job\ts@fire', $v, 'ts');
|
||||||
|
}
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getFragBF()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||||
|
$list = $this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_doi', '<>', '')->where('refer_state', 0)->select();
|
||||||
|
$z = count($list);
|
||||||
|
$m = 0;
|
||||||
|
foreach ($list as $v) {
|
||||||
|
if ($v['refer_frag'] != '') {
|
||||||
|
$m++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($z == 0) {
|
||||||
|
return jsonError('system error!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$f = intval($m * 100 / $z);
|
||||||
|
|
||||||
|
$re['bf'] = $f;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function testdd()
|
||||||
|
{
|
||||||
|
$refer = $this->ts_refer_obj->where('ts_refer_id', 410)->find();
|
||||||
|
my_doiToFrag($refer);
|
||||||
|
// $d = '10.1152/ajpendo.00039.2012';
|
||||||
|
// $doi = str_replace('/','%2F',$d);
|
||||||
|
// $url = "https://citation.crosscite.org/format?doi=$doi&style=american-veterinary-medical-association&lang=en-US";
|
||||||
|
// $res = myGet($url);
|
||||||
|
// $frag = trim(substr($res,strpos($res,'.')+1));
|
||||||
|
// echo $frag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排版主方法入口
|
||||||
|
*/
|
||||||
|
public function doTypeSetting()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
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();
|
||||||
|
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
|
||||||
|
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||||
|
|
||||||
|
$typesetInfo = [];
|
||||||
|
$typesetInfo['info_title'] = $ts_info['ts_title'];
|
||||||
|
$typesetInfo['info_type'] = $ts_info['ts_type'];
|
||||||
|
$typesetInfo['doi'] = $ts_info['ts_doi'];
|
||||||
|
$typesetInfo['topic'] = $ts_info['ts_topic'];
|
||||||
|
$typesetInfo['mainText'] = $ts_info['ts_main'];
|
||||||
|
$typesetInfo['author'] = $ts_info['author'];
|
||||||
|
$typesetInfo['authorAddress'] = $ts_info['author_address'];
|
||||||
|
$typesetInfo['authorContribution'] = $ts_info['author_contribution'];
|
||||||
|
$typesetInfo['authorCorresponding'] = $ts_info['corresponding_author'];
|
||||||
|
$typesetInfo['authorCorrespondingEmail'] = $ts_info['corresponding_author_email'];
|
||||||
|
$typesetInfo['traditon'] = $ts_info['trdition'];
|
||||||
|
$typesetInfo['journal'] = $journal_info['title'];
|
||||||
|
$typesetInfo['jabbr'] = $journal_info['jabbr'];
|
||||||
|
$typesetInfo['stage'] = $ts_info['stage'];
|
||||||
|
$typesetInfo['little_author'] = $ts_info['little_author'];
|
||||||
|
$typesetInfo['website'] = $journal_info['website'];
|
||||||
|
$typesetInfo['acknowledgment'] = $ts_info['acknowledgment'];
|
||||||
|
$typesetInfo['received_date'] = $ts_info['received_date'];
|
||||||
|
$typesetInfo['accepted_date'] = $ts_info['accepted_date'];
|
||||||
|
$typesetInfo['online_date'] = $ts_info['online_date'];
|
||||||
|
$typesetInfo['abbreviation'] = $ts_info['abbreviation'];
|
||||||
|
$typesetInfo['abstractText'] = $ts_info['ts_abstract'];
|
||||||
|
$typesetInfo['keywords'] = $ts_info['keywords'];
|
||||||
|
$typesetInfo['userAccount'] = $editor_info['nickname'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//获取文件
|
||||||
$files = $this->article_file_obj
|
$files = $this->article_file_obj
|
||||||
->where('article_id',$article_info['article_id'])
|
->where('article_id', $article_info['article_id'])
|
||||||
->where('type_name','manuscirpt')
|
->where('type_name', 'manuscirpt')
|
||||||
->order('ctime desc')
|
->order('ctime desc')
|
||||||
->limit(1)
|
->limit(1)
|
||||||
->select();
|
->select();
|
||||||
if(count($files)==0){
|
if (count($files) == 0) {
|
||||||
return jsonError('No Manuscript');
|
return jsonError('No Manuscript');
|
||||||
}
|
}
|
||||||
|
$typesetInfo['filename'] = "http://api.tmrjournals.com/public/" . $files[0]['file_url'];
|
||||||
|
|
||||||
|
$rs = $this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_state', 0)->select();
|
||||||
|
$refers = [];
|
||||||
|
foreach ($rs as $v) {
|
||||||
|
$refers[] = $v['refer_frag'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$typesetInfo['refers'] = json_encode($refers);
|
||||||
|
|
||||||
|
|
||||||
|
$url = "http://localhost:8081/typeset/webGetDocx";
|
||||||
|
// $url = "http://192.168.110.100:8080/typeset/webGetDocx";
|
||||||
|
// $url = "http://ts.tmrjournals.com/api/typeset/webGetDocx";
|
||||||
|
$res = object_to_array(json_decode(myPost1($url, $typesetInfo)));
|
||||||
|
var_dump($res);die;
|
||||||
|
$file_res = $res['data']['file'];
|
||||||
|
$this->ts_obj->where('ts_id', $ts_info['ts_id'])->update(['ts_url' => $file_res]);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑排版实例
|
||||||
|
*/
|
||||||
|
public function editTypeSet()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'article_id' => 'require|number',
|
||||||
|
'ts_title' => 'require',
|
||||||
|
'ts_type' => 'require',
|
||||||
|
'author' => 'require',
|
||||||
|
'author_address' => 'require',
|
||||||
|
'author_contribution' => 'require',
|
||||||
|
'corresponding_author' => 'require',
|
||||||
|
'corresponding_author_email' => 'require',
|
||||||
|
'accepted_date' => 'require',
|
||||||
|
'received_date' => 'require',
|
||||||
|
'keywords' => 'require',
|
||||||
|
'stage' => 'require',
|
||||||
|
'little_author' => 'require',
|
||||||
|
'online_date' => 'require',
|
||||||
|
'ts_abstract' => 'require',
|
||||||
|
'acknowledgment' => 'require',
|
||||||
|
'abbreviation' => 'require',
|
||||||
|
'ts_doi' => 'require',
|
||||||
|
'trdition' => 'require',
|
||||||
|
'ts_topic' => 'require',
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$insert_ts['ts_title'] = $data['ts_title'];
|
||||||
|
$insert_ts['ts_type'] = $data['ts_type'];
|
||||||
|
$insert_ts['author'] = $data['author'];
|
||||||
|
$insert_ts['author_address'] = $data['author_address'];
|
||||||
|
$insert_ts['author_contribution'] = $data['author_contribution'];
|
||||||
|
//获取通讯作者信息
|
||||||
|
$insert_ts['corresponding_author'] = $data['corresponding_author'];
|
||||||
|
$insert_ts['corresponding_author_email'] = $data['corresponding_author_email'];
|
||||||
|
$insert_ts['accepted_date'] = $data['accepted_date'];
|
||||||
|
$insert_ts['received_date'] = $data['received_date'];
|
||||||
|
$insert_ts['keywords'] = $data['keywords'];
|
||||||
|
$insert_ts['stage'] = $data['stage'];
|
||||||
|
$insert_ts['little_author'] = $data['little_author'];
|
||||||
|
$insert_ts['online_date'] = $data['online_date'];
|
||||||
|
$insert_ts['ts_abstract'] = $data['ts_abstract'];
|
||||||
|
$insert_ts['acknowledgment'] = $data['acknowledgment'];
|
||||||
|
$insert_ts['abbreviation'] = $data['abbreviation'];
|
||||||
|
$insert_ts['ts_doi'] = $data['ts_doi'];
|
||||||
|
$insert_ts['trdition'] = $data['trdition'];
|
||||||
|
$insert_ts['ts_topic'] = $data['ts_topic'];
|
||||||
|
$this->ts_obj->where('article_id', $data['article_id'])->update($insert_ts);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建排版实例
|
||||||
|
*/
|
||||||
|
public function createTypeSet()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
|
||||||
|
|
||||||
|
//存在实例不可重复创建
|
||||||
|
$check_ts = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||||
|
if ($check_ts) {
|
||||||
|
return jsonError("has created");
|
||||||
|
}
|
||||||
|
$files = $this->article_file_obj
|
||||||
|
->where('article_id', $article_info['article_id'])
|
||||||
|
->where('type_name', 'manuscirpt')
|
||||||
|
->order('ctime desc')
|
||||||
|
->limit(1)
|
||||||
|
->select();
|
||||||
|
if (count($files) == 0) {
|
||||||
|
return jsonError('No Manuscript');
|
||||||
|
}
|
||||||
|
|
||||||
//调用接口分解word,
|
//调用接口分解word,
|
||||||
$url = "http://localhost:8080/typeset/webReaddoc";
|
// $url = "http://localhost:8080/typeset/webReaddoc";
|
||||||
$program['fileRoute'] = "https://submission.tmrjournals.com/public/".$files[0]['file_url'];
|
$url = "http://ts.tmrjournals.com/api/typeset/webReaddoc";
|
||||||
$res = object_to_array(json_decode(myPost($url,$program)));
|
$program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
|
||||||
|
$res = object_to_array(json_decode(myPost($url, $program)));
|
||||||
|
|
||||||
$file_runs = $res['data'];
|
$file_runs = $res['data'];
|
||||||
//整理信息
|
//整理信息
|
||||||
$frag = [];
|
$frag = [];
|
||||||
$aa = [];
|
$aa = [];
|
||||||
$frag['title'] = $article_info['title'];
|
$frag['title'] = $article_info['title'];
|
||||||
$start_refer = false;
|
$start_refer = false;
|
||||||
foreach($file_runs as $k => $v){
|
foreach ($file_runs as $k => $v) {
|
||||||
if($start_refer&&$v!=''){
|
if ($start_refer && $v != '') {
|
||||||
|
if (strlen($v) > 500) {
|
||||||
|
$start_refer = false;
|
||||||
|
$frag['main'][] = $v;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$frag['references'][] = $v;
|
$frag['references'][] = $v;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$g_val = trim(preg_replace('/\<.*?\>/', '', $v));
|
$g_val = trim(preg_replace('/\<.*?\>/', '', $v));
|
||||||
$aa[] = $g_val;
|
$aa[] = $g_val;
|
||||||
if($g_val == $article_info['title']){
|
if ($g_val == $article_info['title']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((strpos(strtolower(trim($g_val)),"keyword")==0||strpos(strtolower(trim($g_val)),"keyword")==1)&&!isset($frag['keywords'])){
|
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
|
||||||
$frag['keywords'] = $v;
|
$frag['keywords'] = $v;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strtolower($g_val) == "abstract"){
|
if (strtolower($g_val) == "abstract") {
|
||||||
$i = $k+1;
|
$i = $k + 1;
|
||||||
while($file_runs[$i]==''){
|
while ($file_runs[$i] == '') {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$frag['abstract'] = $file_runs[$i];
|
$frag['abstract'] = $file_runs[$i];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(isset($frag['abstract'])&&$frag['abstract']==$v){
|
if (isset($frag['abstract']) && $frag['abstract'] == $v) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(strtolower($g_val) == 'references'||strtolower($g_val)=='reference'){
|
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
|
||||||
$start_refer = true;
|
$start_refer = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -141,54 +501,67 @@ class Typeset extends Controller {
|
|||||||
$insert_ts['author'] = $au_res['author'];
|
$insert_ts['author'] = $au_res['author'];
|
||||||
$insert_ts['author_address'] = $au_res['address'];
|
$insert_ts['author_address'] = $au_res['address'];
|
||||||
//获取通讯作者信息
|
//获取通讯作者信息
|
||||||
$report_author = $this->article_author_obj->where('article_id',$article_info['article_id'])->where('is_report',1)->where('state',0)->find();
|
$report_author = $this->article_author_obj->where('article_id', $article_info['article_id'])->where('is_report', 1)->where('state', 0)->find();
|
||||||
$insert_ts['corresponding_author'] = $report_author['firstname'].' '.$report_author['lastname'];
|
$insert_ts['corresponding_author'] = $report_author['firstname'] . ' ' . $report_author['lastname'];
|
||||||
$insert_ts['corresponding_author_email'] = $report_author['email'];
|
$insert_ts['corresponding_author_email'] = $report_author['email'];
|
||||||
$insert_ts['accepted_date'] = date("d F Y",$article_info['rtime']);
|
$insert_ts['accepted_date'] = date("d F Y", $article_info['rtime']);
|
||||||
$insert_ts['received_date'] = date("d F Y",$article_info['ctime']);
|
$insert_ts['received_date'] = date("d F Y", $article_info['ctime']);
|
||||||
$insert_ts['keywords'] = 'Keywords:'.$article_info['keywords'];
|
$insert_ts['keywords'] = 'Keywords:' . $article_info['keywords'];
|
||||||
$insert_ts['ts_abstract'] = isset($frag['abstract'])?$frag['abstract']:'';
|
$insert_ts['ts_abstract'] = isset($frag['abstract']) ? $frag['abstract'] : '';
|
||||||
$insert_ts['ts_main'] = json_encode($frag['main']);
|
$insert_ts['ts_main'] = isset($frag['main']) ? json_encode($frag['main']) : '';
|
||||||
$insert_ts['ts_ctime'] = time();
|
$insert_ts['ts_ctime'] = time();
|
||||||
var_dump($insert_ts);
|
Db::startTrans(); //开启事务
|
||||||
Db::startTrans();//开启事务
|
|
||||||
$ts_id = $this->ts_obj->insertGetId($insert_ts);
|
$ts_id = $this->ts_obj->insertGetId($insert_ts);
|
||||||
|
$res_refer = true;
|
||||||
|
//开始处理引用
|
||||||
|
if (isset($frag['references']) && is_array($frag['references'])) {
|
||||||
|
$insert_all = [];
|
||||||
|
foreach ($frag['references'] as $k => $v) {
|
||||||
|
$cache_insert['ts_id'] = $ts_id;
|
||||||
|
$cache_insert['refer_content'] = trim($v);
|
||||||
|
$cache_insert['refer_ctime'] = time();
|
||||||
|
$insert_all[] = $cache_insert;
|
||||||
|
}
|
||||||
|
$res_refer = $this->ts_refer_obj->insertAll($insert_all);
|
||||||
|
}
|
||||||
|
if ($ts_id && $res_refer) {
|
||||||
|
Db::commit();
|
||||||
|
return jsonSuccess([]);
|
||||||
|
} else {
|
||||||
|
Db::rollback();
|
||||||
|
return jsonError('system error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function authorFormate($article_id){
|
private function authorFormate($article_id)
|
||||||
$authors = $this->article_author_obj->where('article_id',$article_id)->where('state',0)->select();
|
{
|
||||||
|
$authors = $this->article_author_obj->where('article_id', $article_id)->where('state', 0)->select();
|
||||||
//组装地址数组
|
//组装地址数组
|
||||||
$address = [];
|
$address = [];
|
||||||
foreach($authors as $v){
|
foreach ($authors as $v) {
|
||||||
$adds = explode(';',$v['company']);
|
$adds = explode(';', $v['company']);
|
||||||
foreach($adds as $key => $val){
|
foreach ($adds as $key => $val) {
|
||||||
$cache = is_numeric(substr(trim($val),0,1))?trim(substr(trim($val),1)):trim($val);
|
$cache = is_numeric(substr(trim($val), 0, 1)) ? trim(substr(trim($val), 1)) : trim($val);
|
||||||
if(!in_array($cache,$address)){
|
if (!in_array($cache, $address)) {
|
||||||
$address[] = $cache;
|
$address[] = $cache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//构建数组字符串
|
//构建数组字符串
|
||||||
$author = '';
|
$author = '';
|
||||||
foreach($authors as $v){
|
foreach ($authors as $v) {
|
||||||
$cache_str = $v['firstname'].' '.$v['lastname'].'<q>';
|
$cache_str = $v['firstname'] . ' ' . $v['lastname'] . '<q>';
|
||||||
$adds = explode(';',$v['company']);
|
$adds = explode(';', $v['company']);
|
||||||
foreach($adds as $key => $val){
|
foreach ($adds as $key => $val) {
|
||||||
$cache = is_numeric(substr(trim($val),0,1))?trim(substr(trim($val),1)):trim($val);
|
$cache = is_numeric(substr(trim($val), 0, 1)) ? trim(substr(trim($val), 1)) : trim($val);
|
||||||
$cache_str .= (intval(search_array_val($address,$cache))+1)." ";
|
$cache_str .= (intval(search_array_val($address, $cache)) + 1) . " ";
|
||||||
}
|
}
|
||||||
if($v['is_super']==1){
|
if ($v['is_super'] == 1) {
|
||||||
$cache_str .= '*';
|
$cache_str .= '*';
|
||||||
}
|
}
|
||||||
if($v['is_report']==1){
|
if ($v['is_report'] == 1) {
|
||||||
$cache_str .= '#';
|
$cache_str .= '#';
|
||||||
}
|
}
|
||||||
$cache_str = trim($cache_str);
|
$cache_str = trim($cache_str);
|
||||||
@@ -197,12 +570,11 @@ class Typeset extends Controller {
|
|||||||
}
|
}
|
||||||
//组装address
|
//组装address
|
||||||
$address_str = '';
|
$address_str = '';
|
||||||
foreach($address as $k => $v){
|
foreach ($address as $k => $v) {
|
||||||
$address_str .= ($k+1).' '.$v.';';
|
$address_str .= ($k + 1) . ' ' . $v . ';%$%';
|
||||||
}
|
}
|
||||||
$frag['author'] = $author;
|
$frag['author'] = $author;
|
||||||
$frag['address'] = $address_str;
|
$frag['address'] = $address_str;
|
||||||
return $frag;
|
return $frag;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ class User extends Controller
|
|||||||
|
|
||||||
$check = $this->user_obj
|
$check = $this->user_obj
|
||||||
->where('state', 0)
|
->where('state', 0)
|
||||||
->where('account = "'.$data['account'].'" or email = "'.$data['email'].'"')
|
->where('account = "' . trim($data['account']) . '" or email = "' . trim($data['email']) . '"')
|
||||||
->find();
|
->find();
|
||||||
if ($check) {
|
if ($check) {
|
||||||
return jsonError('用户已经存在');
|
return jsonError('用户已经存在');
|
||||||
@@ -263,11 +263,12 @@ class User extends Controller
|
|||||||
/**
|
/**
|
||||||
* 获取所有编辑
|
* 获取所有编辑
|
||||||
*/
|
*/
|
||||||
public function getAllEditor(){
|
public function getAllEditor()
|
||||||
$editors = $this->user_obj->where('type',2)->where('state',0)->select();
|
{
|
||||||
|
$editors = $this->user_obj->where('type', 2)->where('state', 0)->select();
|
||||||
//获取编辑管理的期刊
|
//获取编辑管理的期刊
|
||||||
foreach($editors as $k => $v){
|
foreach ($editors as $k => $v) {
|
||||||
$cache_journals = $this->journal_obj->where('editor_id',$v['user_id'])->where('state',0)->select();
|
$cache_journals = $this->journal_obj->where('editor_id', $v['user_id'])->where('state', 0)->select();
|
||||||
$editors[$k]['journals'] = $cache_journals;
|
$editors[$k]['journals'] = $cache_journals;
|
||||||
}
|
}
|
||||||
$re['editors'] = $editors;
|
$re['editors'] = $editors;
|
||||||
@@ -277,17 +278,18 @@ class User extends Controller
|
|||||||
/**
|
/**
|
||||||
* 修改编辑密码
|
* 修改编辑密码
|
||||||
*/
|
*/
|
||||||
public function changeEditorPassword(){
|
public function changeEditorPassword()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
// 验证规则
|
// 验证规则
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'user_id'=>'require|number',
|
'user_id' => 'require|number',
|
||||||
'password'=>'require'
|
'password' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return json(['code' => 1,'msg'=>$rule->getError()]);
|
return json(['code' => 1, 'msg' => $rule->getError()]);
|
||||||
}
|
}
|
||||||
$this->user_obj->where('user_id',$data['user_id'])->update(['password'=>md5($data['password'])]);
|
$this->user_obj->where('user_id', $data['user_id'])->update(['password' => md5($data['password'])]);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,22 +372,23 @@ class User extends Controller
|
|||||||
/**
|
/**
|
||||||
* 获取用户详细信息
|
* 获取用户详细信息
|
||||||
*/
|
*/
|
||||||
public function getUserDetail(){
|
public function getUserDetail()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'user_id' => 'require'
|
'user_id' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$user_info = $this->user_obj->where("user_id",$data['user_id'])->where('state',0)->find();
|
$user_info = $this->user_obj->where("user_id", $data['user_id'])->where('state', 0)->find();
|
||||||
$user_info['roles'] = $this->getUserRoles($user_info['account']);
|
$user_info['roles'] = $this->getUserRoles($user_info['account']);
|
||||||
//获取用户的客座期刊的详细信息
|
//获取用户的客座期刊的详细信息
|
||||||
$list = $this->user_to_special_obj->where('user_id',$user_info['user_id'])->where('uts_state',0)->select();
|
$list = $this->user_to_special_obj->where('user_id', $user_info['user_id'])->where('uts_state', 0)->select();
|
||||||
$specials = [];
|
$specials = [];
|
||||||
foreach($list as $k => $v){
|
foreach ($list as $k => $v) {
|
||||||
$cache_info = $this->getSpecialDetailById($v['special_id']);
|
$cache_info = $this->getSpecialDetailById($v['special_id']);
|
||||||
$cache_journal = $this->journal_obj->where('issn',$cache_info['journal_issn'])->find();
|
$cache_journal = $this->journal_obj->where('issn', $cache_info['journal_issn'])->find();
|
||||||
$cache_info['journal_id'] = $cache_journal['journal_id'];
|
$cache_info['journal_id'] = $cache_journal['journal_id'];
|
||||||
$specials[] = $cache_info;
|
$specials[] = $cache_info;
|
||||||
}
|
}
|
||||||
@@ -398,19 +401,20 @@ class User extends Controller
|
|||||||
/**
|
/**
|
||||||
* 获取用户所有客座专刊
|
* 获取用户所有客座专刊
|
||||||
*/
|
*/
|
||||||
public function getUserAllSpecials(){
|
public function getUserAllSpecials()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'user_id' => 'require'
|
'user_id' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$list = $this->user_to_special_obj->where('user_id',$data['user_id'])->where('uts_state',0)->select();
|
$list = $this->user_to_special_obj->where('user_id', $data['user_id'])->where('uts_state', 0)->select();
|
||||||
$specials = [];
|
$specials = [];
|
||||||
foreach($list as $k => $v){
|
foreach ($list as $k => $v) {
|
||||||
$cache_info = $this->getSpecialDetailById($v['special_id']);
|
$cache_info = $this->getSpecialDetailById($v['special_id']);
|
||||||
$cache_journal = $this->journal_obj->where('issn',$cache_info['journal_issn'])->find();
|
$cache_journal = $this->journal_obj->where('issn', $cache_info['journal_issn'])->find();
|
||||||
$cache_info['journal_id'] = $cache_journal['journal_id'];
|
$cache_info['journal_id'] = $cache_journal['journal_id'];
|
||||||
$specials[] = $cache_info;
|
$specials[] = $cache_info;
|
||||||
}
|
}
|
||||||
@@ -419,10 +423,11 @@ class User extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getSpecialDetailById($special_id){
|
public function getSpecialDetailById($special_id)
|
||||||
|
{
|
||||||
$base_url = Env::get('journal.base_url');
|
$base_url = Env::get('journal.base_url');
|
||||||
$api_url = $base_url."/master/special/getSpecialDetailById";
|
$api_url = $base_url . "/master/special/getSpecialDetailById";
|
||||||
$res = object_to_array(json_decode(myPost($api_url,['journal_special_id'=>$special_id])));
|
$res = object_to_array(json_decode(myPost($api_url, ['journal_special_id' => $special_id])));
|
||||||
$special_info = $res['data']['special'];
|
$special_info = $res['data']['special'];
|
||||||
unset($special_info['journal_id']);
|
unset($special_info['journal_id']);
|
||||||
return $special_info;
|
return $special_info;
|
||||||
@@ -431,22 +436,23 @@ class User extends Controller
|
|||||||
/**
|
/**
|
||||||
* 添加用户身份
|
* 添加用户身份
|
||||||
*/
|
*/
|
||||||
public function addUserRole(){
|
public function addUserRole()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'user_id' => 'require',
|
'user_id' => 'require',
|
||||||
'role_type'=> 'require'
|
'role_type' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
if($data['role_type']=='special'){
|
if ($data['role_type'] == 'special') {
|
||||||
if(!isset($data['special_id'])){
|
if (!isset($data['special_id'])) {
|
||||||
return jsonError("添加客座编辑身份时,客座id是必传项");
|
return jsonError("添加客座编辑身份时,客座id是必传项");
|
||||||
}
|
}
|
||||||
|
|
||||||
$check = $this->user_to_special_obj->where("user_id",$data['user_id'])->where('special_id',$data['special_id'])->where('uts_state',0)->find();
|
$check = $this->user_to_special_obj->where("user_id", $data['user_id'])->where('special_id', $data['special_id'])->where('uts_state', 0)->find();
|
||||||
if($check){
|
if ($check) {
|
||||||
return jsonError("不可重复添加");
|
return jsonError("不可重复添加");
|
||||||
}
|
}
|
||||||
$insert_uts['user_id'] = $data['user_id'];
|
$insert_uts['user_id'] = $data['user_id'];
|
||||||
@@ -455,7 +461,6 @@ class User extends Controller
|
|||||||
$this->user_to_special_obj->insert($insert_uts);
|
$this->user_to_special_obj->insert($insert_uts);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -531,8 +536,8 @@ class User extends Controller
|
|||||||
if ($board_res != null) {
|
if ($board_res != null) {
|
||||||
$roles[] = 'board';
|
$roles[] = 'board';
|
||||||
}
|
}
|
||||||
$special_res = $this->user_to_special_obj->where('user_id',$user_info['user_id'])->where("uts_state",0)->find();
|
$special_res = $this->user_to_special_obj->where('user_id', $user_info['user_id'])->where("uts_state", 0)->find();
|
||||||
if($special_res != null){
|
if ($special_res != null) {
|
||||||
$roles[] = 'special';
|
$roles[] = 'special';
|
||||||
}
|
}
|
||||||
return $roles;
|
return $roles;
|
||||||
@@ -736,7 +741,7 @@ class User extends Controller
|
|||||||
$url = config('base_web_url') . 'retrieveact?actkey=' . $act_insert['act_key'];
|
$url = config('base_web_url') . 'retrieveact?actkey=' . $act_insert['act_key'];
|
||||||
$title = 'Your request to reset your password [TMR Publishing Group]';
|
$title = 'Your request to reset your password [TMR Publishing Group]';
|
||||||
$content = "$realname, we've received your request to reset your password.Please click the link below to change your password. <a href='$url' target='_blank'>$url</a>";
|
$content = "$realname, we've received your request to reset your password.Please click the link below to change your password. <a href='$url' target='_blank'>$url</a>";
|
||||||
$res = sendEmail($email, $title, 'TMR', $content,Env::get('email.send_email'),Env::get("email.send_email_password"));
|
$res = sendEmail($email, $title, 'TMR', $content, Env::get('email.send_email'), Env::get("email.send_email_password"));
|
||||||
// if ($isUserPushed) {//成功
|
// if ($isUserPushed) {//成功
|
||||||
return json(['code' => 0, 'msg' => 'success']);
|
return json(['code' => 0, 'msg' => 'success']);
|
||||||
// } else {//失败
|
// } else {//失败
|
||||||
@@ -994,19 +999,23 @@ class User extends Controller
|
|||||||
return jsonError("has reviewer");
|
return jsonError("has reviewer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$info_check = $this->user_reviewer_info_obj->where('reviewer_id', $user_info['user_id'])->find();
|
||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
|
|
||||||
$insert_info['reviewer_id'] = $user_info['user_id'];
|
$res = true;
|
||||||
$insert_info['gender'] = $data['gender'];
|
if ($info_check==null) {
|
||||||
$insert_info['technical'] = $data['author_title'];
|
$insert_info['reviewer_id'] = $user_info['user_id'];
|
||||||
$insert_info['country'] = $data['country'];
|
$insert_info['gender'] = $data['gender'];
|
||||||
$insert_info['introduction'] = $data['introduction'];
|
$insert_info['technical'] = $data['author_title'];
|
||||||
$insert_info['company'] = $data['company'];
|
$insert_info['country'] = $data['country'];
|
||||||
$insert_info['major'] = $data['major'];
|
$insert_info['introduction'] = $data['introduction'];
|
||||||
$insert_info['field'] = $data['field'];
|
$insert_info['company'] = $data['company'];
|
||||||
$insert_info['qualifications'] = $data['qualifications'];
|
$insert_info['major'] = $data['major'];
|
||||||
$res = $this->user_reviewer_info_obj->insertGetId($insert_info);
|
$insert_info['field'] = $data['field'];
|
||||||
|
$insert_info['qualifications'] = $data['qualifications'];
|
||||||
|
$res = $this->user_reviewer_info_obj->insertGetId($insert_info);
|
||||||
|
}
|
||||||
$insert_to['reviewer_id'] = $user_info['user_id'];
|
$insert_to['reviewer_id'] = $user_info['user_id'];
|
||||||
$insert_to['journal_id'] = $rfa_info['journal_id'];
|
$insert_to['journal_id'] = $rfa_info['journal_id'];
|
||||||
$insert_to['account'] = $user_info['account'];
|
$insert_to['account'] = $user_info['account'];
|
||||||
|
|||||||
35
application/api/job/ts.php
Normal file
35
application/api/job/ts.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\job;
|
||||||
|
|
||||||
|
use think\queue\Job;
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
class ts {
|
||||||
|
|
||||||
|
//put your code here
|
||||||
|
|
||||||
|
public function fire(Job $job, $data) {
|
||||||
|
$job->delete();
|
||||||
|
my_doiToFrag($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public function doFrag($data){
|
||||||
|
// $ts_refer_obj = Db::name('ts_refer');
|
||||||
|
// if($data['refer_doi']==''){
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
// $doi = str_replace('/','%2F',$data['refer_doi']);
|
||||||
|
// $url = "https://citation.crosscite.org/format?doi=$doi&style=american-veterinary-medical-association&lang=en-US";
|
||||||
|
// $res = myGet($url);
|
||||||
|
// $frag = trim(substr($res,strpos($res,'.')+1));
|
||||||
|
// file_put_contents("D:/1.txt",$frag);
|
||||||
|
// file_put_contents("D:/2.txt",$ts_refer_obj);
|
||||||
|
|
||||||
|
// // $ts_refer_obj->where('ts_refer_id',$data['ts_refer_id'])->update(['refer_frag'=>$frag]);
|
||||||
|
// return 1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -207,6 +207,44 @@ function search_array_val($arr,$val){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET 请求
|
||||||
|
* @param string $url
|
||||||
|
*/
|
||||||
|
function myGet($url){
|
||||||
|
$oCurl = curl_init();
|
||||||
|
if(stripos($url,"https://")!==FALSE){
|
||||||
|
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||||
|
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||||||
|
curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
|
||||||
|
}
|
||||||
|
curl_setopt($oCurl, CURLOPT_URL, $url);//目标URL
|
||||||
|
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );//设定是否显示头信息,1为显示
|
||||||
|
curl_setopt($oCurl, CURLOPT_BINARYTRANSFER, true) ;//在启用CURLOPT_RETURNTRANSFER时候将获取数据返回
|
||||||
|
$sContent = curl_exec($oCurl);
|
||||||
|
$aStatus = curl_getinfo($oCurl);//获取页面各种信息
|
||||||
|
curl_close($oCurl);
|
||||||
|
if(intval($aStatus["http_code"])==200){
|
||||||
|
return $sContent;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function my_doiToFrag($data){
|
||||||
|
$ts_refer_obj = Db::name('ts_refer');
|
||||||
|
if($data['refer_doi']==''){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
$doi = str_replace('/','%2F',$data['refer_doi']);
|
||||||
|
$url = "https://citation.crosscite.org/format?doi=$doi&style=american-veterinary-medical-association&lang=en-US";
|
||||||
|
$res = myGet($url);
|
||||||
|
$frag = trim(substr($res,strpos($res,'.')+1));
|
||||||
|
$frag1 = $frag==""?"none":$frag;
|
||||||
|
$ts_refer_obj->where('ts_refer_id',$data['ts_refer_id'])->update(['refer_frag'=>$frag1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加usermsg
|
* 增加usermsg
|
||||||
*/
|
*/
|
||||||
@@ -247,6 +285,10 @@ function choiseJabbr($article_id, $jabbr) {
|
|||||||
return $jabbr;
|
return $jabbr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function myPost($url, $param = array()) {
|
function myPost($url, $param = array()) {
|
||||||
|
|
||||||
if (!is_array($param)) {
|
if (!is_array($param)) {
|
||||||
@@ -276,3 +318,37 @@ function myPost($url, $param = array()) {
|
|||||||
|
|
||||||
return $rst;
|
return $rst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function myPost1($url, $param = array()) {
|
||||||
|
|
||||||
|
if (!is_array($param)) {
|
||||||
|
|
||||||
|
throw new Exception("参数必须为array");
|
||||||
|
}
|
||||||
|
$data = json_encode($param);
|
||||||
|
|
||||||
|
$httph = curl_init($url);
|
||||||
|
curl_setopt($httph, CURLOPT_HTTPHEADER, array(
|
||||||
|
'Content-Type: application/json',
|
||||||
|
));
|
||||||
|
|
||||||
|
// curl_setopt($httph, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
|
// curl_setopt($httph, CURLOPT_SSL_VERIFYHOST, 1);
|
||||||
|
|
||||||
|
curl_setopt($httph, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
|
||||||
|
curl_setopt($httph, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
|
||||||
|
|
||||||
|
curl_setopt($httph, CURLOPT_POST, 1); //设置为POST方式
|
||||||
|
|
||||||
|
curl_setopt($httph, CURLOPT_POSTFIELDS, $data);
|
||||||
|
|
||||||
|
// curl_setopt($httph, CURLOPT_RETURNTRANSFER,0);
|
||||||
|
// curl_setopt($httph, CURLOPT_HEADER,1);
|
||||||
|
|
||||||
|
$rst = curl_exec($httph);
|
||||||
|
|
||||||
|
curl_close($httph);
|
||||||
|
|
||||||
|
return $rst;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user