This commit is contained in:
wangjinlei
2020-11-12 15:51:19 +08:00
parent 69bdcdc84a
commit 251d1b19c8
480 changed files with 7298 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
.idea
composer.lock
*.log
thinkphp

0
.htaccess Normal file
View File

0
.keep Normal file
View File

42
.travis.yml Normal file
View File

@@ -0,0 +1,42 @@
sudo: false
language: php
branches:
only:
- stable
cache:
directories:
- $HOME/.composer/cache
before_install:
- composer self-update
install:
- composer install --no-dev --no-interaction --ignore-platform-reqs
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
- composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
- composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
script:
- php think unit
deploy:
provider: releases
api_key:
secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
file:
- ThinkPHP_Core.zip
- ThinkPHP_Full.zip
skip_cleanup: true
on:
tags: true

1236
CHANGELOG.md Normal file

File diff suppressed because it is too large Load Diff

32
LICENSE.txt Normal file
View File

@@ -0,0 +1,32 @@
ThinkPHP遵循Apache2开源协议发布并提供免费使用。
版权所有Copyright © 2006-2017 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
Apache Licence是著名的非盈利开源组织Apache采用的协议。
该协议和BSD类似鼓励代码共享和尊重原作者的著作权
允许代码修改,再作为开源或商业软件发布。需要满足
的条件:
1 需要给代码的用户一份Apache Licence
2 如果你修改了代码,需要在被修改的文件中说明;
3 在延伸的代码中(修改和有源代码衍生的代码中)需要
带有原来代码中的协议,商标,专利声明和其他原来作者规
定需要包含的说明;
4 如果再发布的产品中包含一个Notice文件则在Notice文
件中需要带有本协议内容。你可以在Notice中增加自己的
许可但不可以表现为对Apache Licence构成更改。
具体的协议参考http://www.apache.org/licenses/LICENSE-2.0
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

1
application/.htaccess Normal file
View File

@@ -0,0 +1 @@
deny from all

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,20 @@
<?php
//配置文件
return [
//服务器根目录
'base_url' =>'http://www.tougao.com/',
//网站根目录
'base_web_url' => 'http://submission.tmrjournals.com/',
//邮件模板--注册成功
'email_hello'=>'Dear author,You have successfully registered in Traditional Medicine Research.Your registering informaion in our journal is:',
//邮件模板--找回密码
'email_retrieve'=>'',
//邮件模板--发送文章成功
'email_add_article'=>'<p>Thank you for your submission to Traditional Medicine Research.
The editor will take a preliminary review of your manuscript soon, deciding whether your manuscript is suitable for Traditional Medicine Research.
You can track the status of your manuscript through our online "AuthorCenter" .</p> ',
//邮件模板--更改文章状态
'email_article_change_state'=>''
];

View File

@@ -0,0 +1,634 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
class Admin extends Controller {
protected $user_obj = '';
protected $captcha_obj = '';
protected $journal_obj = '';
protected $user_act_obj = '';
protected $reviewer_major_obj = '';
protected $article_obj = '';
protected $article_msg_obj = '';
protected $article_author_obj = '';
protected $admin_obj = '';
protected $country_obj = '';
protected $reviewer_to_journal_obj = '';
protected $user_reviewer_info_obj = '';
protected $user_reviewer_obj = '';
protected $user_msg_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->captcha_obj = Db::name('captcha');
$this->user_act_obj = Db::name('user_act');
$this->admin_obj = Db::name('admin');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->journal_obj = Db::name('journal');
$this->user_reviewer_obj = Db::name('user_reviewer_apply');
$this->user_reviewer_info_obj = Db::name('user_reviewer_info');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->article_obj = Db::name('article');
$this->user_msg_obj = Db::name('user_msg');
$this->article_msg_obj = Db::name('article_msg');
$this->article_author_obj = Db::name('article_author');
$this->country_obj = Db::name('country');
}
/**
* 获取编辑人员列表(分页)
*/
public function getEditor() {
$data = $this->request->post();
$where['type'] = 2;
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$res = $this->user_obj->where($where)->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_obj->where($where)->count();
return json(['total' => $count, 'data' => $res]);
}
/**
* 获取所有编辑
*/
public function getEditorList() {
$where['type'] = 2;
$res = $this->user_obj->where($where)->select();
return $res == null ? json(['code' => 1, 'msg' => 'Acquisition failed']) : json(['code' => 0, 'data' => $res]);
}
/**
* 添加编辑
*/
public function addEditor() {
$data = $this->request->post();
$checkres = $this->user_obj->where(['account' => $data['username']])->whereOr(['email' => $data['email']])->find();
if ($checkres != null) {
return json(['code' => 1, 'msg' => 'username or email has registered']);
}
$insert_data['account'] = $data['username'];
$insert_data['password'] = md5($data['password']);
$insert_data['email'] = $data['email'];
$insert_data['phone'] = $data['phone'];
$insert_data['realname'] = $data['realname'];
$insert_data['type'] = 2;
$insert_data['ctime'] = time();
$this->user_obj->insert($insert_data);
return json(['code' => 0]);
}
/**
* 获取文章admin
*/
public function getArticle() {
//接收参数
$data = $this->request->post();
// $data['journal'] = 0;
// $data['pageIndex'] = 1;
// $data['pageSize'] = 10;
//构造查询条件
$where = [];
if ($data['journal'] != 0) {
$where['t_article.journal_id'] = $data['journal'];
}
if ($data['state'] >= 0) {
$where['t_article.state'] = $data['state'];
} else {
if ($data['act'] == 1) {
$where['t_article.state'] = array('in', [0, 1, 2, 4]);
} else if ($data['act'] == 2) {
$where['t_article.state'] = array('in', [3, 5]);
}
}
//分页查询数据
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$res = $this->article_obj->field('t_article.*,t_journal.title journalname,t_journal.abbr abbr,t_user.account username,t_user.realname realname')
->join('t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT')
->join('t_user', 't_journal.editor_id = t_user.user_id', 'LEFT')
->where($where)
->order('article_id desc')
->limit($limit_start, $data['pageSize'])->select();
$count = $this->article_obj->where($where)->count();
//收集文章的国家
foreach ($res as $k => $v) {
$c_res = $this->article_author_obj->where('article_id', $v['article_id'])->select();
$c_frag = [];
foreach ($c_res as $vv) {
if ($vv['country'] == "") {
continue;
}
if (!in_array($vv['country'], $c_frag)) {
$c_frag[] = $vv['country'];
}
}
$res[$k]['country'] = implode(',', $c_frag);
}
//返回数据
return json(['total' => $count, 'data' => $res]);
}
/**
* 获取文章详情
*/
public function getArticleDetail() {
//接受参数
$data = $this->request->post();
//查询文章基础数据
$where['t_article.article_id'] = $data['articleId'];
$article_res = $this->article_obj->field('t_article.*,t_journal.title journalname,t_user.account')->join(array(['t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT'], ['t_user', 't_user.user_id = t_article.user_id', 'LEFT']))->where($where)->find();
//查询文章状态跟踪信息
$article_msg = $this->article_msg_obj->where(['article_id' => $data['articleId']])->select();
$suggest = '';
//如果是退修状态,显示退休信息
if ($article_res['state'] == 4) {
$lastbean = end($article_msg);
$suggest = $lastbean['content'];
}
//查询major信息
$major_data = [];
if($article_res['major_id']!=0){
$major_data['major'] = $this->reviewer_major_obj->where('major_id',$article_res['major_id'])->find();
}else{
$major_data['major'] = null;
}
if($article_res['cmajor_id']!=0){
$major_data['cmajor'] = $this->reviewer_major_obj->where('major_id',$article_res['cmajor_id'])->find();
}else{
$major_data['cmajor'] = null;
}
//查询文章作者信息
$author_res = $this->article_author_obj->where('article_id', $data['articleId'])->where('state', 0)->select();
return json(['article' => $article_res, 'msg' => $article_msg, 'authors' => $author_res, 'suggest' => $suggest,'major'=>$major_data]);
}
/**
* 获取期刊列表
*/
public function getJournals() {
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'] ;
$res = $this->journal_obj->field('t_journal.*,t_user.account editor')->join('t_user', 't_user.user_id=t_journal.editor_id', 'left')->order('t_journal.journal_id')->limit($limit_start, $data['pageSize'])->select();
$count = $this->journal_obj->count();
return json(['total' => $count, 'data' => $res]);
}
/**
* 添加期刊
*/
public function journalAdd() {
$data = $this->request->post();
$checkres = $this->journal_obj->where(['title' => $data['title']])->whereOr(['issn' => $data['issn']])->find();
if ($checkres != null) {
return json(['code' => 1, 'msg' => 'title or issn already exists']);
}
$insert_data['title'] = $data['title'];
$insert_data['issn'] = $data['issn'];
$insert_data['alias'] = $data['alias'];
$this->journal_obj->insert($insert_data);
return json(['code' => 0]);
}
/**
* 更改期刊编辑
*/
public function journalEditorChange() {
$data = $this->request->post();
$update['editor_id'] = $data['editorId'];
$where['journal_id'] = $data['journalId'];
$res = $this->journal_obj->where($where)->update($update);
return json(['code' => $res == null ? 1 : 0]);
}
/**
* 上传reviewer申请
*/
public function reviewer() {
//接受参数
$data = $this->request->post();
$journal_info = $this->journal_obj->where('journal_id', $data['journal'])->find();
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
// $data['company'] = 'dsadsa';
// $data['country'] = 'china';
// $data['email'] = "dsadsad@126.com";
// $data['field'] = 'dsadsada';
// $data['gender'] = 1;
// $data['introduction'] = 'dsadsads';
// $data['journal'] = 1;
// $data['major'] = 6;
// $data['qualifications'] = "reviewer/20200729/8355df2ee29d8313cf39e1c3b0b6ebd8.rar";
// $data['technical'] = 'Ph.D.';
// $data['username'] = '"wangjinlei11"';
// return json($data);
//组合数据insert
$insert_data['journal_id'] = $data['journal'];
$insert_data['name'] = $data['username'];
$insert_data['introduction'] = $data['introduction'];
$insert_data['email'] = $data['email'];
$insert_data['company'] = $data['company'];
$insert_data['country'] = $data['country'];
$insert_data['major'] = $data['major'];
$insert_data['technical'] = $data['technical'];
$insert_data['field'] = $data['field'];
$insert_data['gender'] = $data['gender'];
$insert_data['qualifications'] = $data['qualifications'];
$insert_data['ctime'] = time();
$res = $this->user_reviewer_obj->insertGetId($insert_data);
if ($res > 0) {
//发送email-》编辑
$tt = 'Dear editor,<br>';
$tt .= 'Please check the new reviewer application.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//发送消息信息--编辑
$journal_res = $this->journal_obj->where('journal_id', $data['journal'])->find();
add_usermsg($journal_res['editor_id'], '新增审稿人申请,申请人(' . $data['username'] . ')', '/reviewerApplyDetail?id=' . $res);
return json(['code' => 0]);
} else {
return json(['code' => 1, 'msg' => 'reviewer submit error']);
}
}
/**
* 作者申请成为审稿人
*/
public function becameReviewer() {
//接受参数,查询参数
$data = $this->request->post();
//
// return json($data);
// $data['company'] = 'sssssssssssssssssssss';
// $data['country'] = 'China';
// $data['field'] = 'asdsadsa';
// $data['gender'] = 1;
// $data['introduction'] = 'dsds';
// $data['journal'] = 1;
// $data['major'] = 6;
// $data['qualifications'] = "reviewer/20200821/8e291c09e53fbbe12541563d59790464.rar";
// $data['technical'] = 'Ph.D.';
// $data['username'] = 'wangjinlei';
$user_info = $this->user_obj->where('account', $data['username'])->find();
$journal_info = $this->journal_obj->where('journal_id', $data['journal'])->find();
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
//存储数据
$insert['journal_id'] = $data['journal'];
$insert['name'] = $data['username'];
$insert['gender'] = $data['gender'];
$insert['technical'] = $data['technical'];
$insert['country'] = $data['country'];
$insert['introduction'] = $data['introduction'];
$insert['email'] = $user_info['email'];
$insert['company'] = $data['company'];
$insert['major'] = $data['major'];
$insert['field'] = $data['field'];
$insert['qualifications'] = $data['qualifications'];
$insert['ctime'] = time();
$res = $this->user_reviewer_obj->insertGetId($insert);
//发送email-》编辑
$tt = 'Dear editor,<br>';
$tt .= 'Please check the new reviewer application.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//发送消息信息--编辑
$journal_res = $this->journal_obj->where('journal_id', $data['journal'])->find();
add_usermsg($journal_res['editor_id'], 'New reviewer apply' . $data['username'] . ')', '/reviewerApplyDetail?id=' . $res);
return json(['code' => 0]);
}
/**
* 获取城市
*/
public function getCountrys() {
$res = $this->country_obj->order('en_name')->select();
return json($res);
}
/**
* 导入reviewer
*/
public function reviewerImport() {
//接收信息
$data = $this->request->post();
// $data['journal'] = 7;
// $data['url'] = 'reviewer/import/20200826/a8c03d7f9ac899c0a590ff26663402f2.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'] == '' || $v['email'] == '' || $v['realname'] == '' || $v['major'] == '' || $v['username'] == null || $v['email'] == null || $v['realname'] == null || $v['major'] == null) {
$er_data[] = [
'username' => $v['username'],
'realname' => $v['realname'],
'email' => $v['email'],
'reason' => 'Missing data'
];
continue;
}
//验证major
$major = self::get_major($v['major']);
if ($major === null) {
$er_data[] = [
'username' => $v['username'],
'realname' => $v['realname'],
'email' => $v['email'],
'reason' => 'major is error'
];
continue;
}
//验证是否存在此用户并且存在对应关系
$this_reviewer = self::get_username($v['username']);
if ($this_reviewer == null && self::get_userByEmail($v['email']) != null) {
$er_data[] = [
'username' => $v['username'],
'realname' => $v['realname'],
'email' => $v['email'],
'reason' => 'Email occupied'
];
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' => $v['username'],
'realname' => $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'] = $v['email'];
$cache_reviewer['realname'] = $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'] = $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' => $v['username'],
'realname' => $v['realname'],
'email' => $v['email'],
'reason' => 'success'
];
//发送邮件提醒审稿人
$tt = 'Dear Reviewer,<br>';
$tt .= 'In order to provide a better online experience for both authors and readers, the submission system was changed to new.<br>';
$tt .= 'Website was closed between 18:00 Aug. 2, 2020 to 24:00 Aug. 2, 2020 Beijing time.<br>';
$tt .= 'You could log in with your account in submission.tmrjournals.com .<br>';
$tt .= 'Your username:'.$v['username'].'<br>';
$tt .= 'Your password: 123456qwe (you could change your password in the system by yourself later.)<br>';
$tt .= 'Thank you so much for your kindly support.<br><br>';
$tt .= $journal_info['title'].'<br>';
$tt .= date('Y-m-d');
$maidata['email'] = $v['email'];
$maidata['title'] = $journal_info['title'];
$maidata['content'] = $tt;
$maidata['tmail'] = $journal_info['email'];
$maidata['tpassword'] = $journal_info['epassword'];
Queue::push( 'app\api\job\mail@fire' , $maidata , "mail" );
}
return json(['sudata' => $su_data, 'erdata' => $er_data]);
}
/**
* 获取领域分类
*/
public function getMajor(){
$majors = $this->reviewer_major_obj->where('pid',0)->select();
return json(['code'=>0,'data'=>$majors]);
}
public function getMajors(){
$rid = $this->request->post('rid');
$reviewer_info = $this->user_reviewer_info_obj->where('reviewer_id',$rid)->find();
$majors = $this->reviewer_major_obj->where('pid',0)->select();
$cmajors = $this->reviewer_major_obj->where('pid',$reviewer_info['major'])->select();
return json(['code'=>0,'data'=>$majors,'cmajors'=>$cmajors]);
}
/**
* 获取major子项目
*/
public function majorChild(){
$majorid = $this->request->post('majorid');
$ds = $this->reviewer_major_obj->where('pid',$majorid)->select();
return json(['code'=>0,'data'=>$ds]);
}
/**
* 获取期刊除了已申请过的期刊
*/
public function getJournalchu() {
$data = $this->request->post();
$journals = $this->reviewer_to_journal_obj->where('account', $data['username'])->column('journal_id');
$res = $this->journal_obj->where('journal_id', 'not in', $journals)->select();
return json($res);
}
/**
* 获取excel数据
*/
public function getExcelData() {
//接收数据
$data = $this->request->post();
$path = ROOT_PATH . 'public' . DS . $data['url'];
$frag = self::readExcel($path);
return json($frag);
}
/**
* 验证用户名是否存在
*/
private function get_username($username) {
return $this->user_obj->where('account', $username)->find();
}
/**
* 验证major是否合法
*/
private function get_major($major) {
return $this->reviewer_major_obj->where('title', $major)->find();
}
/**
* 获取对应关系
*/
private function get_retojo($reviewer_id, $journal_id) {
return $this->reviewer_to_journal_obj->where('reviewer_id', $reviewer_id)->where('journal_id', $journal_id)->find();
}
/**
* 获取此邮箱注册用户
*/
private function get_userByEmail($email) {
return $this->user_obj->where('email', $email)->find();
}
/**
* 读取excel数据
*/
private function readExcel($path) {
$extension = substr($path, strrpos($path, '.') + 1);
vendor("PHPExcel.PHPExcel");
if ($extension == 'xlsx') {
$objReader = new \PHPExcel_Reader_Excel2007();
$objPHPExcel = $objReader->load($path);
} else if ($extension == 'xls') {
$objReader = new \PHPExcel_Reader_Excel5();
$objPHPExcel = $objReader->load($path);
}
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$frag = [];
for ($i = 2; $i <= $highestRow; $i++) {
$aa['username'] = $objPHPExcel->getActiveSheet()->getCell("A" . $i)->getValue();
$aa['realname'] = $objPHPExcel->getActiveSheet()->getCell("B" . $i)->getValue();
$aa['gender'] = $objPHPExcel->getActiveSheet()->getCell("C" . $i)->getValue();
$aa['email'] = $objPHPExcel->getActiveSheet()->getCell("D" . $i)->getValue();
$aa['technical'] = $objPHPExcel->getActiveSheet()->getCell("E" . $i)->getValue();
$aa['country'] = $objPHPExcel->getActiveSheet()->getCell("F" . $i)->getValue();
$aa['company'] = $objPHPExcel->getActiveSheet()->getCell("G" . $i)->getValue();
$aa['major'] = $objPHPExcel->getActiveSheet()->getCell("H" . $i)->getValue();
$aa['field'] = $objPHPExcel->getActiveSheet()->getCell("I" . $i)->getValue();
$aa['introduction'] = $objPHPExcel->getActiveSheet()->getCell("J" . $i)->getValue();
$aa['qualifications'] = $objPHPExcel->getActiveSheet()->getCell("K" . $i)->getValue();
$frag[] = $aa;
}
return $frag;
}
/**
* 接收文件
*/
public function up_file() {
$file = request()->file('qualifications');
if ($file) {
$info = $file->move(ROOT_PATH . 'public' . DS . 'reviewer');
if ($info) {
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
} else {
return json(['code' => 1, 'msg' => $file->getError()]);
}
}
}
/**
* 接收导入文件
* @return type
*/
public function up_import() {
$file = request()->file('importExcel');
if ($file) {
$info = $file->move(ROOT_PATH . 'public' . DS . 'reviewer' . DS . 'import');
if ($info) {
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
} else {
return json(['code' => 1, 'msg' => $file->getError()]);
}
}
}
public function info(){
phpinfo();
}
public function testmail() {
$jobHandlerClassName = 'app\api\job\mail@fire';
$jobQueueName = "mail";
$data = [];
// $data['email'] = '751475802@qq.com';
$data['email'] = '13662001490@126.com';
$data['title'] = 'ttttssdsadsadsadasdss';
$tt = 'Dear Reviewer,<br>';
$tt .= 'In order to provide a better online experience for both authors and readers, the submission system was changed to new.<br>';
$tt .= 'Website was closed between 18:00 Aug. 2, 2020 to 24:00 Aug. 2, 2020 Beijing time.<br>';
$tt .= 'You could log in with your account in submission.tmrjournals.com .<br>';
$tt .= 'Your username:aaasssss<br>';
$tt .= 'Your password: 123456qwe (you could change your password in the system by yourself later.)<br>';
$tt .= 'Thank you so much for your kindly support.<br><br>';
$tt .= 'tmr<br>';
$tt .= date('Y-m-d');
$data['content'] = $tt;
$data['tmail'] = 'ghr@tmrjournals.com';
$data['tpassword'] = 'Wu999999gh';
$isPushed = Queue::push( $jobHandlerClassName , $data , $jobQueueName );
echo '<pre>';
var_dump($isPushed);
echo '</pre>';
die;
// sendEmail($v['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
}
}

