|
@@ -6,6 +6,7 @@ use addons\wechat\model\WechatCaptcha;
|
|
|
use app\admin\model\Admin;
|
|
|
use app\admin\model\cms\AuthorManuscript;
|
|
|
use app\admin\model\cms\Channel;
|
|
|
+use app\admin\model\cms\Comment;
|
|
|
use app\admin\model\cms\Comments;
|
|
|
use app\admin\model\cms\InviteReviewer;
|
|
|
use app\admin\model\cms\Issue;
|
|
@@ -17,6 +18,7 @@ use app\common\library\Sms;
|
|
|
use app\common\model\Attachment;
|
|
|
use app\common\model\UserRoleContent;
|
|
|
use app\common\model\UserRoleLog;
|
|
|
+use app\manytenant\model\Manytenant;
|
|
|
use think\Config;
|
|
|
use think\Cookie;
|
|
|
use think\Db;
|
|
@@ -470,22 +472,47 @@ class User extends Frontend
|
|
|
// 查询当前用户手稿
|
|
|
$manuscripts = AuthorManuscript::where(['user_id' => $this->auth->id])
|
|
|
->where($where)
|
|
|
- ->field('id,title,image,createtime,journal')
|
|
|
+ ->field('id,title,image,createtime,journal,status')
|
|
|
->order('createtime', 'DESC')
|
|
|
->paginate($limit);
|
|
|
+ $author_edit_status = config('site.author_edit_status');
|
|
|
+ $author_comments_status = config('site.author_comments_status');
|
|
|
|
|
|
foreach ($manuscripts as $manuscript) {
|
|
|
$manuscript['journal'] = Channel::where(['id' => $manuscript['journal']])->value('name');
|
|
|
+ $manuscript['is_edit'] = false;
|
|
|
+ $manuscript['is_comments'] = false;
|
|
|
+ if (in_array($manuscript['status'], $author_edit_status)) {
|
|
|
+ $manuscript['is_edit'] = true;
|
|
|
+ }
|
|
|
+ if (in_array($manuscript['status'], $author_comments_status)) {
|
|
|
+ $manuscript['is_comments'] = true;
|
|
|
+ }
|
|
|
}
|
|
|
if ($this->request->isAjax()) {
|
|
|
$keyword = $this->request->param('keyword');
|
|
|
- $manuscripts = AuthorManuscript::where(['user_id' => $this->auth->id, 'title' => ['like', '%'. $keyword .'%'], 'status' => $status])
|
|
|
- ->field('id,title,image,createtime,journal')
|
|
|
+ $manuscripts = AuthorManuscript::where(['user_id' => $this->auth->id])
|
|
|
+ ->where(function ($query) use ($keyword, $status) {
|
|
|
+ if ($status != 'all') {
|
|
|
+ return $query->where(['status' => $status]);
|
|
|
+ }
|
|
|
+ if ($keyword != '') {
|
|
|
+ return $query->where(['title' => ['like', '%'. $keyword .'%']]);
|
|
|
+ }
|
|
|
+ })->field('id,title,image,createtime,journal,status')
|
|
|
->order('createtime', 'DESC')
|
|
|
->paginate($limit);
|
|
|
foreach ($manuscripts as $manuscript) {
|
|
|
$manuscript['createtime'] = date('Y-m-d', $manuscript['createtime']);
|
|
|
- $manuscript['journal'] = Channel::where(['id' => $manuscript['journal']])->value('name');
|
|
|
+ $manuscript['journal'] = Channel::where(['id' => $manuscript['journal']])->value('name') ?? '';
|
|
|
+ $manuscript['is_edit'] = false;
|
|
|
+ $manuscript['is_comments'] = false;
|
|
|
+ if (in_array($manuscript['status'], $author_edit_status)) {
|
|
|
+ $manuscript['is_edit'] = true;
|
|
|
+ }
|
|
|
+ if (in_array($manuscript['status'], $author_comments_status)) {
|
|
|
+ $manuscript['is_comments'] = true;
|
|
|
+ }
|
|
|
}
|
|
|
$this->success('', '', $manuscripts);
|
|
|
}
|
|
@@ -631,7 +658,20 @@ class User extends Frontend
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if ($status == 'author_report') {
|
|
|
+ // 查询作者提交意见信息回复
|
|
|
+ $author_comment = Comments::where(['user_id' => $row['user_id'], 'manuscript_id' => $row['id'], 'type' => 'author'])
|
|
|
+ ->order('createtime', 'DESC')
|
|
|
+ ->find();
|
|
|
+ if ($author_comment) {
|
|
|
+ $author_user = \app\admin\model\User::where(['id' => $row['user_id']])->find();
|
|
|
+ $author['nickname'] = $author_user['nickname'] ?? '';
|
|
|
+ $author['comment'] = $author_comment['comments'] ?? '';
|
|
|
+ $author['createtime'] = date('Y-m-d', $author_comment['createtime']);
|
|
|
+ }
|
|
|
+ }
|
|
|
$row['reviewer'] = $reviewers;
|
|
|
+ $row['author'] = $author ?? [];
|
|
|
}
|
|
|
$row['comments'] = $comments ?? [];
|
|
|
$this->view->assign('status', $status);
|
|
@@ -686,8 +726,8 @@ class User extends Frontend
|
|
|
*/
|
|
|
public function become_an_editor()
|
|
|
{
|
|
|
- $user_role = UserRoleLog::where(['user_id' => $this->auth->id, 'type' => 'editor', 'is_adopt' => ['in', ['review', 'fault']]])->order('createtime', 'DESC')->find();
|
|
|
$user_content = UserRoleContent::where(['user_id' => $this->auth->id, 'type' => 'editor'])->find();
|
|
|
+ $user = \app\common\model\User::get($this->auth->id);
|
|
|
if (empty($user_content)) {
|
|
|
$user_content['degree'] = '';
|
|
|
$user_content['affiliation'] = '';
|
|
@@ -698,9 +738,14 @@ class User extends Frontend
|
|
|
$user_content['interested_journal'] = '';
|
|
|
$user_content['resume'] = '';
|
|
|
$user_content['journal_ids'] = '';
|
|
|
+ $user_content['is_chief'] = '';
|
|
|
+ $user_content['is_editor'] = '';
|
|
|
+ } else {
|
|
|
+ $user_content['is_chief'] = $user['is_chief'];
|
|
|
+ $user_content['is_editor'] = $user['is_editor'];
|
|
|
}
|
|
|
$this->view->assign('row', $user_content);
|
|
|
- $this->view->assign('user_role', $user_role);
|
|
|
+ $this->view->assign('user', $user);
|
|
|
$this->view->assign('title', 'Apply to become an editor');
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
@@ -728,9 +773,14 @@ class User extends Frontend
|
|
|
}
|
|
|
if ($this->request->isAjax()) {
|
|
|
$keyword = $this->request->param('keyword');
|
|
|
- $manuscripts = AuthorManuscript::where(['title' => ['like', '%'. $keyword .'%']])->whereRaw("FIND_IN_SET(". $this->auth->id .", `editor_ids`)")->field('id,title,image,createtime')->order('createtime', 'DESC')->paginate($limit);
|
|
|
+ $manuscripts = AuthorManuscript::where(['title' => ['like', '%'. $keyword .'%']])->whereRaw("FIND_IN_SET(". $this->auth->id .", `editor_ids`)")->field('id,title,image,createtime,journal')->order('createtime', 'DESC')->paginate($limit);
|
|
|
foreach ($manuscripts as $manuscript) {
|
|
|
+ $manuscript['is_chief'] = false;
|
|
|
$manuscript['createtime'] = date('Y-m-d', $manuscript['createtime']);
|
|
|
+ $manuscript['journal'] = Channel::where(['id' => $manuscript['journal']])->value('name') ?? '';
|
|
|
+ if ($this->auth->is_chief == 'correct') {
|
|
|
+ $manuscript['is_chief'] = true;
|
|
|
+ }
|
|
|
}
|
|
|
$this->success('', '', $manuscripts);
|
|
|
}
|
|
@@ -769,11 +819,12 @@ class User extends Frontend
|
|
|
$id = $this->request->param('id');
|
|
|
// 构建分页参数
|
|
|
$limit = $this->request->param('limit', 10);
|
|
|
+ $manuscript = AuthorManuscript::get($id);
|
|
|
|
|
|
// 获取审稿人信息
|
|
|
- $review_id_arr = \app\common\model\User::where(['is_review' => 'correct'])->column('id');
|
|
|
-// $list = UserRoleContent::with(['user'])->where(['user_id' => ['in', $review_id_arr], 'type' => 'review'])->paginate($limit);
|
|
|
+ $review_id_arr = \app\common\model\User::where(['is_review' => 'correct', 'id' => ['not in', $manuscript->user_id]])->column('id');
|
|
|
$list = UserRoleContent::with(['user'])->where(['user_id' => ['in', $review_id_arr], 'type' => 'review'])->select();
|
|
|
+// $list = UserRoleContent::with(['user'])->where(['user_id' => ['in', $review_id_arr], 'type' => 'review'])->paginate($limit);
|
|
|
foreach ($list as $value) {
|
|
|
$channel_name_arr = Channel::where(['id' => ['in', explode(',', $value['journal_ids'])]])->column('name');
|
|
|
$value['journal'] = implode(',', $channel_name_arr);
|
|
@@ -841,12 +892,12 @@ class User extends Frontend
|
|
|
*/
|
|
|
public function special_issue_list()
|
|
|
{
|
|
|
- $status = $this->request->param('status', 'All');
|
|
|
+ $status = $this->request->param('status', 'all');
|
|
|
$where = ['user_id' => $this->auth->id];
|
|
|
- if ($status != 'All') {
|
|
|
+ if ($status != 'all') {
|
|
|
$where = ['status' => $status, 'user_id' => $this->auth->id];
|
|
|
}
|
|
|
- if ($status == '') {
|
|
|
+ if ($status == 'all') {
|
|
|
unset($where['status']);
|
|
|
}
|
|
|
|
|
@@ -854,7 +905,7 @@ class User extends Frontend
|
|
|
|
|
|
if ($this->request->isAjax()) {
|
|
|
$keyword = $this->request->param('keyword');
|
|
|
- if ($status == 'All') {
|
|
|
+ if ($status == 'all') {
|
|
|
$status = '';
|
|
|
}
|
|
|
$special_issues = Issue::where(['user_id' => $this->auth->id, 'issue_name' => ['like', '%'. $keyword .'%']])
|
|
@@ -885,4 +936,159 @@ class User extends Frontend
|
|
|
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 作者审稿意见
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function review_comments()
|
|
|
+ {
|
|
|
+ $param = $this->request->param();
|
|
|
+ $type = $param['type'];
|
|
|
+ $row = Comments::where(['manuscript_id' => $param['id']])->find();
|
|
|
+ $manuscript = AuthorManuscript::get($param['id']);
|
|
|
+ if (empty($row)) {
|
|
|
+ $row['manuscript_id'] = $param['id'];
|
|
|
+ $row['comments'] = '';
|
|
|
+ $row['status'] = $manuscript['status'];
|
|
|
+ }
|
|
|
+ $this->view->assign('row', $row);
|
|
|
+ $this->view->assign('type', $type);
|
|
|
+ return $this->view->fetch();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发送邮件列表
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function send_email()
|
|
|
+ {
|
|
|
+ $param = $this->request->param();
|
|
|
+ $type = $param['type'];
|
|
|
+ $row = AuthorManuscript::get($param['id']);
|
|
|
+
|
|
|
+ // 身份是不同的则需要查询不同人的列表
|
|
|
+ if ($type == 'author') {
|
|
|
+ /** 审稿人 编辑 */
|
|
|
+ $review_ids = explode(',', $row['reviewer_ids']);
|
|
|
+ $editor_ids = explode(',', $row['editor_ids']);
|
|
|
+ $user_arr = array_merge($review_ids, $editor_ids);
|
|
|
+ $user_arr = array_unique($user_arr);
|
|
|
+ }
|
|
|
+ if ($type == 'reviewer') {
|
|
|
+ /** 作者 编辑 */
|
|
|
+ $editor_ids = explode(',', $row['editor_ids']);
|
|
|
+ $author_ids = [$row['user_id']];
|
|
|
+ $user_arr = array_merge($editor_ids, $author_ids);
|
|
|
+ $user_arr = array_unique($user_arr);
|
|
|
+ }
|
|
|
+ if ($type == 'editor') {
|
|
|
+ /** 作者 审稿人 */
|
|
|
+ $author_ids = [$row['user_id']];
|
|
|
+ $review_ids = explode(',', $row['reviewer_ids']);
|
|
|
+ $user_arr = array_merge($review_ids, $author_ids);
|
|
|
+ $user_arr = array_unique($user_arr);
|
|
|
+ }
|
|
|
+
|
|
|
+ $user_list = \app\admin\model\User::where(['id' => ['in', $user_arr]])->column('email', 'id');
|
|
|
+ $this->view->assign('type', $type);
|
|
|
+ $this->view->assign('user_list', $user_list);
|
|
|
+ $this->view->assign('row', $row);
|
|
|
+ $this->view->assign('mail_smtp_host', $this->auth->mail_smtp_host);
|
|
|
+ $this->view->assign('mail_smtp_port', $this->auth->mail_smtp_port);
|
|
|
+ $this->view->assign('mail_smtp_user', $this->auth->mail_smtp_user);
|
|
|
+ $this->view->assign('mail_smtp_pass', $this->auth->mail_smtp_pass);
|
|
|
+ $this->view->assign('title', 'Send Email');
|
|
|
+ return $this->view->fetch();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 邀请编辑页
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function invite_editor()
|
|
|
+ {
|
|
|
+ $param = $this->request->param();
|
|
|
+ $type = $param['type'];
|
|
|
+ $row = AuthorManuscript::get($param['id']);
|
|
|
+ $this->view->assign('row', $row);
|
|
|
+ $this->view->assign('type', $type);
|
|
|
+ $this->view->assign('title', 'Invite Editor');
|
|
|
+ return $this->view->fetch();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 选择编辑
|
|
|
+ *
|
|
|
+ * @return \think\response\Json
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function choose_editor()
|
|
|
+ {
|
|
|
+ $info = \app\common\model\User::where(['is_editor' => 'correct', 'id' => ['not in', $this->auth->id]])->field('nickname, id')->select();
|
|
|
+ $params = $this->request->request();
|
|
|
+ if (array_key_exists('name', $params) && $params['name']) {
|
|
|
+ $info = \app\common\model\User::where(['is_editor' => 'correct', 'nickname' => ['like', '%' . $params['name'] . '%'], 'id' => ['not in', $this->auth->id]])->field('nickname, id')->select();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($this->request->request("keyValue")) {
|
|
|
+ $id_arr = $this->request->request('keyValue');
|
|
|
+ $info = \app\common\model\User::where(['id' => ['in', $id_arr]])->field('nickname, id')->select();
|
|
|
+ }
|
|
|
+
|
|
|
+ $arr = [];
|
|
|
+ foreach ($info as $item) {
|
|
|
+ $v['id'] = $item['id'];
|
|
|
+ $v['name'] = $item['nickname'];
|
|
|
+ $arr[] = $v;
|
|
|
+ }
|
|
|
+ $data['list'] = $arr;
|
|
|
+ $data['total'] = count($arr);
|
|
|
+ return json($data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 选择期刊
|
|
|
+ *
|
|
|
+ * @return \think\response\Json
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function choose_journal()
|
|
|
+ {
|
|
|
+ $info = Channel::where(['parent_id' => 1])->field('name, id')->select();
|
|
|
+ $params = $this->request->request();
|
|
|
+ if (array_key_exists('name', $params) && $params['name']) {
|
|
|
+ $info = Channel::where(['parent_id' => 1, 'name' => ['like', '%' . $params['name'] . '%']])->field('name, id')->select();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($this->request->request("keyValue")) {
|
|
|
+ $id_arr = $this->request->request('keyValue');
|
|
|
+ $info = Channel::where(['id' => ['in', $id_arr]])->field('name, id')->select();
|
|
|
+ }
|
|
|
+
|
|
|
+ $arr = [];
|
|
|
+ foreach ($info as $item) {
|
|
|
+ $v['id'] = $item['id'];
|
|
|
+ $v['name'] = $item['name'];
|
|
|
+ $arr[] = $v;
|
|
|
+ }
|
|
|
+ $data['list'] = $arr;
|
|
|
+ $data['total'] = count($arr);
|
|
|
+ return json($data);
|
|
|
+ }
|
|
|
}
|