View File

@@ -0,0 +1,977 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
class Article extends Controller {
protected $article_obj = '';
protected $user_obj = '';
protected $user_act_obj = '';
protected $journal_obj = '';
protected $user_log_obj = '';
protected $reviewer_major_obj = '';
protected $reviewer_to_journal_obj = '';
protected $article_msg_obj = '';
protected $article_file_obj = '';
protected $article_reviewer_obj = '';
protected $article_author_obj = '';
protected $article_transfer_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->user_act_obj = Db::name('user_act');
$this->article_obj = Db::name('article');
$this->journal_obj = Db::name('journal');
$this->user_log_obj = Db::name('user_log');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->article_msg_obj = Db::name('article_msg');
$this->article_file_obj = Db::name('article_file');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->article_author_obj = Db::name('article_author');
$this->article_transfer_obj = Db::name('article_transfer');
}
/**
* 获取文章列表(作者)
*/
public function getArticle() {
//接收参数
$data = $this->request->post();
//构造查询条件
$userres = $this->user_obj->where(['account' => $data['username']])->column('user_id');
$where['user_id'] = $userres[0];
if ($data['journal'] != 0) {
$where['t_article.journal_id'] = $data['journal'];
}
if($data['state'] != 0){
$where['t_article.state'] = $data['state'];
}
if ($data['name'] != '') {
$where['t_article.title'] = array('like', "%" . $data['name'] . "%");
}
//分页查询数据
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$res = $this->article_obj->field('t_article.*,t_journal.title journalname')
->join('t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT')
->where($where)
->order('article_id desc')
->limit($limit_start, $data['pageSize'])->select();
$count = $this->article_obj->where($where)->count();
//返回数据
return json(['total' => $count, 'data' => $res]);
}
/**
* 获取文章列表(编辑)
*/
public function getArticleForEditor() {
//接受参数
$data = $this->request->post();
//构造查询条件
if ($data['journal'] == 0) {//全部期刊
$userres = $this->user_obj->where(['account' => $data['username']])->column('user_id');
$journal_list = $this->journal_obj->where(['editor_id' => $userres[0]])->column('journal_id');
$where['t_article.journal_id'] = ['in', $journal_list];
} else {
$where['t_article.journal_id'] = $data['journal'];
}
if($data['state'] >= 0){
$where['t_article.state'] = $data['state'];
}else{
if($data['act']==1){
$where['t_article.state'] = array('in',[0,1,2,4]);
}else if($data['act']==2){
$where['t_article.state'] = array('in',[3,5]);
}
}
if ($data['name'] != '') {
$where['t_article.title'] = array('like', "%" . $data['name'] . "%");
}
//分页查询数据
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$res = $this->article_obj->field('t_article.*,t_journal.title journalname')
->join('t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT')
->where($where)
->order('t_article.article_id desc')
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->article_obj->where($where)->count();
return json(['total' => $count, 'data' => $res]);
}
/**
* 获取文章详情(作者,编辑)
*/
public function getArticleDetail() {
//接受参数
$data = $this->request->post();
//查询文章基础数据
$where['t_article.article_id'] = $data['articleId'];
$article_res = $this->article_obj->field('t_article.*,t_journal.title journalname,t_user.account')->join(array(['t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT'], ['t_user', 't_user.user_id = t_article.user_id', 'LEFT']))->where($where)->find();
//查询文章状态跟踪信息
$article_msg = $this->article_msg_obj->where(['article_id' => $data['articleId']])->select();
$suggest = '';
//如果是退修状态,显示退休信息
// if($article_res['state']==4){
// $lastbean = end($article_msg);
// $suggest = $lastbean['content'];
// }
//查询审稿人审稿建议
if($article_res['state']==4){
$suggest = $this->article_reviewer_obj->field('t_article_reviewer.*,t_article_reviewer_question.comments comments')
->join('t_article_reviewer_question','t_article_reviewer.art_rev_id=t_article_reviewer_question.art_rev_id','left')
->where('t_article_reviewer.state','<',4)
->where('t_article_reviewer.article_id',$article_res['article_id'])
->select();
}
//查询major信息
$major_data = [];
if($article_res['major_id']!=0){
$major_data['major'] = $this->reviewer_major_obj->where('major_id',$article_res['major_id'])->find();
}else{
$major_data['major'] = null;
}
if($article_res['cmajor_id']!=0){
$major_data['cmajor'] = $this->reviewer_major_obj->where('major_id',$article_res['cmajor_id'])->find();
}else{
$major_data['cmajor'] = null;
}
//查询文章作者信息
$author_res = $this->article_author_obj->where('article_id', $data['articleId'])->where('state', 0)->select();
//查询转投信息
$transfer_res = $this->article_transfer_obj->where('article_id',$data['articleId'])->select();
//查询建议转投详情
$transfer_info = $this->article_transfer_obj
->field('t_article_transfer.*,t_journal.title jourtitle')
->join('t_journal','t_journal.journal_id = t_article_transfer.journal_id','LEFT')
->where('t_article_transfer.article_id',$data['articleId'])
->where('t_article_transfer.state',2)
->find();
//更新文章操作记录状态
if ($data['human'] == 'editor') {
$up_data['author_act'] = 0;
} else {
$up_data['editor_act'] = 0;
}
$this->article_obj->where('article_id', $data['articleId'])->update($up_data);
return json(['article' => $article_res, 'msg' => $article_msg, 'authors' => $author_res,'suggest'=>$suggest,'transfer'=>$transfer_res,'transinfo'=>$transfer_info,'major'=>$major_data]);
}
/**
* 作者同意转投
*/
public function trans_manu(){
//接受参数
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
//更新文章状态
$this->article_obj->where('article_id',$data['article_id'])->update(['journal_id'=>$data['journal_id'],'editor_id'=>$journal_info['editor_id'],'state'=>1]);
//跟新转投表状态
$this->article_transfer_obj->where('transfer_id',$data['transfer_id'])->update(['state'=>1]);
//添加文章状态信息
$insert_data['article_id'] = $data['article_id'];
$insert_data['content'] = 'manuscript transfer to :'.$journal_info['title'];
$insert_data['state_from'] = $article_info['state'];
$insert_data['state_to'] = 1;
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
//发送邮件提醒编辑有新的转投稿件
$tt1 = 'Dear editor';
$tt1 .= 'Please check the new transfer manuscript in the submission system.';
sendEmail($editor_info['email'],$journal_info['title'], $journal_info['title'], $tt1, $journal_info['email'], $journal_info['epassword']);
//发送消息给编辑
add_usermsg($journal_info['editor_id'], 'New transfer manuscript ', '/articleDetailEditor?id=' . $article_info['article_id']);
return json(['code'=>0]);
}
/**
* 修改文章详情(作者)
*/
public function editArticle() {
//接受参数查询信息
$data = $this->request->post();
// return json($data);
// $data['abstrart'] = "dsadsadsadsa";
// $data['accept_sn'] = "20200811001";
// $data['articleId'] = 7;
// $data['authorList'] = [
// [
// 'address'=>"dsad",
// 'art_aut_id'=>5,
// 'company'=>"sads",
// 'country'=>"China",
// 'department'=>"adsa",
// 'email'=>"dsadsadsa",
// 'firstname'=>"dsadsa",
// 'isReport'=>'true',
// 'isSuper'=>"true",
// 'lastname'=>"dsadsa",
// 'title'=>"Ph.D."
// ],
// [
// 'address'=>"",
// 'art_aut_id'=>6,
// 'company'=>"dsadsa",
// 'country'=>"Angola",
// 'department'=>"dsa",
// 'email'=>"dsadsa",
// 'firstname'=>"dsad7",
// 'isReport'=>"false",
// 'isSuper'=>"true",
// 'lastname'=>"sada",
// 'title'=>"Associate Prof."
// ]
// ];
// $data['coverLetter']='';
// $data['ctime']="1597138197";
// $data['fund']="sadsadasd";
// $data['journal']="20";
// $data['journalname']="Infectious Diseases Research";
// $data['keyWords']="dsadsad";
// $data['manuscirpt']='';
// $data['picturesAndTables']='';
// $data['state']='4';
// $data['title']="dsadsadsa";
// $data['username']="wangjinlei";
$username = $data['username'];
$user_res = $this->user_obj->where(['account' => $username])->find();
$article_old_info = $this->article_obj->where('article_id',$data['articleId'])->find();
Db::startTrans();
//更新文章信息
$inset_data['keywords'] = $data['keyWords'];
$inset_data['fund'] = $data['fund'];
$inset_data['abstrart'] = $data['abstrart'];
$inset_data['author_act'] = 1;
$inset_data['state'] = $article_old_info['accept_sn']==''?0:1;
$where['article_id'] = $data['articleId'];
$up_res = $this->article_obj->where($where)->update($inset_data);
$article_info = $this->article_obj->where($where)->find();
//更新作者信息
$aids = [];
foreach ($data['authorList'] as $v) {
if (isset($v['art_aut_id'])) {//改
$up['art_aut_id'] = $aids[] = $v['art_aut_id'];
$up['firstname'] = $v['firstname'];
$up['lastname'] = $v['lastname'];
$up['company'] = $v['company'];
$up['department'] = $v['department'];
$up['author_title'] = $v['title'];
$up['country'] = $v['country'];
$up['email'] = $v['email'];
$up['address'] = $v['address'];
$up['is_super'] = $v['isSuper'] == 'true'?1:0;
$up['is_report'] = $v['isReport'] == 'true'?1:0;
$this->article_author_obj->update($up);
} else {//增
if ($v['firstname'] == '') {
continue;
}
$ins['article_id'] = $data['articleId'];
$ins['firstname'] = $v['firstname'];
$ins['lastname'] = $v['lastname'];
$ins['company'] = $v['company'];
$ins['department'] = $v['department'];
$ins['author_title'] = $v['title'];
$ins['country'] = $v['country'];
$ins['email'] = $v['email'];
$ins['address'] = $v['address'];
$ins['is_super'] = $v['isSuper'] == 'true'?1:0;
$ins['is_report'] = $v['isReport'] == 'true'?1:0;
$aids[] = $this->article_author_obj->insertGetId($ins);
}
}
//删
$this->article_author_obj->where('article_id', $data['articleId'])->where('art_aut_id', 'not in', $aids)->update(['state' => 1]);
//增加article_msg
$insmsg_data['article_id'] = $data['articleId'];
$insmsg_data['content'] = '';
$insmsg_data['state_from'] = $article_old_info['state'];
$insmsg_data['state_to'] = $article_old_info['accept_sn']==''?0:1;
$insmsg_data['ctime'] = time();
$msg_res = $this->article_msg_obj->insert($insmsg_data);
//发送邮件
$editor_info = $this->user_obj->where('user_id',$article_old_info['editor_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_old_info['journal_id'])->find();
$tt = 'Dear editor,<br>';
$tt .= 'The author changed the manuscripts status, please check.<br><br>';
$tt .= 'TMR Publishing Group';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
//记录历史file信息
$res1 = self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $data['coverLetter'], 'coverLetter');
$res2 = true;
if(isset($data['picturesAndTables'])){
foreach ($data['picturesAndTables'] as $v){
$res2=$res2?self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $v, 'picturesAndTables'):false;
}
}
// self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $data['picturesAndTables'], 'picturesAndTables');
$res3=self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $data['manuscirpt'], 'manuscirpt');
$res4=self::save_article_file($data['articleId'],$user_res['user_id'],$user_res['account'],$data['totalpage'],'totalpage');
//增加用户操作log
$log_data['user_id'] = $article_info['user_id'];
$log_data['type'] = 1;
$log_data['content'] = $data['username'] . "(" . $user_res['realname'] . "),修改了一篇文章:" . $article_info['title'] . ",时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$log_res=$this->user_log_obj->insert($log_data);
//增加usermsg
$umsg_res=add_usermsg($article_info['editor_id'], 'The manuscript has new process: ' . $article_info['title'], '/articleDetailEditor?id=' . $article_info['article_id']);
if($up_res&&$msg_res&&$res1&&$res2&&$res3&&$res4&&$log_res&&$umsg_res){
Db::commit();
return json(['code' => 0]);
}else{
Db::rollback();
return json(['code' => 1]);
}
}
/**
* 修改文章的作者(作者)
*/
public function saveAuthor() {
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id',$data['articleId'])->find();
//更新作者(增删改)
$aids = [];
foreach ($data['authorList'] as $v) {
if (isset($v['art_aut_id'])) {//改
$up['art_aut_id'] = $aids[] = $v['art_aut_id'];
$up['author'] = $v['author'];
$up['company'] = $v['company'];
$up['email'] = $v['email'];
$up['address'] = $v['address'];
$up['is_super'] = $v['is_super'] == 'true' ? 1 : 0;
$up['is_report'] = $v['is_report'] == 'true'?1:0;
$this->article_author_obj->update($up);
} else {//增
if ($v['author'] == '') {
continue;
}
$ins['author'] = $v['author'];
$ins['article_id'] = $data['articleId'];
$ins['company'] = $v['company'];
$ins['email'] = $v['email'];
$ins['address'] = $v['address'];
$ins['is_super'] = $v['is_super'] == 'true' ? 1 : 0;
$ins['is_report'] = $v['is_report'] == 'true'?1:0;
$aids[] = $this->article_author_obj->insertGetId($ins);
}
}
//删
$this->article_author_obj->where('article_id', $data['articleId'])->where('art_aut_id', 'not in', $aids)->update(['state' => 1]);
//更新文章操作状态
$this->article_obj->where('article_id',$data['articleId'])->update(['author_act'=>1]);
//发送邮件通知编辑
$editor_info = $this->user_obj->where('user_id',$article_info['editor_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$tt = 'Dear editor,<br>';
$tt .= 'The author changed the manuscripts information, please check.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
//添加usermsg
add_usermsg($article_info['editor_id'], 'Manuscript authors be changed,please contact the author to confirm.', 'articleDetailEditor?id='.$data['articleId']);
return json(['code' => 0]);
}
/**
* 修改文章状态(编辑)
*/
public function editArticleEditor() {
//接受参数,查询信息
$data = $this->request->post();
$where_editor['account'] = $data['editname'];
$editor_info = $this->user_obj->where($where_editor)->find();
$where_article['article_id'] = $data['articleId'];
$article_info = $this->article_obj->where($where_article)->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$transfer_list = $this->article_transfer_obj->where('article_id',$data['articleId'])->where('state',0)->select();
$user_info = $this->user_obj->where(['user_id' => $article_info['user_id']])->find();
// $sn_content = '';//显示接收sn信息
//
// //接受文章时,生成流水号
// if ($article_info['state'] == 0 && $data['state'] == 1) {
// $update_data['accept_sn'] = getArticleSN($journal_info['abbr'],$article_info['type']);
// $sn_content .= 'your Manuscript ID: '.$update_data['accept_sn'].' ';
// }
if($data['state']==3 && count($transfer_list)>0){
//查询转投期刊信息
$transfer_journal = $this->journal_obj->where('journal_id',$transfer_list[0]['journal_id'])->find();
//转投
$this->article_obj->where('article_id',$data['articleId'])->update(['state'=>1,'journal_id'=>$transfer_list[0]['journal_id'],'editor_id'=>$transfer_journal['editor_id']]);
//转投信息表信息状态改变
$this->article_transfer_obj->where('transfer_id',$transfer_list[0]['transfer_id'])->update(['state'=>1]);
//查找转投journal信息
$tran_journal = $this->journal_obj->where('journal_id',$transfer_list[0]['journal_id'])->find();
//转投后的作者信息
$trans_editor_info = $this->user_obj->where('user_id',$transfer_journal['editor_id'])->find();
//添加文章状态信息
$insert_data['article_id'] = $data['articleId'];
$insert_data['content'] = 'manuscript transfer to :'.$tran_journal['title'];
$insert_data['state_from'] = $article_info['state'];
$insert_data['state_to'] = 1;
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
//发送邮件提醒转投给作者
$tt = '"'.$article_info['title'].'"<br>';
$tt .= $article_info['accept_sn'].'<br>';
$tt .= 'journal:'.$journal_info['title'].'<br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>';
$tt .= 'Thank you for submitting your paper to '.$journal_info['title'].'. Your manuscript has undergone review.<br>';
$tt .= 'Unfortunately the editors feel that '.$journal_info['title'].' is not the appropriate venue for your manuscript. I am writing just to follow up on the suggestion from the editor of Traditional Medicine Research that you might be interested in submitting your paper to '.$tran_journal['title'].' instead.<br><br>Yours sincerely,<br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
$tt .= $journal_info['title'].'<br>';
$tt .= 'Email: '.$journal_info['email'].'<br>';
$tt .= 'Website: '.$tran_journal['website'];
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//发送邮件提醒编辑有新的转投稿件
$tt1 = 'Dear editor';
$tt1 .= 'Please check the new transfer manuscript in the submission system.';
sendEmail($trans_editor_info['email'],$journal_info['title'], $journal_info['title'], $tt1, $journal_info['email'], $journal_info['epassword']);
//增加usermsg
add_usermsg($tran_journal['editor_id'], 'New transfer manuscript ', '/articleDetailEditor?id=' . $article_info['article_id']);
return json(['code'=>0]);
}else{
//添加文章状态信息(如果状态未更新可做通话用,并结束操作)
$insert_data['article_id'] = $data['articleId'];
$insert_data['content'] = $data['editormsg'];
$insert_data['state_from'] = $article_info['state'];
$insert_data['state_to'] = $data['state'];
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
if ($article_info['state'] == $data['state']) {
$this->article_obj->where($where_article)->update(['editor_act'=>1]);
return json(['code' => 0]);
}
//更新文章状态
$update_data['state'] = $data['state'];
$update_data['editor_act'] = 1;
$this->article_obj->where($where_article)->update($update_data);
}
//发送文章状态更改邮件
if($data['state']==3){//拒稿
if($data['trsjournal']==0){
$tt = '"'.$article_info['title'].'"<br>';
$tt .= $article_info['accept_sn'].'<br>';
$tt .= 'journal:'.$journal_info['title'].'<br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>';
$tt .= 'Thank you for submitting your paper to '.$journal_info['title'].'. Your manuscript has undergone review.<br>';
$tt .= 'Unfortunately the editors feel that '.$journal_info['title'].' is not the appropriate venue for your manuscript,'
. ' and we are returning your manuscript to you so that you can submit it to another journal without delay. '
. '<br><br>Yours sincerely,<br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
}else{//转投
//查找转投journal信息
$trans_journal = $this->journal_obj->where('journal_id',$data['trsjournal'])->find();
$tt = '"'.$article_info['title'].'"<br>';
$tt .= $article_info['accept_sn'].'<br>';
$tt .= 'journal:'.$journal_info['title'].'<br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>';
$tt .= 'Thank you for submitting your paper to '.$journal_info['title'].'. Your manuscript has undergone review.<br>';
$tt .= 'Unfortunately the editors feel that '.$journal_info['title'].' is not the appropriate venue for your manuscript. I am writing just to follow up on the suggestion from the editor of Traditional Medicine Research that you might be interested in submitting your paper to '.$trans_journal['title'].' instead.<br><br>';
$tt .= 'If you choose to pursue publication in '.$trans_journal['title'].', please submit your manuscript to ('.$trans_journal['website'].').';
$tt .= '<br><br>Yours sincerely,<br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
}
}else if($data['state']==5){//录用
$tt = 'Manuscript ID: '.$article_info['accept_sn'].'<br>';
$tt .= 'Manuscript Title: '.$article_info['title'].'<br>';
$tt .= 'Authors Name: '.self::getArticleAuthors($article_info['article_id']).'<br><br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>It is a distinct pleasure to inform you that your manuscript has been accepted for publication in '.$journal_info['title'].' (ISSN '.$journal_info['issn'].').<br> The editor of TMR will contact you further by email soon.<br><br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
}else if($data['state']==4){//退修
$tt = $article_info['accept_sn'].'<br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>';
$tt .= 'Thank you for submitting the manuscript to '.$journal_info['title'].'. <br>';
$tt .= 'Please find the new comments in the "<a href="http://submission.tmrjournals.com/submission?journal='.$journal_info['alias'].'">AuthorCenter</a>", Please submit your revised manuscript within two weeks.<br><br>';
$tt .= 'If you need more time to revise, you can send E-mial to tell us.<br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
}else{
$tt = '"'.$article_info['title'].'"<br>';
$tt .= $article_info['accept_sn'].'<br>';
$tt .= 'journal:'.$journal_info['title'].'<br><br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>Please check the new status of your manuscript online.<br><br>';
}
$tt .= $journal_info['title'].'<br>';
$tt .= 'Email: '.$journal_info['email'].'<br>';
$tt .= 'Website: '.$journal_info['website'];
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//转投操作
if($data['trsjournal']!=0){
$tran_data['article_id'] = $data['articleId'];
$tran_data['journal_id'] = $data['trsjournal'];
$tran_data['ctime'] = time();
$tran_data['state'] = 2;
$this->article_transfer_obj->insert($tran_data);
}
//增加用户操作log
$log_data['user_id'] = $editor_info['user_id'];
$log_data['type'] = 1;
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),更改了一篇文章:(" . $article_info['title'] . ")的状态,更改时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//增加usermsg
add_usermsg($article_info['user_id'], 'Your manuscript has new process: ' . $article_info['title'] , '/articleDetail?id=' . $article_info['article_id']);
return json(['code' => 0]);
}
/**
* 编辑文章备注
*/
public function editArticleRemark(){
//接受参数
$data = $this->request->post();
$this->article_obj->where('article_id',$data['articleId'])->update(['remarks'=>$data['content']]);
return json(['code'=>0]);
}
/**
* 更改重复率(编辑)
*/
public function changeRepetition(){
//接受参数
$data = $this->request->post();
$this->article_obj->where('article_id',$data['articleId'])->update(['repetition'=>$data['repefen'],'repeurl'=>$data['zipurl']]);
return json(['code'=>0]);
}
/**
* 更改文章详情(编辑)
*/
public function changeArticleFileEditor() {
//接受参数查询信息
$data = $this->request->post();
$article_info = $this->article_obj->where(['article_id' => $data['articleId']])->find();
// $author_info = $this->user_obj->where('user_id',$article_info['user_id'])->find();
$editor_info = $this->user_obj->where(['user_id' => $article_info['editor_id']])->find();
// $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
//存储文件入文件表
// self::save_article_file($data['articleId'], $editor_info['user_id'], $editor_info['account'], $data['coverLetter'], 'coverLetter');
// self::save_article_file($data['articleId'], $editor_info['user_id'], $editor_info['account'], $data['picturesAndTables'], 'picturesAndTables');
self::save_article_file($data['articleId'], $editor_info['user_id'], $editor_info['account'], $data['manuscirpt'], 'manuscirpt');
//更新文章状态(提醒用户)
$this->article_obj->where('article_id', $data['articleId'])->update(['editor_act' => 1]);
//添加article_msg信息
// $insmsg_data['article_id'] = $data['articleId'];
// $insmsg_data['content'] = '';
// $insmsg_data['state_from'] = $article_info['state'];
// $insmsg_data['state_to'] = 4;
// $insmsg_data['ctime'] = time();
// $this->article_msg_obj->insert($insmsg_data);
//发送email提醒用户
// $tt = $article_info['accept_sn'].'<br>';
// $tt .= 'Dear author,<br>';
// $tt .= 'Thanks for submitting the manuscript to '.$journal_info['title'].'. <br>';
// $tt .= 'Here are the comments in the "<a href="http://submission.tmrjournals.com/submission?journal='.$journal_info['alias'].'">AuthorCenter</a>", Please submit your revised manuscript within two weeks.<br><br>';
// $tt .= 'Sincerely,<br>Editorial Office<br>';
// $tt .= $journal_info['title'].'<br>';
// $tt .= 'Email:'.$journal_info['email'].'<br>';
// $tt .= 'Website: '.$journal_info['website'];
// sendEmail($author_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//增加用户操作log
$log_data['user_id'] = $editor_info['user_id'];
$log_data['type'] = 1;
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),更改了一篇文章:" . $data['title'] . ",上传时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//增加usermsg
add_usermsg($article_info['user_id'], 'Your manuscript has new process: ' . $article_info['title'], '/articleDetail?id=' . $article_info['article_id']);
return json(['code' => 0]);
}
/**
* 添加文章审稿实例(编辑)
*/
public function addArticleReviewer() {
//接收参数,查询数据
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id', $data['articleId'])->find();
$editor_info = $this->user_obj->where('user_id', $article_info['editor_id'])->find();
$reviewer_info = $this->user_obj->where('user_id', $data['uid'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
//增加信息到文章审稿表
$insert_data['reviewer_id'] = $data['uid'];
$insert_data['article_id'] = $data['articleId'];
$insert_data['editor_act'] = 1;
$insert_data['ctime'] = time();
$res = $this->article_reviewer_obj->insertGetId($insert_data);
//修改文章状态->审稿中
$this->article_obj->where('article_id',$data['articleId'])->update(['state'=>2]);
//添加article_msg信息
$insmsg_data['article_id'] = $data['articleId'];
$insmsg_data['content'] = '';
$insmsg_data['state_from'] = $article_info['state'];
$insmsg_data['state_to'] = 2;
$insmsg_data['ctime'] = time();
$this->article_msg_obj->insert($insmsg_data);
//发送email提醒审稿员
$tt = $article_info['accept_sn'] . '<br>';
$tt .= 'Dear '.$reviewer_info['realname'].'<br><br>';
$tt .= 'The manuscript entitled “'.$article_info['title'].'” has'
. ' been submitted to the journal '.$journal_info['title'].'. The Editor-in-Chief would'
. ' be most grateful if you could offer an opinion regarding its suitability for publication'
. ' in the journal '.$journal_info['title'].'. <br>';
$tt .= 'Please bring into our knowledge if there is any potential Conflict of Interest. If you agree to review this manuscript, we ask you to complete your review and submit it by submission system within 10 days of receipt of the manuscript.<br><br>';
$tt .= 'Thank you for your consideration.<br> Look forward for your reply.<br>';
$tt .= '<a href="http://submission.tmrjournals.com/submission?journal='.$journal_info['alias'].'">ReviewerCenter</a><br>';
$tt .= 'Your username:'.$reviewer_info['account'].'<br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
$tt .= $journal_info['title'].'<br>';
$tt .= 'Email:'.$journal_info['email'].'<br>';
$tt .= 'Website:'.$journal_info['website'];
sendEmail($reviewer_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//记录userlog
$log_data['user_id'] = $article_info['editor_id'];
$log_data['type'] = 2;
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),添加了一个文章审稿实例:(" . $article_info['title'] . "-----" . $reviewer_info['account'] . "),添加时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//添加usermsg
add_usermsg($data['uid'], 'You have new manuscript to be approved', '/reviewerArticleDetail?id=' . $res);
return json(['code' => 0]);
}
/**
* 添加文章(作者)
*/
public function addArticle() {
//接受参数,查询信息
$data = $this->request->post();
// return json($data);
// $data['abstrart'] = '大萨达撒多';
// $data['authorList'] = [
// [
// 'address'=>'dsadsa',
// 'company'=>'dasdsa',
// 'country'=>'china',
// 'department'=>'dsadsa',
// 'email'=>'6541654@qq.com',
// 'firstname'=>'dsadsa',
// 'isReport'=>'true',
// 'isSuper'=>'true',
// 'lastname'=>'dsadsa',
// 'title'=>'Ph.D.'
// ]
// ];
// $data['coverLetter'] = '';
// $data['fund'] = 'dsads';
// $data['journal'] = 1;
// $data['keyWords'] = 'dsads';
// $data['manuscirpt'] = "manuscirpt/20200727/cd67d8e8f944b5f1589cceb8e1aa967c.pdf";
// $data['picturesAndTables'] = [];
// $data['title'] = "大萨达撒多";
// $data['username'] = "wangjinlei";
$user_res = $this->user_obj->where('account', $data['username'])->find();
$journal_info = $this->journal_obj->where('journal_id', $data['journal'])->find();
Db::startTrans();
//添加文章基础信息
$inset_data['user_id'] = $user_res['user_id'];
$inset_data['journal_id'] = $data['journal'];
$inset_data['editor_id'] = $journal_info['editor_id'];
$inset_data['title'] = $data['title'];
$inset_data['keywords'] = $data['keyWords'];
$inset_data['fund'] = $data['fund'];
$inset_data['accept_sn'] = getArticleSN($journal_info['abbr'],$data['type']);
$inset_data['type'] = $data['type'];
$inset_data['major_id'] = $data['major'];
$inset_data['cmajor_id'] = $data['cmajor'];
$inset_data['approval'] = $data['approval']=='true'?1:0;
$inset_data['abstrart'] = $data['abstrart'];
$inset_data['author_act'] = 1;
$inset_data['ctime'] = time();
$res = $this->article_obj->insertGetId($inset_data);
//上传文章作者信息
$authors = [];
foreach ($data['authorList'] as $v) {
if ($v['firstname'] == '') {
continue;
}
$i['article_id'] = $res;
$i['firstname'] = $v['firstname'];
$i['lastname'] = $v['lastname'];
$i['company'] = $v['company'];
$i['department'] = $v['department'];
$i['author_title'] = $v['title'];
$i['country'] = $v['country'];
$i['email'] = $v['email'];
$i['address'] = $v['address'];
$i['is_super'] = $v['isSuper'] == 'true' ? 1 : 0;
$i['is_report'] = $v['isReport'] == 'true'?1:0;
$authors[] = $i;
}
$res_author = $this->article_author_obj->insertAll($authors);
//增加转投信息
$transr = true;
if($data['istransfer']=='true'){
foreach ($data['checkedjours'] as $val){
$trans_insert['article_id'] = $res;
$trans_insert['journal_id'] = $val;
$trans_insert['ctime'] = time();
$transr = $transr?$this->article_transfer_obj->insert($trans_insert):false;
}
}
//增加articlefile表的信息
$res_file1 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['coverLetter'], 'coverLetter');
$res_file2 = true;
if(isset($data['picturesAndTables'])){
foreach ($data['picturesAndTables'] as $v){
$res_file2 = $res_file2?self::save_article_file($res, $user_res['user_id'], $user_res['account'], $v, 'picturesAndTables'):false;
}
}
$res_file4 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['totalpage'], 'totalpage');
$res_file3 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['manuscirpt'], 'manuscirpt');
//发送邮件到编辑,提醒有待审文章
$editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
$tt = 'Dear editor,<br>';
$tt .= 'Please check the new manuscript in the submission system.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
//增加用户操作log
$log_data['user_id'] = $user_res['user_id'];
$log_data['type'] = 0;
$log_data['content'] = $user_res['account'] . "(" . $user_res['realname'] . "),上传了一篇文章:" . $data['title'] . ",上传时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$res_log = $this->user_log_obj->insert($log_data);
//增加usermsg
$res_msg = add_usermsg($journal_info['editor_id'], 'New manuscript', '/articleDetailEditor?id=' . $res);
if ($res && $res_author && $transr && $res_file1 && $res_file2 && $res_file3 && $res_file4 && $res_log && $res_msg) {
Db::commit();
return json(['code' => 0]);
} else {
Db::rollback();
return json(['code' => 1]);
}
}
/**
* 作者发送消息
*/
public function authorMessage(){
$data = $this->request->post();
$insert['article_id'] = $data['articleId'];
$insert['content'] = $data['content'];
$insert['ftype'] = 1;
$insert['ctime'] = time();
$this->article_msg_obj->insert($insert);
return json(['code'=>0]);
}
/**
* 获取期刊列表
*/
public function getJournal() {
$username = $this->request->post('username');
$where = [];
if ($username) {
$uidres = $this->user_obj->where(['account' => $username])->column('user_id');
$where['editor_id'] = $uidres[0];
}
$list = $this->journal_obj->where($where)->select();
return json($list);
}
/**
* 获取文章历史上传file列表
*/
public function getFilelistByArticleID() {
$article_id = $this->request->post('articleId');
$where['article_id'] = $article_id;
$res = $this->article_file_obj->where($where)->select();
$frag = [];
foreach ($res as $v) {
$frag[$v['type_name']][] = $v;
}
return json($frag);
}
/**
* 上传文章的文件
*/
public function up_file($type) {
$file = request()->file($type);
if ($file) {
$info = $file->move(ROOT_PATH . 'public' . DS . $type);
if ($info) {
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
} else {
return json(['code' => 1, 'msg' => $file->getError()]);
}
}
}
/**
* 获取文章审稿实例列表
*/
public function getReviewerList() {
$data = $this->request->post();
$limit_start = $data['pageIndex'] == 1 ? 0 : ($data['pageIndex'] - 1) * $data['pageSize'] - 1;
$where['t_article_reviewer.article_id'] = $data['articleId'];
$res = $this->article_reviewer_obj->field('t_article_reviewer.*,t_user.account reviewer,t_user_reviewer_info.country country,t_user_reviewer_info.field,t_user_reviewer_info.company,t_reviewer_major.title major_title,t_reviewer_major.ctitle major_ctitle')->join('t_user', 't_article_reviewer.reviewer_id = t_user.user_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')->where($where)->limit($limit_start, $data['pageSize'])->select();
$count = $this->article_reviewer_obj->where($where)->count();
if ($res) {
return json(['code' => 0, 'data' => $res, 'totle' => $count]);
} else {
return json(['code' => 1]);
}
}
/**
* 根据期刊别名获取期刊信息
*/
public function getJournalByAlias(){
//接收参数
$data = $this->request->post();
$res = $this->journal_obj->where('alias',$data['alias'])->find();
return json($res);
}
/**
* 获取审核人详情
*/
public function getReviewerdetail() {
$uid = $this->request->post('uid');
$res = $this->user_obj->field('t_user.*,t_user_reviewer_info.*,t_reviewer_major.title major_title')->join('t_user_reviewer_info', 't_user.user_id = t_user_reviewer_info.reviewer_id', 'LEFT')->join('t_reviewer_major', 't_reviewer_major.major_id = t_user_reviewer_info.major', 'LEFT')->where('t_user.user_id', $uid)->find();
return json(['code' => 0, 'data' => $res]);
}
/**
* 获取文章审核员list
*/
public function getArticleReviewerList() {
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id', $data['articleId'])->find();
$revids = $this->reviewer_to_journal_obj->where('journal_id', $article_info['journal_id'])->column('reviewer_id');
$noids = $this->article_reviewer_obj->where('article_id', $data['articleId'])->column('reviewer_id');
if ($noids != null) {
$where['t_user.user_id'] = [['in', $revids], ['not in', $noids]];
} else {
$where['t_user.user_id'] = ['in', $revids];
}
$res = $this->user_obj->field('t_user.*,t_user_reviewer_info.*')->join('t_user_reviewer_info', 't_user.user_id = t_user_reviewer_info.reviewer_id', 'LEFT')->where($where)->select();
if ($res) {
return json(['code' => 0, 'data' => $res]);
} else {
return json(['code' => 1]);
}
}
/**
* 存储article文件历史信息
*/
private function save_article_file($article_id, $user_id, $username, $url, $type_name) {
//首先确定数据库里面是否存在此数据
$res = $this->article_file_obj->where(['file_url' => $url])->find();
if ($res) {
return true;
}else if($type_name=='picturesAndTables' && $url == ''){
return true;
}else if($type_name=='coverLetter' && $url == ''){
return true;
}
$insert_data['article_id'] = $article_id;
$insert_data['user_id'] = $user_id;
$insert_data['username'] = $username;
$insert_data['file_url'] = $url;
$insert_data['type_name'] = $type_name;
$insert_data['ctime'] = time();
return $this->article_file_obj->insert($insert_data);
}
/**
* 获取文章作者字符串
* @param type $article_id
*/
private function getArticleAuthors($article_id){
$res = $this->article_author_obj->where('article_id',$article_id)->where('state',0)->select();
$frag = '';
foreach ($res as $v){
$frag .= $v['firstname'].$v['lastname'].',';
}
return substr($frag, 0,-1);
}
}

View File

@@ -0,0 +1,277 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
/**
* Description of Auto
*
* @author jgll2
*/
class Auto extends Controller {
//put your code here
protected $article_obj = '';
protected $article_reviewer_obj = '';
protected $user_obj = '';
protected $rev_to_jour_obj = '';
protected $reviewer_obj = '';
protected $journal_obj = '';
protected $article_msg_obj = '';
protected $user_log_obj = '';
protected $reviewer_info_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->article_obj = Db::name('article');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->user_obj = Db::name('user');
$this->rev_to_jour_obj = Db::name('reviewer_to_journal');
$this->journal_obj = Db::name('journal');
$this->reviewer_obj = Db::name('article_reviewer');
$this->article_msg_obj = Db::name('article_msg');
$this->user_log_obj = Db::name('user_log');
$this->reviewer_info_obj = Db::name('user_reviewer_info');
}
/**
* 自动审稿主方法
*/
public function initAutoReview() {
//查找对应状态的article列表
$alist = $this->article_obj->where('state', 2)->select();
foreach ($alist as $v) {
Queue::push('app\api\job\review@fire', $v, "emailtest");
}
}
public function testrev(){
$a = $this->article_obj->where('article_id',261)->find();
$this->checkrev($a);
}
/**
* 处理过期审稿
*/
public function overdue_reviewer() {
$where['state'] = 0;
$where['ctime'] = ['lt', time() - 3600 * 24 * 14];
$revs = $this->article_reviewer_obj->where($where)->select();
foreach ($revs as $v) {
//审稿人失败次数+1
$this->user_obj->where('user_id', $v['reviewer_id'])->setInc('rd_num');
//此审稿案例超时
$this->article_reviewer_obj->where('art_rev_id', $v['art_rev_id'])->update(['state' => 4]);
}
}
public function testmail() {
$maidata['email'] = '751475802@qq.com';
$maidata['title'] = 'test'.date('Ymd His', time());
$maidata['content'] = 'dsadsaas';
$maidata['tmail'] = 'tmrcancer@tmrjournals.com';
$maidata['tpassword'] = 'Wu999999tmrcance';
Queue::push('app\api\job\mail@fire', $maidata, "mail");
}
/**
* 审查文章审稿人状态,返回结果
*/
public function checkrev($data) {
//查找审稿案例状态
$rev_list = $this->reviewer_obj->where('article_id', $data['article_id'])->where('state','<>',4)->select();
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
$user_info = $this->user_obj->where('user_id',$data['user_id'])->find();
$editor_info = $this->user_obj->where('user_id',$data['editor_id'])->find();
//分析审稿人状况
$all = count($rev_list);
$s_num = 0; //初始数量
$p_num = 0; //通过数量
$np_num = 0; //不通过数量
foreach ($rev_list as $v) {
if ($v['state'] == 0) {
$s_num++;
} else if ($v['state'] == 1 || $v['state'] == 3) {
$p_num++;
} else {
$np_num++;
}
}
//分情况执行
if ($all == 0) {
//分配两次审稿人
$this->add_reviewer($data);
$this->add_reviewer($data);
return true;
} elseif ($all == 1) {
//分配一次审稿人
$this->add_reviewer($data);
return true;
} elseif ($all == 2) {
if ($s_num > 0) {//不做任何处理
return true;
}
if ($p_num == 2) {//通过
//更新文章状态
$this->article_obj->where('article_id', $data['article_id'])->update(['state'=>4,'editor_act'=>1]);
//添加文章msg信息
$insert_data['article_id'] = $data['article_id'];
$insert_data['content'] = 'Review completed';
$insert_data['state_from'] = $data['state'];
$insert_data['state_to'] = 4;
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
//添加通知信息
add_usermsg($data['user_id'], 'Your manuscript has new process', '/articleDetail?id=' . $data['article_id']);
//发送邮件通知编辑
$tt = $data['accept_sn'].'<br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>';
$tt .= 'Thank you for submitting the manuscript to '.$journal_info['title'].'. <br>';
$tt .= 'Please find the new comments in the "<a href="http://submission.tmrjournals.com/submission?journal='.$journal_info['alias'].'">AuthorCenter</a>", Please submit your revised manuscript within two weeks.<br><br>';
$tt .= 'If you need more time to revise, you can send E-mial to tell us.<br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
$tt .= $journal_info['title'].'<br>';
$tt .= 'Email: '.$journal_info['email'].'<br>';
$tt .= 'Website: '.$journal_info['website'];
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
} elseif ($np_num == 2) {//不通过
//发送邮件通知编辑
$tt = 'Reviewers final opinions on the manuscript ID'.$data['accept_sn'].' are rejection. Please login and deal with the next step of this manuscript manually.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
} else {//一样一个增加一个审稿案例
$this->add_reviewer($data);
return true;
}
} elseif ($all == 3) {
if ($s_num > 0) {//不做任何处理
return true;
}
if ($p_num == 2) {//通过
//更新文章状态
$this->article_obj->where('article_id', $data['article_id'])->update(['state'=>4,'editor_act'=>1]);
//添加文章msg信息
$insert_data['article_id'] = $data['article_id'];
$insert_data['content'] = 'Review completed';
$insert_data['state_from'] = $data['state'];
$insert_data['state_to'] = 4;
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
//添加通知信息
add_usermsg($data['user_id'], 'Your manuscript has new process', '/articleDetail?id=' . $data['article_id']);
//发送邮件通知编辑
$tt = $data['accept_sn'].'<br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>';
$tt .= 'Thank you for submitting the manuscript to '.$journal_info['title'].'. <br>';
$tt .= 'Please find the new comments in the "<a href="http://submission.tmrjournals.com/submission?journal='.$journal_info['alias'].'">AuthorCenter</a>", Please submit your revised manuscript within two weeks.<br><br>';
$tt .= 'If you need more time to revise, you can send E-mial to tell us.<br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
$tt .= $journal_info['title'].'<br>';
$tt .= 'Email: '.$journal_info['email'].'<br>';
$tt .= 'Website: '.$journal_info['website'];
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
} else {//不通过
//发送邮件通知编辑
$tt = 'Reviewers final opinions on the manuscript ID'.$data['accept_sn'].' are rejection. Please login and deal with the next step of this manuscript manually.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
}
}
}
/**
* 增加一个审稿人
*/
public function add_reviewer($article) {
$journal_info = $this->journal_obj->where('journal_id', $article['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id', $article['editor_id'])->find();
//根据文章筛选候选人
$reviewer = $this->chose_reviewer($article);
if ($reviewer == null) {//没有查询到审稿人,执行提醒操作
//发送邮件到编辑,提醒需要手动添加审稿案例
$tt = 'Dear editor,<br>';
$tt .= 'There are no enough research area related reviewers in the reviewer list for manuscript ID ' . $article['accept_sn'] . ', please add reviewers for your journal or manual deal with this problem.<br><br>';
$tt .= 'TMR Publishing Group';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
} else {//查询到审稿人,执行添加操作
//将审稿时间定义至现在
$this->user_obj->where('user_id', $reviewer['user_id'])->update(['rtime' => time()]);
$article_info = $article;
$reviewer_info = $reviewer;
//增加信息到文章审稿表
$insert_data['reviewer_id'] = $reviewer['user_id'];
$insert_data['article_id'] = $article_info['article_id'];
$insert_data['editor_act'] = 1;
$insert_data['ctime'] = time();
$res = $this->article_reviewer_obj->insertGetId($insert_data);
//修改文章状态->审稿中
$this->article_obj->where('article_id', $article_info['article_id'])->update(['state' => 2]);
//添加article_msg信息
$insmsg_data['article_id'] = $article_info['article_id'];
$insmsg_data['content'] = '';
$insmsg_data['state_from'] = $article_info['state'];
$insmsg_data['state_to'] = 2;
$insmsg_data['ctime'] = time();
$this->article_msg_obj->insert($insmsg_data);
//发送email提醒审稿员
$tt = $article_info['accept_sn'] . '<br>';
$tt .= 'Dear ' . $reviewer_info['realname'] . '<br><br>';
$tt .= 'The manuscript entitled “' . $article_info['title'] . '” has'
. ' been submitted to the journal ' . $journal_info['title'] . '. The Editor-in-Chief would'
. ' be most grateful if you could offer an opinion regarding its suitability for publication'
. ' in the journal ' . $journal_info['title'] . '. <br>';
$tt .= 'Please bring into our knowledge if there is any potential Conflict of Interest. If you agree to review this manuscript, we ask you to complete your review and submit it by submission system within 10 days of receipt of the manuscript.<br><br>';
$tt .= 'Thank you for your consideration.<br> Look forward for your reply.<br>';
$tt .= '<a href="http://submission.tmrjournals.com/submission?journal=' . $journal_info['alias'] . '">ReviewerCenter</a><br>';
$tt .= 'Your username:' . $reviewer_info['account'] . '<br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
$tt .= $journal_info['title'] . '<br>';
$tt .= 'Email:' . $journal_info['email'] . '<br>';
$tt .= 'Website:' . $journal_info['website'];
sendEmail($reviewer_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//记录userlog
$log_data['user_id'] = $article_info['editor_id'];
$log_data['type'] = 2;
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),添加了一个文章审稿实例:(" . $article_info['title'] . "-----" . $reviewer_info['account'] . "),添加时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//添加usermsg
add_usermsg($reviewer['user_id'], 'You have new manuscript to be approved', '/reviewerArticleDetail?id=' . $res);
}
}
/**
* 筛选一个审稿人
*/
public function chose_reviewer($article) {
//筛选符合期刊
$rev_list = $this->rev_to_jour_obj->where('journal_id', $article['journal_id'])->column('reviewer_id');
$fie_list = $this->reviewer_info_obj->where('major',$article['major_id'])->column('reviewer_id');
$u_list = $this->user_obj
->where('user_id',['in',$rev_list],['in',$fie_list])//审核人属于某期刊,并且属于某个领域
->where('rtime','<',time() - 3600 * 24 * 15)//审核人间隔时间
->order('rs_num desc')->select();
if ($u_list) {
return $u_list[0];
} else {
return null;
}
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
class Index extends Controller{
public function index() {
}
public function test() {
echo md5('mtrsuper999');
}
}

View File

@@ -0,0 +1,84 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
use TCPDF;
/**
* Description of Auto
*
* @author jgll2
*/
class Pdf extends Controller {
//put your code here
protected $article_obj = '';
protected $article_reviewer_obj = '';
protected $user_obj = '';
protected $rev_to_jour_obj = '';
protected $reviewer_obj = '';
protected $journal_obj = '';
protected $article_msg_obj = '';
protected $user_log_obj = '';
protected $reviewer_info_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->article_obj = Db::name('article');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->user_obj = Db::name('user');
$this->rev_to_jour_obj = Db::name('reviewer_to_journal');
$this->journal_obj = Db::name('journal');
$this->reviewer_obj = Db::name('article_reviewer');
$this->article_msg_obj = Db::name('article_msg');
$this->user_log_obj = Db::name('user_log');
$this->reviewer_info_obj = Db::name('user_reviewer_info');
}
public function mytest(){
create_pdf('Traditional Medicine Research');
}
public function pdftest() {
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetHeaderData('logo.png', 25, '', '', array(0, 64, 255), array(0, 64, 128));
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once(dirname(__FILE__) . '/lang/eng.php');
$pdf->setLanguageArray($l);
}
$pdf->setFontSubsetting(true);
$pdf->SetFont('times', '', 14, '', true);
$pdf->AddPage();
$pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
$html ='<div style="margin-top:300px;font-size:16px;"><h3>To whom it may concern</h3>'
. 'You have reviewed 1 submission in the journal Traditional Medicine Research during 2020.
Thank you for your support to our journal. This contribution is greatly appreciated.'
.'<p>Regards<br>
Editorial Office<br>
Traditional Medicine Research</p>'
.'<p><h3>Contact us</h3>
TMR Publishing Group Address: 11 Cockle Bay Rd, Cockle Bay, Auckland 2014, New Zealand<br>
Telephone: +64 02108293806<br>
E-mail: publisher@tmrjournals.com</p></div>';
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
$pdf->Output('d:/example_001.pdf', 'F');
}
}

View File

@@ -0,0 +1,383 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use TCPDF;
class Reviewer extends Controller {
protected $user_obj = '';
protected $user_reviewer_obj = '';
protected $journal_obj = '';
protected $reviewer_major_obj = '';
protected $reviewer_to_journal_obj = '';
protected $user_reviewer_info_obj = '';
protected $user_log_obj = '';
protected $article_obj = '';
protected $article_file_obj = '';
protected $article_reviewer_obj = '';
protected $article_reviewer_file_obj = '';
protected $article_reviewer_question_obj = '';
//put your code here
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->user_reviewer_obj = Db::name('user_reviewer_apply');
$this->journal_obj = Db::name('journal');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->user_reviewer_info_obj = Db::name('user_reviewer_info');
$this->user_log_obj = Db::name('user_log');
$this->article_obj = Db::name('article');
$this->article_file_obj = Db::name('article_file');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->article_reviewer_file_obj = Db::name('article_reviewer_file');
$this->article_reviewer_question_obj = Db::name('article_reviewer_question');
}
/**
* 获取文章审稿实例列表(审稿人)
*/
public function getReviewerList() {
$data = $this->request->post();
$limit_start = $data['pageIndex'] == 1 ? 0 : ($data['pageIndex'] - 1) * $data['pageSize'] - 1;
$reviewer_info = $this->user_obj->where('account', $data['username'])->find();
$res = $this->article_reviewer_obj->field('t_article_reviewer.*,t_article.title article_title,t_journal.title journal_title,t_article.accept_sn accept_sn')
->join('t_article', 't_article_reviewer.article_id = t_article.article_id', 'LEFT')
->join('t_journal', 't_article.journal_id = t_journal.journal_id', 'LEFT')
->where('t_article_reviewer.reviewer_id', $reviewer_info['user_id'])
->order('t_article_reviewer.state')
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->article_reviewer_obj->where('t_article_reviewer.reviewer_id', $reviewer_info['user_id'])->count();
return json(['code' => 0, 'data' => $res, 'total' => $count]);
}
/**
* 获取审稿人详情
*/
public function getReviewerDetail(){
$uid = $this->request->post('rid');
//获取基本信息
$base_info = $this->user_obj->join('t_user_reviewer_info','t_user.user_id = t_user_reviewer_info.reviewer_id')->where('t_user.user_id',$uid)->find();
//增加major
$major_res = $this->reviewer_major_obj->where('major_id',$base_info['major'])->column('title');
$base_info['major_title'] = $major_res?$major_res[0]:'';
$cmajor_res = $this->reviewer_major_obj->where('major_id',$base_info['cmajor'])->column('title');
$base_info['cmajor_title'] = $cmajor_res?$cmajor_res[0]:'';
return json(['data'=>$base_info]);
}
/**
* 更改审稿人信息
*/
public function editReviewer(){
$data = $this->request->post();
$this->user_reviewer_info_obj->where('reviewer_info_id',$data['reviewer_info_id'])->update(['major'=>$data['major'],'cmajor'=>$data['cmajor']]);
return json(['code'=>0]);
}
/**
* 上传/修改文章审核实例详情两个文件(编辑,审稿人)
*/
public function articleReviewerUpSubmit($type) {
//接受参数,查询信息
$data = $this->request->post();
// $data['article'] = "dsadsaddsa";
// $data['articlefile'] = "articlefile/20200729/6e81db641bcf80bfcd2c9228cbb9ce71.docx";
// $data['articlezip'] = '';
// $data['artrevid'] = 1;
// $data['ctime'] = "1595993462";
// $data['editor'] = 'pipixia';
// $data['reviewer'] = 'nv';
// $data['state'] = 0;
$artrev_info = $this->article_reviewer_obj->where('art_rev_id', $data['artrevid'])->find();
$article_info = $this->article_obj->where('article_id',$artrev_info['article_id'])->find();
$editor_info = $this->user_obj->where('user_id',$article_info['editor_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
if ($type == 'editor') {
$up_data['editor_act'] = 1;
$user_msg_url = '/reviewerArticleDetail?id='.$data['artrevid'];
$user_info = $this->user_obj->where('account', $data['editor'])->find();
} else {
$up_data['reviewer_act'] = 1;
$user_msg_url = '/articleReviewerDetail?id='.$data['artrevid'];
$user_info = $this->user_obj->where('user_id', $artrev_info['reviewer_id'])->find();
}
//上传
self::save_article_reviewer_file($data['artrevid'], $user_info['user_id'], $user_info['account'], $data['articlefile'], 'articlefile');
if ($data['articlezip'] != '') {
self::save_article_reviewer_file($data['artrevid'], $user_info['user_id'], $user_info['account'], $data['articlezip'], 'articlezip');
}
//更新实例状态
$this->article_reviewer_obj->where('art_rev_id',$data['artrevid'])->update($up_data);
//记录userlog
$log_data['user_id'] = $user_info['user_id'];
$log_data['type'] = 3;
$log_data['content'] = $user_info['account'] . "(" . $user_info['realname'] . "),更改了一篇文章审稿实例:(" . $article_info['title'] . ")的状态,更改时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//发送email提醒
if ($type != 'editor') {
$tt = 'Dear editor,<br>';
$tt .= 'Please check the new comments from the reviewer.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
}
//保存usermsg
add_usermsg($type == 'editor'?$artrev_info['reviewer_id']:$article_info['editor_id'], 'New status of the manuscript', $user_msg_url);
return json(['code' => 0]);
}
/**
* 获取文章审稿实例文件列表
*/
public function getFilelistByID() {
$rev_id = $this->request->post('revid');
$where['art_rev_id'] = $rev_id;
$res = $this->article_reviewer_file_obj->where($where)->select();
$frag = [];
foreach ($res as $v) {
$frag[$v['type_name']][] = $v;
}
return json($frag);
}
/**
* 获取文章信息列表
*/
public function getAFilelistByID(){
$rev_id = $this->request->post('revid');
$article_rev_info = $this->article_reviewer_obj->where('art_rev_id',$rev_id)->find();
$file_list = $this->article_file_obj->where('article_id',$article_rev_info['article_id'])->where('type_name','manuscirpt')->select();
return json(['data'=>$file_list]);
}
/**
* 获取文章审稿实例详情(审稿人,编辑)
*/
public function getartrevdate() {
//接受参数
$data = $this->request->post();
//查询实例数据
$res = $this->article_reviewer_obj->field('t_article_reviewer.*,t_article.title article_title,t_article.accept_sn accept_sn,t_user.account account')
->join('t_article', 't_article.article_id = t_article_reviewer.article_id', 'LEFT')
->join('t_user', 't_user.user_id = t_article_reviewer.reviewer_id', 'LEFT')
->where('t_article_reviewer.art_rev_id', $data['revid'])
->find();
//更改实例状态(消息提醒)
if($data['human']=='editor'){
$up_data['reviewer_act'] = 0;
}else{
$up_data['editor_act'] = 0;
}
$this->article_reviewer_obj->where('art_rev_id', $data['revid'])->update($up_data);
return json($res);
}
/**
* 提交问卷(审稿人)
*/
public function questionSubmit() {
//接受参数,查询基础数据
$data = $this->request->post();
$art_rev_info = $this->article_reviewer_obj->where('art_rev_id',$data['art_rev_id'])->find();
$article_info = $this->article_obj->where('article_id',$art_rev_info['article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id',$article_info['editor_id'])->find();
//组合insert数据,存储
$insert_data['art_rev_id'] = $data['art_rev_id'];
$insert_data['qu1'] = $data['qu1'];
$insert_data['qu2'] = $data['qu2'];
$insert_data['qu3'] = $data['qu3'];
$insert_data['qu4'] = $data['qu4'];
$insert_data['qu5'] = $data['qu5'];
$insert_data['qu6'] = $data['qu6'];
$insert_data['qu7'] = $data['qu7'];
$insert_data['qu8'] = $data['qu8'];
$insert_data['qu9'] = $data['qu9']?1:0;
$insert_data['qu9_contents'] = $data['qu9contents'];
$insert_data['qu10'] = $data['qu10']?1:0;
$insert_data['qu10_contents'] = $data['qu10contents'];
$insert_data['qu11'] = $data['qu11']?1:0;
$insert_data['qu11_contents'] = $data['qu11contents'];
$insert_data['qu12'] = $data['qu12']?1:0;
$insert_data['qu12_contents'] = $data['qu12contents'];
$insert_data['qu13'] = $data['qu13']?1:0;
$insert_data['qu13_contents'] = $data['qu13contents'];
$insert_data['qu14'] = $data['qu14']?1:0;
$insert_data['qu14_contents'] = $data['qu14contents'];
$insert_data['qu15'] = $data['qu15']?1:0;
$insert_data['qu15_contents'] = $data['qu15contents'];
$insert_data['rated'] = $data['rated'];
$insert_data['recommend'] = $data['recommend'];
$insert_data['other'] = $data['other'];
$insert_data['confidential'] = $data['confident'];
$insert_data['comments'] = $data['comment'];
if ($data['rev_qu_id'] == '') {//新增
$insert_data['ctime'] = time();
$res = $this->article_reviewer_question_obj->insert($insert_data);
} else {//更新
$res = $this->article_reviewer_question_obj->where('rev_qu_id', $data['rev_qu_id'])->update($insert_data);
}
//根据recommend问题改变此实例的状态,并且更改act消息提醒状态
if ($data['recommend'] == 1) {
$artrevstate = 3;
} else if ($data['recommend'] == 2) {
$artrevstate = 1;
} else {
$artrevstate = 2;
}
$this->article_reviewer_obj->where('art_rev_id', $data['art_rev_id'])->update(['state' => $artrevstate,'reviewer_act'=>1]);
//文章是从初始状态到其他状态,增加审稿人成功审核次数
if($art_rev_info['state']==0){
$this->user_obj->where('user_id',$art_rev_info['reviewer_id'])->setInc('rs_num');
}
//记录log
//生成pdf文件
$reviewer_pdf = self::pdftest($journal_info['title']);
//发送email->编辑
$tt = 'Dear editor,<br>';
$tt .= 'Please check the new comments from the reviewer.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
//发送email感谢reviewer并携带附件
$reviewer_info = $this->user_obj->where('user_id',$art_rev_info['reviewer_id'])->find();
$tt1 = 'You have reviewed 1 submission in the journal '.$journal_info['title'].' during '.date('Y').'.Thank you for your support to our journal. This contribution is greatly appreciated.<br><br>';
$tt1 .= 'Regards<br>Editorial Office<br>'.$journal_info['title'].'<br><br>';
$tt1 .= 'Contact us<br>TMR Publishing Group Address: 11 Cockle Bay Rd, Cockle Bay, Auckland 2014, New Zealand<br>Telephone: +64 02108293806<br>E-mail: publisher@tmrjournals.com';
sendEmail($reviewer_info['email'],'Your contribution is greatly appreciated', $journal_info['title'], $tt1,$journal_info['email'],$journal_info['epassword'],$reviewer_pdf);
//记录usermsg
add_usermsg($article_info['editor_id'], 'Feedback questionnaire be unloaded.', '/articleReviewerDetail?id='.$data['art_rev_id']);
// if ($res) {
return json(['code' => 0]);
// } else {
// return json(['code' => 1]);
// }
}
/**
* 获取问卷详情
*/
public function getQuestion() {
$id = $this->request->post('artrevid');
$qu_info = $this->article_reviewer_question_obj->where('art_rev_id', $id)->find();
if ($qu_info) {
return json(['code' => 0, 'data' => $qu_info]);
} else {
return json(['code' => 1]);
}
}
/**
* 上传文章的文件
*/
public function up_file($type) {
$file = request()->file($type);
if ($file) {
$info = $file->move(ROOT_PATH . 'public' . DS . $type);
if ($info) {
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
} else {
return json(['code' => 1, 'msg' => $file->getError()]);
}
}
}
/**
* 存储reviewer文件历史信息
*/
private function save_article_reviewer_file($art_rev_id, $user_id, $username, $url, $type_name) {
//首先确定数据库里面是否存在此数据
$res = $this->article_reviewer_file_obj->where(['file_url' => $url])->find();
if ($res) {
return false;
}
$insert_data['art_rev_id'] = $art_rev_id;
$insert_data['up_user_id'] = $user_id;
$insert_data['up_username'] = $username;
$insert_data['file_url'] = $url;
$insert_data['type_name'] = $type_name;
$insert_data['ctime'] = time();
return $this->article_reviewer_file_obj->insert($insert_data);
}
// public function mytest(){
//
// $journal_info = $this->journal_obj->where('journal_id',1)->find();
// $ttt = self::pdftest('TMR');
// $tt1 = 'You have reviewed 1 submission in the journal '.$journal_info['title'].' during '.date('Y').'.Thank you for your support to our journal. This contribution is greatly appreciated.<br><br>';
// $tt1 .= 'Regards<br>Editorial Office<br>'.$journal_info['title'].'<br><br>';
// $tt1 .= 'Contact us<br>TMR Publishing Group Address: 11 Cockle Bay Rd, Cockle Bay, Auckland 2014, New Zealand<br>Telephone: +64 02108293806<br>E-mail: publisher@tmrjournals.com';
// sendEmail('751475802@qq.com','Your contribution is greatly appreciated', $journal_info['title'], $tt1,$journal_info['email'],$journal_info['epassword'],$ttt);
// }
//
/**
* 生成pdf感谢reviewer
*/
private function pdftest($title) {
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetHeaderData('logo.png', 25, '', '', array(0, 64, 255), array(0, 64, 128));
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once(dirname(__FILE__) . '/lang/eng.php');
$pdf->setLanguageArray($l);
}
$pdf->setFontSubsetting(true);
$pdf->SetFont('times', '', 14, '', true);
$pdf->AddPage();
$pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
$html ='<div style="margin-top:300px;font-size:16px;"><h3>To whom it may concern</h3>'
. 'You have reviewed 1 submission in the journal '.$title.' during '.date('Y').'
Thank you for your support to our journal. This contribution is greatly appreciated.'
.'<p>Regards<br>
Editorial Office<br>
'.$title.'</p>'
.'<p><h3>Contact us</h3>
TMR Publishing Group Address: 11 Cockle Bay Rd, Cockle Bay, Auckland 2014, New Zealand<br>
Telephone: +64 02108293806<br>
E-mail: publisher@tmrjournals.com</p></div>';
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
// $pdf->Output('example_001.pdf', 'D');
// $pdf_wj = 'd:/example_001.pdf';
$pdf_wj = $_SERVER['DOCUMENT_ROOT'].'public/pdf/'.date('YmdHis').'thanks.pdf';
// $pdf_wj = '/public/pdf/'.date('YMD').'/'.date('His').'thanks.pdf';
$pdf->Output($pdf_wj, 'F');
return $pdf_wj;
}
}

View File

@@ -0,0 +1,416 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\captcha;
use think\Cache;
class User extends Controller {
protected $user_obj = '';
protected $captcha_obj = '';
protected $user_act_obj = '';
protected $admin_obj = '';
protected $user_reviewer_obj = '';
protected $journal_obj = '';
protected $reviewer_major_obj = '';
protected $reviewer_to_journal_obj = '';
protected $user_reviewer_info_obj = '';
protected $user_msg_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->captcha_obj = Db::name('captcha');
$this->user_act_obj = Db::name('user_act');
$this->admin_obj = Db::name('admin');
$this->user_reviewer_obj = Db::name('user_reviewer_apply');
$this->journal_obj = Db::name('journal');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->user_reviewer_info_obj = Db::name('user_reviewer_info');
$this->user_msg_obj = Db::name('user_msg');
}
/**
* 登录功能
* @return type
*/
public function checkLogin() {
$data = $this->request->post();
//判断是否管理员登录
if ($data['username'] == 'superadmin'||$data['username'] == 'wuxiongzhi2') {
$where_admin['account'] = $data['username'];
$where_admin['password'] = md5($data['password']);
$admin_info = $this->admin_obj->where($where_admin)->find();
if($admin_info==null){
return json(['code'=>1]);
}else{
$up_admin['last_login_time'] = time();
$up_admin['last_login_ip'] = $this->request->ip();
$this->admin_obj->where('admin_id = '.$admin_info['admin_id'])->update($up_admin);
return json(['code'=>0,'userinfo'=>$admin_info]);
}
} else {//用户登录
$where['account'] = $data['username'];
$where['password'] = md5($data['password']);
$user_info = $this->user_obj->where($where)->find();
if ($user_info == null) {//登陆失败
return json(['code' => 1]);
} else {//登陆成功
$up_data['last_login_time'] = time();
$up_data['last_login_ip'] = $this->request->ip();
$this->user_obj->where('user_id = ' . $user_info['user_id'])->update($up_data);
return json(['code' => 0, 'userinfo' => $user_info]);
}
}
}
/**
* 根据account获取用户信息
*/
public function getUserdata() {
$account = $this->request->post('account');
$where['account'] = $account;
if($account=='superadmin'){
$res = $this->admin_obj->where($where)->find();
}else{
$res = $this->user_obj->where($where)->find();
}
if ($res == null) {
return json(['code' => 1, 'msg' => '获取失败']);
} else {
return json(['code' => 0, 'data' => $res]);
}
}
/**
* 注册功能
*/
public function register() {
$data = $this->request->post();
//检测是否用户名和密码已经占用
$account = $data['username'];
$email = $data['email'];
$res_once = $this->user_obj->where("account='$account' or email = '$email'")->find();
if ($res_once != null) {
return json('existence');
}
//验证验证码
if (!$this->my_checkcaptcha($data['code'], $data['random_num'])) {
return json('errcaptcha');
}
//存入数据
$inser_data['account'] = trim($account);
$inser_data['password'] = md5($data['password']);
$inser_data['email'] = $email;
$inser_data['phone'] = $data['phone'];
$inser_data['realname'] = $data['name'];
$inser_data['ctime'] = time();
$this->user_obj->insert($inser_data);
//发送注册成功邮件
$tt = "Dear author,You have successfully registered<br><br>";
$content = $tt . '<p>Username:' . $account . '<br>Password:' . $data['password'] . '</p>';
sendEmail($email, 'Dear ' . $data['name'], 'TMR', $content,);
return json($inser_data);
}
/**
* 获取验证码图片(用户注册)
*/
public function testCaptcha() {
$data = $this->request->get();
$config = config('captcha');
$capt = new captcha\Captcha($config);
return $capt->entry($data['a']);
}
/**
* 修改密码
*/
public function retrieve() {
$data = $this->request->post();
//获取act信息
$act_where['act_key'] = $data['actkey'];
$actres = $this->user_act_obj->where($act_where)->find();
$act = json_decode($actres['param']);
$where['email'] = $act->email;
$res = $this->user_obj->where($where)->update(['password' => md5($data['password'])]);
if ($res > 0) {
$this->user_act_obj->where($act_where)->update(['state' => 1]);
return json(['code' => 0]);
} else {
return json(['code' => 1, 'msg' => '失败!']);
}
}
/**
* 获取验证码图片(密码找回)
*/
public function retrieveCaptcha() {
$data = $this->request->get();
$config = config('captcha_retrieve');
$capt = new captcha\Captcha($config);
return $capt->entry($data['a']);
}
/**
* 找回密码第一步,获取邮箱
*/
public function retrieveGetEmail() {
$data = $this->request->post();
//验证验证码
if (!$this->my_checkcaptcha($data['code'], $data['random_num'])) {
return json(['code' => 1, 'msg' => '验证码错误']);
}
$where['account'] = $data['username'];
$res = $this->user_obj->where($where)->find();
if ($res == null) {
return json(['code' => 1, 'msg' => '查无此人']);
} else {
return json(['code' => 0, 'email' => $res['email']]);
}
}
/**
* 找回密码第二部,发送邮件
*/
public function retrievePushEmail() {
$email = $this->request->post('email');
$where['email'] = $email;
$realname = $this->user_obj->where($where)->value('realname');
//插入数据库隐形操作表数据
$act_insert['act_key'] = authcode($email . time());
$act_insert['type'] = 'retrieve';
$act_insert['param'] = json_encode(['email' => $email]);
$act_insert['ctime'] = time();
$this->user_act_obj->insert($act_insert);
//发送邮件
$url = config('base_web_url') . 'retrieveact?actkey=' . $act_insert['act_key'];
$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>";
$res = sendEmail($email, $title, 'TMR', $content,);
if ($res['status'] == 1) {//成功
return json(['code' => 0, 'msg' => 'success']);
} else {//失败
return json(['code' => 1, 'msg' => $res['data']]);
}
}
/**
* 验证修改密码页面的合法性
*/
public function checkActkey() {
$actkey = $this->request->post('actkey');
$where['act_key'] = $actkey;
$where['state'] = 0;
$res = $this->user_act_obj->where($where)->find();
if ($res == null) {
return json(['code' => 1, 'msg' => '查询失败']);
} else {
return json(['code' => 0, 'msg' => '查询成功']);
}
}
/**
* 自定义验证验证码
*/
public function my_checkcaptcha($code, $id) {
$nowcode = Cache::get(md5($id));
$mbcode = authcode($code);
return $nowcode == $mbcode ? true : false;
}
/**
* 获取审稿人列表
*/
public function getreviewerList(){
$data = $this->request->post();
$limit_start = ($data['pageIndex']-1)*$data['pageSize'];
$where['t_user.is_reviewer'] = 1;
if($data['journalId']==0){
$subQuery = $this->user_obj->field('user_id')->where('account',$data['username'])->buildSql();
$journals = $this->journal_obj->where("editor_id in $subQuery")->column('journal_id');
$uids = $this->reviewer_to_journal_obj->where('journal_id','in',$journals)->column('reviewer_id');
$where['t_user.user_id'] = ['in',$uids];
}else{
$uids = $this->reviewer_to_journal_obj->where('journal_id',$data['journalId'])->column('reviewer_id');
$where['t_user.user_id'] = ['in',$uids];
}
$res = $this->user_obj->field('t_user.*,t_user_reviewer_info.*')->join('t_user_reviewer_info','t_user_reviewer_info.reviewer_id = t_user.user_id','LEFT')->where($where)->limit($limit_start,$data['pageSize'])->select();
$total = $this->user_obj->where($where)->count();
if($res){
return json(['code'=>0,'data'=>$res,'total'=>$total]);
}else{
return json(['code'=>1]);
}
}
/**
* 获取审核员申请列表
*/
public function getReviewerApplyList(){
$data = $this->request->post();
$limit_start = ($data['pageIndex']-1)*$data['pageSize'];
$where['state'] = 0;
if($data['journalId']==0){
$subQuery = $this->user_obj->field('user_id')->where('account',$data['username'])->buildSql();
$journals = $this->journal_obj->where("editor_id in $subQuery")->column('journal_id');
$where['journal_id'] = ['in',$journals];
}else{
$where['journal_id'] = $data['journalId'];
}
$res = $this->user_reviewer_obj->where($where)->limit($limit_start,$data['pageSize'])->select();
$count = $this->user_reviewer_obj->where($where)->count();
return json(['total'=>$count,'data'=>$res]);
}
/**
* 获取申请详情
*/
public function getApplyDetail(){
$reviewerId = $this->request->post('reviewerId');
$where['t_user_reviewer_apply.reviewer_id'] = $reviewerId;
$res = $this->user_reviewer_obj->field('t_user_reviewer_apply.*,t_journal.title journal,t_reviewer_major.title major_title')->join('t_journal','t_journal.journal_id = t_user_reviewer_apply.journal_id','left')->join('t_reviewer_major','t_user_reviewer_apply.major = t_reviewer_major.major_id','LEFT')->where($where)->find();
if($res){
return json(['code'=>0,'data'=>$res]);
}else{
return json(['code'=>1]);
}
}
/**
* 通过审核人
*/
public function reviewerAdopt(){
$reviewerId = $this->request->post('reviewerId');
$where['reviewer_id'] = $reviewerId;
$apply_info = $this->user_reviewer_obj->where($where)->find();
$journal_info = $this->journal_obj->where('journal_id',$apply_info['journal_id'])->find();
$has_res = $this->user_obj->where('account',$apply_info['name'])->find();
Db::startTrans();
if($has_res==null){
$insert_data['account'] = $apply_info['name'];
$insert_data['password'] = md5('123456qwe');
$insert_data['email'] = $apply_info['email'];
$insert_data['realname'] = $apply_info['name'];
$insert_data['type'] = 1;
$insert_data['is_reviewer'] = 1;
$insert_data['ctime'] = time();
$add_res = $this->user_obj->insertGetId($insert_data);
$insert_info['reviewer_id'] = $add_res;
$insert_info['gender'] = $apply_info['gender'];
$insert_info['technical'] = $apply_info['technical'];
$insert_info['country'] = $apply_info['country'];
$insert_info['introduction'] = $apply_info['introduction'];
$insert_info['company'] = $apply_info['company'];
$insert_info['major'] = $apply_info['major'];
$insert_info['field'] = $apply_info['field'];
$insert_info['qualifications'] = $apply_info['qualifications'];
$addinfo_res = $this->user_reviewer_info_obj->insertGetId($insert_info);
$has_res = $this->user_obj->where('account',$apply_info['name'])->find();
}else{
$add_res = true;
$addinfo_res = true;
}
$insert_rtj['reviewer_id'] = $has_res['user_id'];
$insert_rtj['journal_id'] = $journal_info['journal_id'];
$insert_rtj['account'] = $has_res['account'];
$insert_rtj['journal_title'] = $journal_info['title'];
$insert_rtj['ctime'] = time();
$res = $this->reviewer_to_journal_obj->insert($insert_rtj);
//发送email
$content = "Thank you for registering as a ".$journal_info['title']." reviewer<br/>"
. "At present, you have passed our examination";
$content .= '<p>username:'.$apply_info['name'].'</p>';
$content .= $has_res?'':'<p>password:123456qwe</p>';
sendEmail($apply_info['email'],$journal_info['title'],$journal_info['title'], $content,$journal_info['email'],$journal_info['epassword']);
$update_res = $this->user_reviewer_obj->where($where)->update(['state'=>1]);
if($res && $add_res && $addinfo_res && $update_res){
Db::commit();
return json(['code'=>0]);
}else{
Db::rollback();
return json(['code'=>1]);
}
}
/**
* 获取用户消息
*/
public function getUserMsg(){
//接收参数
$data = $this->request->post();
$user_info = $this->user_obj->where('account',$data['account'])->find();
//查询msglist
$list = $this->user_msg_obj
->where('user_id',$user_info['user_id'])
->where('state',0)
->order('user_msg_id desc')
->select();
return json($list);
}
/**
* 更改用户消息状态
*/
public function changeMsgState(){
//接收参数
$id = $this->request->post('id');
$this->user_msg_obj
->where('user_msg_id',$id)
->update(['state'=>1]);
return json(['code'=>0]);
}
/**
* 审核人审查去重
*/
public function checkReviewer(){
$username = $this->request->post('username');
$userres = $this->user_obj->where('account',$username)->find();
$applyres= $this->user_reviewer_obj->where("name = '$username' and state <> 2")->find();
if($applyres||$userres){
return json(['code'=>1]);
}else{
return json(['code'=>0]);
}
}
/**
* 拒绝审核人
*/
public function reviewerRejec(){
$reviewerId = $this->request->post('reviewerId');
$where['reviewer_id'] = $reviewerId;
$this->user_reviewer_obj->where($where)->update(['state'=>2]);
//拒绝审稿人email-》审稿人
return json(['code'=>0]);
}
/**
* 获取专业列表
*/
public function getMajorList(){
$res = $this->reviewer_major_obj->select();
return json(['code'=>0,'data'=>$res]);
}
/**
* 测试发邮件
*/
public function test_email() {
$email = '751475802@qq.com';
$title = 'Dear ' . '王金磊';
$tt = config('email_hello');
$content = $tt . '<p>Username:wangjinlei<br>Password:29698073</p>';
$res = sendEmail($email, $title, 'TMR', $content,);
echo '<pre>';
var_dump($res);
echo '</pre>';
die;
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace app\api\job;
use think\queue\Job;
class mail {
//put your code here
public function fire(Job $job, $data) {
$res = $this->send($data);
if($res){
$job->delete();
}else{
if($job->attempts()>3){
// 第1种处理方式重新发布任务,该任务延迟10秒后再执行
//$job->release(10);
// 第2种处理方式原任务的基础上1分钟执行一次并增加尝试次数
//$job->failed();
// 第3种处理方式删除任务
$job->delete();
}
}
}
/**
* 发送邮件的逻辑
* @param type $data
*/
public function send($data){
$r = sendEmail($data['email'],$data['title'],$data['title'],$data['content'],$data['tmail'],$data['tpassword']);
if($r['status']==1){
return true;
}else{
return false;
}
}
}

View File

@@ -0,0 +1,253 @@
<?php
namespace app\api\job;
use think\queue\Job;
use think\Db;
/**
* Description of review
*
* @author jgll2
*/
class review {
protected $user_obj = '';
protected $rev_to_jour_obj = '';
protected $reviewer_obj = '';
protected $journal_obj = '';
protected $article_reviewer_obj = '';
protected $article_msg_obj = '';
protected $user_log_obj = '';
protected $article_obj = '';
protected $reviewer_info_obj = '';
//put your code here
public function __construct() {
$this->user_obj = Db::name('user');
$this->rev_to_jour_obj = Db::name('reviewer_to_journal');
$this->journal_obj = Db::name('journal');
$this->reviewer_obj = Db::name('article_reviewer');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->article_msg_obj = Db::name('article_msg');
$this->user_log_obj = Db::name('user_log');
$this->article_obj = Db::name('article');
$this->reviewer_info_obj = Db::name('user_reviewer_info');
}
public function fire(Job $job, $data) {
$res = $this->checkrev($data);
// $res = $this->testemail($data);
if ($res) {
$job->delete();
} else {
if ($job->attempts() > 3) {
// 第1种处理方式重新发布任务,该任务延迟10秒后再执行
//$job->release(10);
// 第2种处理方式原任务的基础上1分钟执行一次并增加尝试次数
//$job->failed();
// 第3种处理方式删除任务
$job->delete();
}
$job->delete();
}
}
public function testemail($data) {
// echo 'oookkk';
// $this->add_reviewer($data);
return file_put_contents('/usr/local/1.txt', 'log_time:'.date('Y-m-d H:i:s').$data['title'].PHP_EOL, FILE_APPEND);
}
/**
* 审查文章审稿人状态,返回结果
*/
public function checkrev($data) {
//查找审稿案例状态
$rev_list = $this->reviewer_obj->where('article_id', $data['article_id'])->where('state','<>',4)->select();
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
$user_info = $this->user_obj->where('user_id',$data['user_id'])->find();
$editor_info = $this->user_obj->where('user_id',$data['editor_id'])->find();
//分析审稿人状况
$all = count($rev_list);
$s_num = 0; //初始数量
$p_num = 0; //通过数量
$np_num = 0; //不通过数量
foreach ($rev_list as $v) {
if ($v['state'] == 0) {
$s_num++;
} else if ($v['state'] == 1 || $v['state'] == 3) {
$p_num++;
} else {
$np_num++;
}
}
//分情况执行
if ($all == 0) {
//分配两次审稿人
$this->add_reviewer($data);
$this->add_reviewer($data);
return true;
} elseif ($all == 1) {
//分配一次审稿人
$this->add_reviewer($data);
return true;
} elseif ($all == 2) {
if ($s_num > 0) {//不做任何处理
return true;
}
if ($p_num == 2) {//通过
//更新文章状态
$this->article_obj->where('article_id', $data['article_id'])->update(['state'=>4,'editor_act'=>1]);
//添加文章msg信息
$insert_data['article_id'] = $data['article_id'];
$insert_data['content'] = 'Review completed';
$insert_data['state_from'] = $data['state'];
$insert_data['state_to'] = 4;
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
//添加通知信息
add_usermsg($data['user_id'], 'Your manuscript has new process', '/articleDetail?id=' . $data['article_id']);
//发送邮件通知编辑
$tt = $data['accept_sn'].'<br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>';
$tt .= 'Thank you for submitting the manuscript to '.$journal_info['title'].'. <br>';
$tt .= 'Please find the new comments in the "<a href="http://submission.tmrjournals.com/submission?journal='.$journal_info['alias'].'">AuthorCenter</a>", Please submit your revised manuscript within two weeks.<br><br>';
$tt .= 'If you need more time to revise, you can send E-mial to tell us.<br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
$tt .= $journal_info['title'].'<br>';
$tt .= 'Email: '.$journal_info['email'].'<br>';
$tt .= 'Website: '.$journal_info['website'];
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
} elseif ($np_num == 2) {//不通过
//发送邮件通知编辑
$tt = 'Reviewers final opinions on the manuscript ID'.$data['accept_sn'].' are rejection. Please login and deal with the next step of this manuscript manually.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
} else {//一样一个增加一个审稿案例
$this->add_reviewer($data);
return true;
}
} elseif ($all >= 3) {
if ($s_num > 0) {//不做任何处理
return true;
}
if ($p_num >= 2) {//通过
//更新文章状态
$this->article_obj->where('article_id', $data['article_id'])->update(['state'=>4,'editor_act'=>1]);
//添加文章msg信息
$insert_data['article_id'] = $data['article_id'];
$insert_data['content'] = 'Review completed';
$insert_data['state_from'] = $data['state'];
$insert_data['state_to'] = 4;
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
//添加通知信息
add_usermsg($data['user_id'], 'Your manuscript has new process', '/articleDetail?id=' . $data['article_id']);
//发送邮件通知编辑
$tt = $data['accept_sn'].'<br>';
$tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',<br>';
$tt .= 'Thank you for submitting the manuscript to '.$journal_info['title'].'. <br>';
$tt .= 'Please find the new comments in the "<a href="http://submission.tmrjournals.com/submission?journal='.$journal_info['alias'].'">AuthorCenter</a>", Please submit your revised manuscript within two weeks.<br><br>';
$tt .= 'If you need more time to revise, you can send E-mial to tell us.<br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
$tt .= $journal_info['title'].'<br>';
$tt .= 'Email: '.$journal_info['email'].'<br>';
$tt .= 'Website: '.$journal_info['website'];
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
} else {//不通过
//发送邮件通知编辑
$tt = 'Reviewers final opinions on the manuscript ID'.$data['accept_sn'].' are rejection. Please login and deal with the next step of this manuscript manually.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
}
}
}
/**
* 增加一个审稿人
*/
public function add_reviewer($article) {
$journal_info = $this->journal_obj->where('journal_id', $article['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id', $article['editor_id'])->find();
//根据文章筛选候选人
$reviewer = $this->chose_reviewer($article);
if ($reviewer == null) {//没有查询到审稿人,执行提醒操作
//发送邮件到编辑,提醒需要手动添加审稿案例
$tt = 'Dear editor,<br>';
$tt .= 'There are no enough research area related reviewers in the reviewer list for manuscript ID ' . $article['accept_sn'] . ', please add reviewers for your journal or manual deal with this problem.<br><br>';
$tt .= 'TMR Publishing Group';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
} else {//查询到审稿人,执行添加操作
//将审稿时间定义至现在
$this->user_obj->where('user_id', $reviewer['user_id'])->update(['rtime' => time()]);
$article_info = $article;
$reviewer_info = $reviewer;
//增加信息到文章审稿表
$insert_data['reviewer_id'] = $reviewer['user_id'];
$insert_data['article_id'] = $article_info['article_id'];
$insert_data['editor_act'] = 1;
$insert_data['ctime'] = time();
$res = $this->article_reviewer_obj->insertGetId($insert_data);
//修改文章状态->审稿中
$this->article_obj->where('article_id', $article_info['article_id'])->update(['state' => 2]);
//添加article_msg信息
$insmsg_data['article_id'] = $article_info['article_id'];
$insmsg_data['content'] = '';
$insmsg_data['state_from'] = $article_info['state'];
$insmsg_data['state_to'] = 2;
$insmsg_data['ctime'] = time();
$this->article_msg_obj->insert($insmsg_data);
//发送email提醒审稿员
$tt = $article_info['accept_sn'] . '<br>';
$tt .= 'Dear ' . $reviewer_info['realname'] . '<br><br>';
$tt .= 'The manuscript entitled “' . $article_info['title'] . '” has'
. ' been submitted to the journal ' . $journal_info['title'] . '. The Editor-in-Chief would'
. ' be most grateful if you could offer an opinion regarding its suitability for publication'
. ' in the journal ' . $journal_info['title'] . '. <br>';
$tt .= 'Please bring into our knowledge if there is any potential Conflict of Interest. If you agree to review this manuscript, we ask you to complete your review and submit it by submission system within 7 days of receipt of the manuscript.<br><br>';
$tt .= 'Thank you for your consideration.<br> Look forward for your reply.<br>';
$tt .= '<a href="http://submission.tmrjournals.com/submission?journal=' . $journal_info['alias'] . '">ReviewerCenter</a><br>';
$tt .= 'Your username:' . $reviewer_info['account'] . '<br><br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
$tt .= $journal_info['title'] . '<br>';
$tt .= 'Email:' . $journal_info['email'] . '<br>';
$tt .= 'Website:' . $journal_info['website'];
sendEmail($reviewer_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//记录userlog
$log_data['user_id'] = $article_info['editor_id'];
$log_data['type'] = 2;
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),添加了一个文章审稿实例:(" . $article_info['title'] . "-----" . $reviewer_info['account'] . "),添加时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//添加usermsg
add_usermsg($reviewer['user_id'], 'You have new manuscript to be approved', '/reviewerArticleDetail?id=' . $res);
}
}
/**
* 筛选一个审稿人
*/
public function chose_reviewer($article) {
//筛选符合期刊
$rev_list = $this->rev_to_jour_obj->where('journal_id', $article['journal_id'])->column('reviewer_id');
$fie_list = $this->reviewer_info_obj->where('major',$article['major_id'])->column('reviewer_id');
$u_list = $this->user_obj
->where('user_id',['in',$rev_list],['in',$fie_list])//审核人属于某期刊,并且属于某个领域
->where('rtime','<',time() - 3600 * 24 * 15)//审核人间隔时间
->order('rs_num desc')->select();
if ($u_list) {
return $u_list[0];
} else {
return null;
}
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace app\api\model;
use think\Model;
class User extends Model
{
}

View File

@@ -0,0 +1 @@
adsadsadsads

View File

33
application/build.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// 生成应用公共文件
'__file__' => ['common.php', 'config.php', 'database.php'],
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
'demo' => [
'__file__' => ['common.php'],
'__dir__' => ['behavior', 'controller', 'model', 'view'],
'controller' => ['Index', 'Test', 'UserType'],
'model' => ['User', 'UserType'],
'view' => ['index/index'],
],
// 其他更多的模块定义
// 定义api模块的自动生成
'api'=>[
'__dir__' => ['behavior','controller','model','widget'],
'controller'=> ['Index','Test','UserType'],
'model' => ['User','UserType'],
'view' => ['index/index','index/test'],
],
];

12
application/command.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return [];

134
application/common.php Normal file
View File

@@ -0,0 +1,134 @@
<?php
use PHPMailer\PHPMailer\PHPMailer;
use think\Db;
//use TCPDF;
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用公共文件
function authcode($str) {
$key = substr(md5('ThinkPHP.CN'), 5, 8);
$str1 = substr(md5($str), 8, 10);
return md5($key . $str1);
}
/**
* @function sendEmail
* @intro 发送邮件(带附件)
* @param $email 接收邮箱
* @param $title 邮件标题
* @param $from_name 发件人
* @param $content 邮件内容
* @param $memail 邮件内容
* @param $mpassword 邮件内容
* @param $attachmentFile 附件 string | array
* @return array
*/
function sendEmail($email = '', $title = '', $from_name = '', $content = '', $memail = '', $mpassword = '', $attachmentFile = '') {
date_default_timezone_set('PRC');
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//charset
$mail->CharSet = 'UTF-8';
//Set the hostname of the mail server
$mail->Host = "smtp.qiye.aliyun.com"; //请填写你的邮箱服务器
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25; //端口号
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = $memail == '' ? "tmrweb@tmrjournals.com" : $memail; //发件邮箱用户名
//Password to use for SMTP authentication
$mail->Password = $mpassword == '' ? "Wu999999tmrwe" : $mpassword; //发件邮箱密码
//Set who the message is to be sent from
$mail->setFrom($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
//Set an alternative reply-to address(用户直接回复邮件的地址)
$mail->addReplyTo($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
//Set who the message is to be sent to
$mail->addAddress($email);
//Set the subject line
$mail->Subject = $title;
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($content);
//Replace the plain text body with one created manually
$mail->AltBody = '';
if (is_array($attachmentFile)) {
for ($i = 0; $i < count($attachmentFile); $i++) {
$mail->addAttachment($attachmentFile[$i], 'thanks.pdf' . $i); //这里可以是多维数组,然后循环附件的文件和名称
}
} else {
if ($attachmentFile != '') {
//Attach an image file
$mail->addAttachment($attachmentFile, 'thanks.pdf');
}
}
//send the message, check for errors
if (!$mail->send()) {
$status = 0;
$data = "邮件发送失败" . $mail->ErrorInfo;
;
} else {
$status = 1;
$data = "邮件发送成功";
}
return ['status' => $status, 'data' => $data]; //返回值(可选)
}
/**
* 生成文章sn号
* @return type
*/
function getArticleSN($abbr,$type) {
$str = $abbr;
$str .= date('Y', time()).$type.date('md', time());
$where['accept_sn'] = ['like', "$str%"];
$nowres = Db::name('article')->where($where)->select();
$last_num = 1;
if ($nowres) {
foreach ($nowres as $v) {
$now_num = intval(substr($v['accept_sn'], -3));
$last_num = $now_num > $last_num ? $now_num : $last_num;
}
$last_num += 1;
}
$last_str = sprintf("%03d", $last_num);
$str .= $last_str;
return $str;
}
/**
* 增加usermsg
*/
function add_usermsg($userid, $content, $url) {
$msg_obj = Db::name('user_msg');
$msg_info = $msg_obj->where('user_id', $userid)
->where('url', $url)
->where('state', 0)
->find();
if ($msg_info) {
return true;
}
$msgdata['user_id'] = $userid;
$msgdata['content'] = $content;
$msgdata['url'] = $url;
$msgdata['ctime'] = time();
return $msg_obj->insert($msgdata);
}

273
application/config.php Normal file
View File

@@ -0,0 +1,273 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// +----------------------------------------------------------------------
// | 应用设置
// +----------------------------------------------------------------------
// 应用调试模式
'app_debug' => true,
// 应用Trace
'app_trace' => false,
// 应用模式状态
'app_status' => '',
// 是否支持多模块
'app_multi_module' => true,
// 入口自动绑定模块
'auto_bind_module' => false,
// 注册的根命名空间
'root_namespace' => [],
// 扩展函数文件
'extra_file_list' => [THINK_PATH . 'helper' . EXT],
// 默认输出类型
'default_return_type' => 'html',
// 默认AJAX 数据返回格式,可选json xml ...
'default_ajax_return' => 'json',
// 默认JSONP格式返回的处理方法
'default_jsonp_handler' => 'jsonpReturn',
// 默认JSONP处理方法
'var_jsonp_handler' => 'callback',
// 默认时区
'default_timezone' => 'PRC',
// 是否开启多语言
'lang_switch_on' => false,
// 默认全局过滤方法 用逗号分隔多个
'default_filter' => '',
// 默认语言
'default_lang' => 'zh-cn',
// 应用类库后缀
'class_suffix' => false,
// 控制器类后缀
'controller_suffix' => false,
// +----------------------------------------------------------------------
// | 模块设置
// +----------------------------------------------------------------------
// 默认模块名
'default_module' => 'index',
// 禁止访问模块
'deny_module_list' => ['common'],
// 默认控制器名
'default_controller' => 'Index',
// 默认操作名
'default_action' => 'index',
// 默认验证器
'default_validate' => '',
// 默认的空控制器名
'empty_controller' => 'Error',
// 操作方法后缀
'action_suffix' => '',
// 自动搜索控制器
'controller_auto_search' => false,
// +----------------------------------------------------------------------
// | URL设置
// +----------------------------------------------------------------------
// PATHINFO变量名 用于兼容模式
'var_pathinfo' => 's',
// 兼容PATH_INFO获取
'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
// pathinfo分隔符
'pathinfo_depr' => '/',
// URL伪静态后缀
'url_html_suffix' => 'html',
// URL普通方式参数 用于自动生成
'url_common_param' => false,
// URL参数方式 0 按名称成对解析 1 按顺序解析
'url_param_type' => 0,
// 是否开启路由
'url_route_on' => true,
// 路由使用完整匹配
'route_complete_match' => false,
// 路由配置文件(支持配置多个)
'route_config_file' => ['route'],
// 是否开启路由解析缓存
'route_check_cache' => false,
// 是否强制使用路由
'url_route_must' => false,
// 域名部署
'url_domain_deploy' => false,
// 域名根如thinkphp.cn
'url_domain_root' => '',
// 是否自动转换URL中的控制器和操作名
'url_convert' => true,
// 默认的访问控制器层
'url_controller_layer' => 'controller',
// 表单请求类型伪装变量
'var_method' => '_method',
// 表单ajax伪装变量
'var_ajax' => '_ajax',
// 表单pjax伪装变量
'var_pjax' => '_pjax',
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
'request_cache' => false,
// 请求缓存有效期
'request_cache_expire' => null,
// 全局请求缓存排除规则
'request_cache_except' => [],
// +----------------------------------------------------------------------
// | 模板设置
// +----------------------------------------------------------------------
'template' => [
// 模板引擎类型 支持 php think 支持扩展
'type' => 'Think',
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写
'auto_rule' => 1,
// 模板路径
'view_path' => '',
// 模板后缀
'view_suffix' => 'html',
// 模板文件名分隔符
'view_depr' => DS,
// 模板引擎普通标签开始标记
'tpl_begin' => '{',
// 模板引擎普通标签结束标记
'tpl_end' => '}',
// 标签库标签开始标记
'taglib_begin' => '{',
// 标签库标签结束标记
'taglib_end' => '}',
],
// 视图输出字符串内容替换
'view_replace_str' => [],
// 默认跳转页面对应的模板文件
'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
// +----------------------------------------------------------------------
// | 异常及错误设置
// +----------------------------------------------------------------------
// 异常页面的模板文件
'exception_tmpl' => THINK_PATH . 'tpl' . DS . 'think_exception.tpl',
// 错误显示信息,非调试模式有效
'error_message' => '页面错误!请稍后再试~',
// 显示错误信息
'show_error_msg' => false,
// 异常处理handle类 留空使用 \think\exception\Handle
'exception_handle' => '',
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------------------
'log' => [
// 日志记录方式,内置 file socket 支持扩展
'type' => 'File',
// 日志保存目录
'path' => LOG_PATH,
// 日志记录级别
'level' => [],
],
// +----------------------------------------------------------------------
// | Trace设置 开启 app_trace 后 有效
// +----------------------------------------------------------------------
'trace' => [
// 内置Html Console 支持扩展
'type' => 'Html',
],
// +----------------------------------------------------------------------
// | 缓存设置
// +----------------------------------------------------------------------
'cache' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => CACHE_PATH,
// 缓存前缀
'prefix' => '',
// 缓存有效期 0表示永久缓存
'expire' => 0,
],
// +----------------------------------------------------------------------
// | 会话设置
// +----------------------------------------------------------------------
'session' => [
'id' => '',
// SESSION_ID的提交变量,解决flash上传跨域
'var_session_id' => '',
// SESSION 前缀
'prefix' => 'think',
// 驱动方式 支持redis memcache memcached
'type' => '',
// 是否自动开启 SESSION
'auto_start' => true,
],
// +----------------------------------------------------------------------
// | Cookie设置
// +----------------------------------------------------------------------
'cookie' => [
// cookie 名称前缀
'prefix' => '',
// cookie 保存时间
'expire' => 0,
// cookie 保存路径
'path' => '/',
// cookie 有效域名
'domain' => '',
// cookie 启用安全传输
'secure' => false,
// httponly设置
'httponly' => '',
// 是否使用 setcookie
'setcookie' => true,
],
//分页配置
'paginate' => [
'type' => 'bootstrap',
'var_page' => 'page',
'list_rows' => 15,
],
//验证码配置(用户注册)
'captcha' => [
//验证码的字符集
'codeSet' => '1234567890',
//设置验证码大小
'fontSize' => 12,
//设置图片的高度、宽度
'imageW' => 140,
'imageH' => 30,
//验证码位数
'length' =>5,
//验证成功后重置
'reset' =>false,
'useNoise'=>false
],
//验证码配置(密码找回)
'captcha_retrieve' => [
//验证码的字符集
'codeSet' => '1234567890',
//设置验证码大小
'fontSize' => 12,
//设置图片的高度、宽度
'imageW' => 93,
'imageH' => 30,
//验证码位数
'length' =>4,
//验证成功后重置
'reset' =>false,
'useNoise'=>false
],
];

58
application/database.php Normal file
View File

@@ -0,0 +1,58 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// 数据库类型
'type' => 'mysql',
// 服务器地址
// 'hostname' => 'tmrdatebase.cubychyntk7p.ap-southeast-1.rds.amazonaws.com',
'hostname' => 'localhost',
// 数据库名
'database' => 'tougao',
// 用户名
// 'username' => 'tmradmin',
'username' => 'root',
// 密码
// 'password' => 'UhUKzkifVWkTnoJ63Qfs',
'password' => 'root',
// 端口
'hostport' => '3306',
// 连接dsn
'dsn' => '',
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库表前缀
'prefix' => 't_',
// 数据库调试模式
'debug' => true,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 自动读取主库数据
'read_master' => false,
// 是否严格检查字段是否存在
'fields_strict' => true,
// 数据集返回类型
'resultset_type' => 'array',
// 自动写入时间戳字段
'auto_timestamp' => false,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 是否需要进行SQL性能分析
'sql_explain' => false,
];

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,5 @@
<?php
//配置文件
return [
];

View File

@@ -0,0 +1,10 @@
<?php
namespace app\demo\controller;
class Index
{
public function index()
{
return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p> ThinkPHP V5<br/><span style="font-size:30px">十年磨一剑 - 为API开发设计的高性能框架</span></p><span style="font-size:22px;">[ V5.0 版本由 <a href="http://www.qiniu.com" target="qiniu">七牛云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_bd568ce7058a1091"></thinkad>';
}
}

View File

@@ -0,0 +1,7 @@
<?php
namespace app\demo\controller;
class Test
{
}

View File

@@ -0,0 +1,7 @@
<?php
namespace app\demo\controller;
class UserType
{
}

View File

@@ -0,0 +1,9 @@
<?php
namespace app\demo\model;
use think\Model;
class User extends Model
{
}

View File

@@ -0,0 +1,9 @@
<?php
namespace app\demo\model;
use think\Model;
class UserType extends Model
{
}

View File

View File

@@ -0,0 +1,23 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return [
// 'connector' => 'Sync'
'connector' => 'Redis', // Redis 驱动
'expire' => null, // 任务的过期时间默认为60秒; 若要禁用,则设置为 null
'default' => 'mail', // 默认的队列名称
'host' => '127.0.0.1', // redis 主机ip
'port' => 6379, // redis 端口
'password' => '', // redis 密码
'select' => 0, // 使用哪一个 db默认为 db0
'timeout' => 0, // redis连接的超时时间
'persistent' => false, // 是否是长连接
];

View File

@@ -0,0 +1,10 @@
<?php
namespace app\index\controller;
class Index
{
public function index()
{
return '<style type="text/css">*{ padding: 0; margin: 0; } .think_default_text{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p> ThinkPHP V5<br/><span style="font-size:30px">十年磨一剑 - 为API开发设计的高性能框架</span></p><span style="font-size:22px;">[ V5.0 版本由 <a href="http://www.qiniu.com" target="qiniu">七牛云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="https://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="ad_bd568ce7058a1091"></think>';
}
}

21
application/route.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
'__pattern__' => [
'name' => '\w+',
],
'[hello]' => [
':id' => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
':name' => ['index/hello', ['method' => 'post']],
],
];

28
application/tags.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用行为扩展定义文件
return [
// 应用初始化
'app_init' => [],
// 应用开始
'app_begin' => [],
// 模块初始化
'module_init' => [],
// 操作开始执行
'action_begin' => [],
// 视图内容过滤
'view_filter' => [],
// 日志写入
'log_write' => [],
// 应用结束
'app_end' => [],
];

36
composer.json Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "topthink/think",
"description": "the new thinkphp framework",
"type": "project",
"keywords": [
"framework",
"thinkphp",
"ORM"
],
"homepage": "http://thinkphp.cn/",
"license": "Apache-2.0",
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"require": {
"php": ">=5.4.0",
"topthink/framework": "5.0.*",
"topthink/think-captcha": "1.*",
"phpmailer/phpmailer": "^6.1",
"tecnickcom/tcpdf": "^6.3"
},
"autoload": {
"psr-4": {
"app\\": "application"
}
},
"extra": {
"think-path": "thinkphp"
},
"config": {
"preferred-install": "dist"
}
}

66
error/400.html Normal file
View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>400 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 400 - Bad Request</h1>
<dl>
<dt>错误说明:因为错误的语法导致服务器无法理解请求信息。</dt>
<dt>原因1客户端发起的请求不符合服务器对请求的某些限制或者请求本身存在一定的错误。</dt>
<dd>解决办法:</dd>
<dd>链接中有特殊字符或者链接长度过长导致,请对应修改.</dd>
<dt>原因2request header 或者 cookie 过大所引起</dt>
<dd>解决办法:</dd>
<dd>crtl+shift+delete 快捷键清除cookie.</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

66
error/403.html Normal file
View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>403 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>403 - Forbidden 禁止访问: 访问被拒绝</h1>
<dl>
<dt>错误说明:禁止访问,服务器拒绝访问</dt>
<dt>原因1未找到默认的索引文件</dt>
<dd>解决办法:</dd>
<dd>IIS中【启用默认内容文档】选项中将默认打开文档修改为程序首页文件格式index.html或者index.php</dd>
<dt>原因2文件夹安全权限导致</dt>
<dd>解决办法:</dd>
<dd>程序文件-右击-属性-安全-Users-修改为读取和执行权限</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

75
error/404.html Normal file
View File

@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>404 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 50px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>404 - Page Not Found 未找到</h1>
<dl>
<dt>错误说明:请求的页面不存在</dt>
<dt>原因1访问的文档权限不够</dt>
<dd>解决办法:</dd>
<dd>修改文件权限为755windos系统修改目录权限为可写可读。</dd>
<dt>原因2防火墙的原因</dt>
<dd>解决办法:</dd>
<dd>先关闭让防火墙通过WWW服务。</dd>
<dt>原因3站点根目录无默认访问文件</dt>
<dd>解决办法:</dd>
<dd>在根目录中创建index.html或者创建index.php。</dd>
<dt>原因4站点配置目录不正确</dt>
<dd>解决办法:</dd>
<dd>将网站应用程序复制到站点目录中,或者修改站点配置目录指定到应用程序目录中。</dd>
<dt>原因5站点使用了伪静态</dt>
<dd>解决办法:</dd>
<dd>将伪静态规则删除,或者重新编写正确的伪静态规则,或关闭伪静态配置。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

78
error/500.html Normal file
View File

@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>500 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 40%;
margin: 0 auto;
}
.content >div{
margin-top: 50px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 500 - Internal Server Error 服务器内部错误</h1>
<dl>
<dt>错误说明:服务器内部错误,无法完成请求</dt>
<dt>原因1伪静态规则不正确</dt>
<dd>解决办法:</dd>
<dd>修改伪静态。</dd>
<dt>原因2php版本与网站程序不兼容</dt>
<dd>解决办法:</dd>
<dd>更换PHP版本。</dd>
<dt>原因3网站无法连接至数据库</dt>
<dd>解决办法:</dd>
<dd>正确修改站点的数据库配置文件。</dd>
<dt>原因4php禁用了某一函数需要开启</dt>
<dd>解决办法:</dd>
<dd>开启相关禁用函数。</dd>
<dt>原因5站点需要访问站外目录</dt>
<dd>解决办法:</dd>
<dd>关闭防跨站处理。</dd>
<dt>原因6源码本身有BUG</dt>
<dd>解决办法:</dd>
<dd>修复源码bug。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

63
error/501.html Normal file
View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>501 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 501 - Not Implemented</h1>
<dl>
<dt>错误说明:服务器没有相应的执行动作来完成当前请求。</dt>
<dt>原因1Web 服务器不支持实现此请求所需的功能</dt>
<dd>解决办法:</dd>
<dd>可以用来HttpWebRequest指定一个UserAgent来试试的有时候你可以换电脑来测试一下的。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

75
error/502.html Normal file
View File

@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>502 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 50px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 502 - Bad Gateway 没有响应</h1>
<dl>
<dt>错误说明坏的网关http向后端节点请求没有响应</dt>
<dt>原因1DNS 缓冲</dt>
<dd>解决办法:</dd>
<dd>在dos窗口运行 ipconfig /flushdns该命令会刷新DNS缓冲。</dd>
<dt>原因2浏览器代理</dt>
<dd>解决办法:</dd>
<dd>关掉代理。</dd>
<dt>原因3dns 被劫持了即使使用国外的dns也会被劫持</dt>
<dd>解决办法:</dd>
<dd>去掉VPN服务器的DNS。切换另外的dns。在windows系统中可以在本地网络连接的属性中去掉默认的dns选用国外的dns比如google的或opendns。</dd>
<dt>原因4php执行超时</dt>
<dd>解决办法:</dd>
<dd>修改/usr/local/php/etc/php.ini 将max_execution_time 改为300。</dd>
<dt>原因5nginx等待时间超时</dt>
<dd>解决办法:</dd>
<dd>适当增加nginx.conf配置文件中FastCGI的timeout时间。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

66
error/503.html Normal file
View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>503 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 503 - Service Unavailable 服务不可用</h1>
<dl>
<dt>错误说明:服务当前不可用</dt>
<dt>原因1服务不可用状态</dt>
<dd>解决办法:</dd>
<dd>服务器或许就是正在维护或者暂停了,你可以联系一下服务器空间商。</dd>
<dt>原因2程序占用资源太多</dt>
<dd>解决办法:</dd>
<dd>通过设置应用程序池把账户改为NetworkService即可解决。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

69
error/504.html Normal file
View File

@@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>504 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 50px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 504 - Gateway Timeout 网关超时</h1>
<dl>
<dt>错误说明:网关超时,服务器响应时间,达到超出设定的范围 </dt>
<dt>原因1后端电脑之间 IP 通讯缓慢而产生</dt>
<dd>解决办法:</dd>
<dd>如果您的 Web 服务器由某一网站托管, 只有负责那个网站设置的人员才能解决这个问题。</dd>
<dt>原因2由于nginx默认的fastcgi进程响应的缓冲区太小造成的错误</dt>
<dd>解决办法:</dd>
<dd>一般默认的fastcgi进程响应的缓冲区是8K这时可以设置大一点在nginx.conf里加入fastcgi_buffers 8 128k这表示设置fastcgi缓冲区为8块128k大小的空间。当然如果在进行某一项即时的操作, 可能需要nginx的超时参数调大点, 例如设置成60秒:send_timeout 60;经过这两个参数的调整一般不会再提示“504 Gateway Time-out”错误问题基本解决。</dd>
<dt>原因3PHP环境的配置问题</dt>
<dd>解决办法:</dd>
<dd>更改php-fpm的几处配置 把max_children由之前的10改为现在的30这样就可以保证有充足的php-cgi进程可以被使用 把request_terminate_timeout由之前的0s改为60s这样php-cgi进程 处理脚本的超时时间就是60秒可以防止进程都被挂起提高利用效率。 接着再更改nginx的几个配置项减少FastCGI的请求次数尽量维持buffers不变 fastcgi_buffers由 4 64k 改为 2 256k fastcgi_buffer_size 由 64k 改为 128K fastcgi_busy_buffers_size 由 128K 改为 256K fastcgi_temp_file_write_size 由 128K 改为 256K。 重新加载php-fpm和nginx的配置再次测试如果没有出现“504 Gateway Time-out”错误问题解决。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

66
error/505.html Normal file
View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>505 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 505 - HTTP Version Not Supported</h1>
<dl>
<dt>错误说明HTTP 版本不受支持。</dt>
<dt>原因1您的 Web 服务器不支持,或拒绝支持客户端(如您的浏览器)在发送给服务器的 HTTP 请求数据流中指定的 HTTP 协议版本</dt>
<dd>解决办法:</dd>
<dd>升级您的 Web 服务器软件。</dd>
<dt>原因2http请求格式的错误</dt>
<dd>解决办法:</dd>
<dd>对照一下自己的代码从打印的信息中终于找到问题所在。可能在请求后面多加了一个空格。http协议真是很严格了。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

63
error/506.html Normal file
View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>506 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 506 - Variant Also Negotiates</h1>
<dl>
<dt>错误说明:</dt>
<dt>原因1服务器存在内部配置错误</dt>
<dd>解决办法:</dd>
<dd>被请求的协商变元资源被配置为在透明内容协商中使用自己,因此在一个协商处理中不是一个合适的重点。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

63
error/507.html Normal file
View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>507 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 507 - Insufficient Storage</h1>
<dl>
<dt>错误说明:</dt>
<dt>原因1服务器无法存储完成请求所必须的内容</dt>
<dd>解决办法:</dd>
<dd>这个状况被认为是临时的。WebDAV (RFC 4918)。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

63
error/509.html Normal file
View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>509 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 509 - Bandwidth Limit Exceeded</h1>
<dl>
<dt>错误说明:</dt>
<dt>原因1网站流量已经超出您所购买的方案限制即服务器达到带宽限制</dt>
<dd>解决办法:</dd>
<dd>1.升级方案 2.等到下个月后流量重新计算,网站即可正常浏览。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

63
error/510.html Normal file
View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>510 错误 - phpstudy</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>HTTP 510 - Not Extended</h1>
<dl>
<dt>错误说明:</dt>
<dt>原因1获取资源所需要的策略并没有被满足</dt>
<dd>解决办法:</dd>
<dd>需要请求有额外的扩展内容,服务器才能处理请求。</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

67
error/index.html Normal file
View File

@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>站点创建成功-phpstudy for windows</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta HTTP-EQUIV="expires" CONTENT="0">
<style>
body{
font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
}
h1{
margin: 0;
color:#3a87ad;
font-size: 26px;
}
.content{
width: 45%;
margin: 0 auto;
}
.content >div{
margin-top: 200px;
padding: 20px;
background: #d9edf7;
border-radius: 12px;
}
.content dl{
color: #2d6a88;
line-height: 40px;
}
.content div div {
padding-bottom: 20px;
text-align:center;
}
</style>
</head>
<body>
<div class="content">
<div>
<h1>站点创建成功</h1>
<dl>
<dt>目录说明:</dt>
<dd>1网站目录/phpstudy安装目录/www/站点域名/</dd>
<dd>2错误提示页面/phpstudy安装目录/www/站点域名/error/</dd>
<dd>3你可以删除或者修改该目录下的所有文件</dd>
<dt>操作注意事项:</dt>
<dd>1新建站点、数据库、FTP可在phpstudy面板操作数据库可在环境中下载数据库管理软件等</dd>
<dd>2将网站程序放到站点目录时请使用复制剪切可能造成程序文件权限不正确</dd>
</dl>
<div>使用手册视频教程BUG反馈官网地址 <a href="https://www.xp.cn" target="_blank">www.xp.cn</a> </div>
</div>
</div>
</body>
</html>

2
extend/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_74
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.

9
nbproject/project.xml Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>tougao</name>
</data>
</configuration>
</project>

0
nginx.htaccess Normal file
View File

0
public/.htaccess Normal file
View File

View File

@@ -0,0 +1,266 @@
<template>
<div>
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item>
<i class="el-icon-lx-cascades"></i> 稿件列表
</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="container">
<div class="handle-box">
<el-select v-model="query.journal" placeholder="Please select journal">
<el-option
v-for="item in items"
:key="item.journal_id"
:label="item.title"
:value="item.journal_id"
></el-option>
</el-select>
<!-- <el-select v-model="query.address" placeholder="期刊" class="handle-select mr10">
<el-option key="1" label="广东省" value="广东省"></el-option>
<el-option key="2" label="湖南省" value="湖南省"></el-option>
</el-select>-->
<el-input v-model="query.name" placeholder="标题" class="handle-input mr10"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" @click="addArticle">新增</el-button>
</div>
<el-table
:data="tableData"
border
stripe
class="table"
ref="multipleTable"
header-cell-class-name="table-header"
>
<el-table-column prop="article_id" label="ID" width="55" align="center"></el-table-column>
<el-table-column prop="title" label="title" align="center"></el-table-column>
<el-table-column prop="journalname" label="journal" align="center"></el-table-column>
<!-- <el-table-column label="头像(查看大图)" align="center">
<template slot-scope="scope">
<el-image
class="table-td-thumb"
:src="scope.row.thumb"
:preview-src-list="[scope.row.thumb]"
></el-image>
</template>
</el-table-column>-->
<!-- <el-table-column prop="address" label="地址"></el-table-column> -->
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-tag
:type="scope.row.state==='成功'?'success':(scope.row.state==='失败'?'danger':'')"
>{{scope.row.state}}</el-tag>
</template>
</el-table-column>-->
<el-table-column prop="state" label="statue" :formatter="stateFormat" align="center"></el-table-column>
<el-table-column label="操作" width="180" align="center">
<!-- <template slot-scope="scope">
<el-button
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.$index, scope.row)"
>编辑</el-button>
<el-button
type="text"
icon="el-icon-delete"
class="red"
@click="handleDelete(scope.$index, scope.row)"
>删除</el-button>
</template>-->
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination
background
layout="total, prev, pager, next"
:current-page="query.pageIndex"
:page-size="query.pageSize"
:total="Total"
@current-change="handlePageChange"
></el-pagination>
</div>
</div>
<!-- 编辑弹出框 -->
<!-- <el-dialog title="编辑" :visible.sync="editVisible" width="30%">
<el-form ref="form" :model="form" label-width="70px">
<el-form-item label="用户名">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="地址">
<el-input v-model="form.address"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="editVisible = false"> </el-button>
<el-button type="primary" @click="saveEdit"> </el-button>
</span>
</el-dialog>-->
</div>
</template>
<script>
export default {
data() {
return {
items: '',
query: {
username: localStorage.getItem('ms_username'),
journal: 1,
name: '',
pageIndex: 1,
pageSize: 10
},
tableData: [],
multipleSelection: [],
delList: [],
editVisible: false,
Total: 0
// form: {},
// idx: -1,
// id: -1
};
},
created() {
this.initselect();
this.getdate();
},
methods: {
//初始化期刊选项
initselect() {
this.$api
.post('api/Article/getJournal')
.then(res => {
this.items = res;
})
.catch(err => {
console.log(err);
});
},
// 获取数据
getdate() {
this.$api
.post('api/Article/getArticle', this.query)
.then(res => {
this.Total = res.total;
this.tableData = res.data;
})
.catch(err => {
console.log(err);
});
},
// 触发搜索按钮
handleSearch() {
this.$set(this.query, 'pageIndex', 1);
this.getdate();
},
//跳转到增加稿件页面
addArticle() {
this.$router.push('/form');
},
//格式化状态输出
stateFormat(row, column) {
let str = '';
switch(row.state){
case 0:
str = '投稿中';
break;
case 1:
str = '已受理';
break;
case 2:
str = '送审中';
break;
case 3:
str = '拒稿';
break;
case 4:
str = '退修中';
break;
case 5:
str = '已录用';
break;
default:
str = 'error!!'
}
return str;
},
// // 删除操作
// handleDelete(index, row) {
// // 二次确认删除
// this.$confirm('确定要删除吗?', '提示', {
// type: 'warning'
// })
// .then(() => {
// this.$message.success('删除成功');
// this.tableData.splice(index, 1);
// })
// .catch(() => {});
// },
// // 多选操作
// handleSelectionChange(val) {
// this.multipleSelection = val;
// },
// delAllSelection() {
// const length = this.multipleSelection.length;
// let str = '';
// this.delList = this.delList.concat(this.multipleSelection);
// for (let i = 0; i < length; i++) {
// str += this.multipleSelection[i].name + ' ';
// }
// this.$message.error(`删除了${str}`);
// this.multipleSelection = [];
// },
// // 编辑操作
// handleEdit(index, row) {
// this.idx = index;
// this.form = row;
// this.editVisible = true;
// },
// // 保存编辑
// saveEdit() {
// this.editVisible = false;
// this.$message.success(`修改第 ${this.idx + 1} 行成功`);
// this.$set(this.tableData, this.idx, this.form);
// },
// 分页导航
handlePageChange(val) {
this.$set(this.query, 'pageIndex', val);
this.getdate();
}
}
};
</script>
<style scoped>
.handle-box {
margin-bottom: 20px;
}
.handle-select {
width: 120px;
}
.handle-input {
width: 300px;
display: inline-block;
}
.table {
width: 100%;
font-size: 14px;
}
.red {
color: #ff0000;
}
.mr10 {
margin-right: 10px;
}
.table-td-thumb {
display: block;
margin: auto;
width: 40px;
height: 40px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Some files were not shown because too many files have changed in this diff Show More