123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810 |
- <?php
- namespace app\index\controller;
- 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\Comments;
- use app\admin\model\cms\InviteReviewer;
- use app\admin\model\cms\Participate;
- use app\admin\model\EmailContent;
- use app\common\controller\Frontend;
- use app\common\library\Ems;
- use app\common\library\Sms;
- use app\common\model\Attachment;
- use app\common\model\UserRoleContent;
- use app\common\model\UserRoleLog;
- use think\Config;
- use think\Cookie;
- use think\Hook;
- use think\Session;
- use think\Validate;
- /**
- * 会员中心
- */
- class User extends Frontend
- {
- protected $layout = 'default';
- protected $noNeedLogin = ['login', 'register', 'third', 'jump'];
- protected $noNeedRight = ['*'];
- public function _initialize()
- {
- parent::_initialize();
- $auth = $this->auth;
- if (!Config::get('fastadmin.usercenter')) {
- $this->error(__('User center already closed'), '/');
- }
- //监听注册登录退出的事件
- Hook::add('user_login_successed', function ($user) use ($auth) {
- $expire = input('post.keeplogin') ? 30 * 86400 : 0;
- Cookie::set('uid', $user->id, $expire);
- Cookie::set('token', $auth->getToken(), $expire);
- });
- Hook::add('user_register_successed', function ($user) use ($auth) {
- Cookie::set('uid', $user->id);
- Cookie::set('token', $auth->getToken());
- });
- Hook::add('user_delete_successed', function ($user) use ($auth) {
- Cookie::delete('uid');
- Cookie::delete('token');
- });
- Hook::add('user_logout_successed', function ($user) use ($auth) {
- Cookie::delete('uid');
- Cookie::delete('token');
- });
- }
- /**
- * 会员中心
- */
- public function index()
- {
- $this->view->assign('title', __('User center'));
- return $this->view->fetch();
- }
- /**
- * 注册会员
- */
- public function register()
- {
- $url = $this->request->request('url', '', 'trim');
- if ($this->auth->id) {
- $this->success('You\'ve logged in, do not login again', $url ? $url : url('user/index'));
- }
- if ($this->request->isPost()) {
- $username = $this->request->post('username');
- $password = $this->request->post('password');
- $password_confirm = $this->request->post('password_confirm');
- // 判断密码是否一致
- if ($password != $password_confirm) {
- $this->error('Inconsistent password input', null, ['token' => $this->request->token()]);
- }
- $email = $this->request->post('email');
- $mobile = $this->request->post('mobile', '');
- $token = $this->request->post('__token__');
- $rule = [
- 'username' => 'require|length:3,30',
- 'password' => 'require|length:6,30',
- '__token__' => 'require|token',
- ];
- $msg = [
- 'username.require' => 'Username can not be empty',
- 'username.length' => 'Username must be 3 to 30 characters',
- 'password.require' => 'Password can not be empty',
- 'password.length' => 'Password must be 6 to 30 characters',
- ];
- $data = [
- 'username' => $username,
- 'password' => $password,
- 'email' => $email,
- 'mobile' => $mobile,
- '__token__' => $token,
- ];
- $validate = new Validate($rule, $msg);
- $result = $validate->check($data);
- if (!$result) {
- $this->error($validate->getError(), null, ['token' => $this->request->token()]);
- }
- if ($this->auth->register($username, $password)) {
- $this->success('Registration successful, please go to the corresponding email to check and verify', $url ? $url : url('user/login'));
- } else {
- $this->error($this->auth->getError(), null, ['token' => $this->request->token()]);
- }
- }
- //判断来源
- $referer = $this->request->server('HTTP_REFERER');
- if (!$url && (strtolower(parse_url($referer, PHP_URL_HOST)) == strtolower($this->request->host()))
- && !preg_match("/(user\/login|user\/register|user\/logout)/i", $referer)) {
- $url = $referer;
- }
- $this->view->assign('url', $url);
- $this->view->assign('title', 'Register');
- return $this->view->fetch();
- }
- /**
- * 会员登录
- */
- public function login()
- {
- $url = $this->request->request('url', '', 'trim');
- if ($this->auth->id) {
- $this->success('You\'ve logged in, do not login again', $url ? $url : url('user/index'));
- }
- if ($this->request->isPost()) {
- $account = $this->request->post('account');
- $password = $this->request->post('password');
- $keeplogin = (int)$this->request->post('keeplogin');
- $token = $this->request->post('__token__');
- $rule = [
- 'account' => 'require|length:3,50',
- 'password' => 'require|length:6,30',
- '__token__' => 'require|token',
- ];
- $msg = [
- 'account.require' => 'Account can not be empty',
- 'account.length' => 'Account must be 3 to 50 characters',
- 'password.require' => 'Password can not be empty',
- 'password.length' => 'Password must be 6 to 30 characters',
- ];
- $data = [
- 'account' => $account,
- 'password' => $password,
- '__token__' => $token,
- ];
- $validate = new Validate($rule, $msg);
- $result = $validate->check($data);
- if (!$result) {
- $this->error(__($validate->getError()), null, ['token' => $this->request->token()]);
- return false;
- }
- if ($this->auth->login($account, $password)) {
- // $this->success('Logged in successful', $url ? $url : url('user/index'));
- $this->success('Logged in successful', url('/'));
- } else {
- $this->error($this->auth->getError(), null, ['token' => $this->request->token()]);
- }
- }
- //判断来源
- $referer = $this->request->server('HTTP_REFERER');
- if (!$url && (strtolower(parse_url($referer, PHP_URL_HOST)) == strtolower($this->request->host()))
- && !preg_match("/(user\/login|user\/register|user\/logout)/i", $referer)) {
- $url = $referer;
- }
- $this->view->assign('url', $url);
- $this->view->assign('title', __('Login'));
- return $this->view->fetch();
- }
- /**
- * 退出登录
- */
- public function logout()
- {
- if ($this->request->isPost()) {
- $this->token();
- //退出本站
- $this->auth->logout();
- // $this->success(__('Logout successful'), url('user/index'));
- // $this->success('Logout successful', url('/'));
- $this->redirect(url('user/jump'));
- }
- $html = "<form id='logout_submit' name='logout_submit' action='' method='post'>" . token() . "<input type='submit' value='ok' style='display:none;'></form>";
- $html .= "<script>document.forms['logout_submit'].submit();</script>";
- return $html;
- }
- /**
- * 退出登录
- *
- * @return string
- * @throws \think\Exception
- */
- public function jump()
- {
- $this->view->assign('title', 'Logout out');
- return $this->view->fetch();
- }
- /**
- * 个人信息
- */
- public function profile()
- {
- $this->view->assign('title', __('Profile'));
- return $this->view->fetch();
- }
- /**
- * 修改密码
- */
- public function changepwd()
- {
- if ($this->request->isPost()) {
- $oldpassword = $this->request->post("oldpassword");
- $newpassword = $this->request->post("newpassword");
- $renewpassword = $this->request->post("renewpassword");
- $token = $this->request->post('__token__');
- $rule = [
- 'oldpassword' => 'require|regex:\S{6,30}',
- 'newpassword' => 'require|regex:\S{6,30}',
- 'renewpassword' => 'require|regex:\S{6,30}|confirm:newpassword',
- '__token__' => 'token',
- ];
- $msg = [
- 'renewpassword.confirm' => __('Password and confirm password don\'t match')
- ];
- $data = [
- 'oldpassword' => $oldpassword,
- 'newpassword' => $newpassword,
- 'renewpassword' => $renewpassword,
- '__token__' => $token,
- ];
- $field = [
- 'oldpassword' => __('Old password'),
- 'newpassword' => __('New password'),
- 'renewpassword' => __('Renew password')
- ];
- $validate = new Validate($rule, $msg, $field);
- $result = $validate->check($data);
- if (!$result) {
- $this->error(__($validate->getError()), null, ['token' => $this->request->token()]);
- return false;
- }
- $ret = $this->auth->changepwd($newpassword, $oldpassword);
- if ($ret) {
- $this->success(__('Reset password successful'), url('user/login'));
- } else {
- $this->error($this->auth->getError(), null, ['token' => $this->request->token()]);
- }
- }
- $this->view->assign('title', __('Change password'));
- return $this->view->fetch();
- }
- public function attachment()
- {
- //设置过滤方法
- $this->request->filter(['strip_tags']);
- if ($this->request->isAjax()) {
- $mimetypeQuery = [];
- $where = [];
- $filter = $this->request->request('filter');
- $filterArr = (array)json_decode($filter, true);
- if (isset($filterArr['mimetype']) && preg_match("/(\/|\,|\*)/", $filterArr['mimetype'])) {
- $this->request->get(['filter' => json_encode(array_diff_key($filterArr, ['mimetype' => '']))]);
- $mimetypeQuery = function ($query) use ($filterArr) {
- $mimetypeArr = array_filter(explode(',', $filterArr['mimetype']));
- foreach ($mimetypeArr as $index => $item) {
- $query->whereOr('mimetype', 'like', '%' . str_replace("/*", "/", $item) . '%');
- }
- };
- } elseif (isset($filterArr['mimetype'])) {
- $where['mimetype'] = ['like', '%' . $filterArr['mimetype'] . '%'];
- }
- if (isset($filterArr['filename'])) {
- $where['filename'] = ['like', '%' . $filterArr['filename'] . '%'];
- }
- if (isset($filterArr['createtime'])) {
- $timeArr = explode(' - ', $filterArr['createtime']);
- $where['createtime'] = ['between', [strtotime($timeArr[0]), strtotime($timeArr[1])]];
- }
- $search = $this->request->get('search');
- if ($search) {
- $where['filename'] = ['like', '%' . $search . '%'];
- }
- $model = new Attachment();
- $offset = $this->request->get("offset", 0);
- $limit = $this->request->get("limit", 0);
- $total = $model
- ->where($where)
- ->where($mimetypeQuery)
- ->where('user_id', $this->auth->id)
- ->order("id", "DESC")
- ->count();
- $list = $model
- ->where($where)
- ->where($mimetypeQuery)
- ->where('user_id', $this->auth->id)
- ->order("id", "DESC")
- ->limit($offset, $limit)
- ->select();
- $cdnurl = preg_replace("/\/(\w+)\.php$/i", '', $this->request->root());
- foreach ($list as $k => &$v) {
- $v['fullurl'] = ($v['storage'] == 'local' ? $cdnurl : $this->view->config['upload']['cdnurl']) . $v['url'];
- }
- unset($v);
- $result = array("total" => $total, "rows" => $list);
- return json($result);
- }
- $mimetype = $this->request->get('mimetype', '');
- $mimetype = substr($mimetype, -1) === '/' ? $mimetype . '*' : $mimetype;
- $this->view->assign('mimetype', $mimetype);
- $this->view->assign("mimetypeList", \app\common\model\Attachment::getMimetypeList());
- return $this->view->fetch();
- }
- /**
- * 我的个人主页
- */
- public function homepage()
- {
- $this->view->assign('title', 'My Personal Homepage');
- return $this->view->fetch();
- }
- /**
- * 我得邮箱页
- */
- public function inbox()
- {
- // 获取当前用户的邮箱内容信息
- $email_contents = EmailContent::where(['email' => $this->auth->email])->paginate();
- foreach ($email_contents as $content) {
- $content['user'] = \app\admin\model\User::where(['id' => $content['user_id']])->find();
- if ($content['type'] == 'admin') {
- $content['user'] = Admin::where(['id' => $content['user_id']])->find();
- }
- $content['createtime'] = date('Y-m-d', $content['createtime']);
- if ($content['status'] == 'normal') {
- $content['status'] = 'READ';
- } else {
- $content['status'] = 'Unread';
- }
- }
- $this->view->assign('list', $email_contents);
- $this->view->assign('title', 'INBOX');
- return $this->view->fetch();
- }
- /**
- * 我的未读邮件页
- */
- public function unread()
- {
- // 获取当前用户的邮箱内容信息
- $email_contents = EmailContent::where(['email' => $this->auth->email, 'status' => 'hidden'])->paginate();
- foreach ($email_contents as $content) {
- $content['user'] = \app\admin\model\User::where(['id' => $content['user_id']])->find();
- if ($content['type'] == 'admin') {
- $content['user'] = Admin::where(['id' => $content['user_id']])->find();
- }
- $content['createtime'] = date('Y-m-d', $content['createtime']);
- $content['status'] = 'Unread';
- }
- $this->view->assign('list', $email_contents);
- $this->view->assign('title', 'Unread');
- return $this->view->fetch();
- }
- /**
- * 提交手稿
- */
- public function submit_manuscript($id = null)
- {
- $row = [
- 'id' => '',
- 'manuscript_zip' => '',
- 'manuscript_pdf' => '',
- 'cover_letter' => '',
- 'graphical_abstract' => '',
- 'non_material' => '',
- 'is_copyright' => '',
- 'copyright_files' => '',
- 'image' => '',
- 'journal' => '',
- 'article_type' => '',
- 'title' => '',
- 'abstract' => '',
- 'keywords' => '',
- 'number_page' => '',
- 'is_funding' => '',
- 'funding_content' => '',
- 'is_interest' => '',
- 'interest_content' => '',
- 'statement_type' => '',
- 'article_one' => '',
- 'article_two' => '',
- 'article_three' => '',
- 'country' => '',
- 'affiliation' => '',
- 'name' => '',
- 'invoice_email' => '',
- 'order_email' => '',
- 'address' => '',
- 'zip_code' => '',
- 'city' => '',
- 'telephone' => '',
- 'fax' => '',
- 'vat' => '',
- ];
- $id = $this->request->param('id');
- if ($id) {
- $row = AuthorManuscript::where(['id' => $id])->find();
- $row->author_content = json_decode($row->author_content, true);
- $row->review_content = json_decode($row->review_content, true);
- }
- $this->view->assign('row', $row);
- $this->view->assign('title', 'Submit Manuscript');
- return $this->view->fetch();
- }
- /**
- * 手稿状态
- */
- public function display_submitted()
- {
- // 构建分页参数
- $limit = $this->request->param('limit', 10);
- $status = $this->request->param('status', 'All');
- $where = [];
- if ($status != 'All') {
- $where = ['status' => $status];
- }
- // 查询当前用户手稿
- $manuscripts = AuthorManuscript::where(['user_id' => $this->auth->id])
- ->where($where)
- ->field('id,title,image,createtime,journal')
- ->order('createtime', 'DESC')
- ->paginate($limit);
- foreach ($manuscripts as $manuscript) {
- $manuscript['journal'] = Channel::where(['id' => $manuscript['journal']])->value('name');
- }
- 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')
- ->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');
- }
- $this->success('', '', $manuscripts);
- }
- $this->view->assign('status', $status);
- $this->view->assign('list', $manuscripts);
- $this->view->assign('title', 'Dispaly Submitted');
- return $this->view->fetch();
- }
- /**
- * 审核人信息
- */
- public function reviewer_information()
- {
- $user_role_count = UserRoleLog::where(['user_id' => $this->auth->id, 'type' => 'review', 'is_adopt' => ['in', ['review', 'fault']]])->count();
- $user_content = UserRoleContent::where(['user_id' => $this->auth->id, 'type' => 'review'])->find();
- if (empty($user_content)) {
- $user_content['field'] = '';
- $user_content['degree'] = '';
- $user_content['affiliation'] = '';
- $user_content['publication'] = '';
- $user_content['orcid'] = '';
- $user_content['homepage'] = '';
- $user_content['review_journal'] = '';
- $user_content['interested_journal'] = '';
- $user_content['resume'] = '';
- $user_content['journal_ids'] = '';
- }
- $this->view->assign('row', $user_content);
- $this->view->assign('user_role_count', $user_role_count);
- $this->view->assign('title', 'Reviewer Information');
- return $this->view->fetch();
- }
- /**
- * 审阅的手稿
- */
- public function show_reviewed_manuscripts()
- {
- $limit = $this->request->param('limit', 10);
- $status = $this->request->param('status', '');
- $where = ['status' => $status];
- // 查询当前用户手稿
- $manuscripts = AuthorManuscript::whereRaw("FIND_IN_SET(". $this->auth->id .", `reviewer_ids`)")
- ->where($where)
- ->field('id,title,image,createtime,journal')
- ->order('createtime', 'DESC')
- ->paginate($limit);
- foreach ($manuscripts as $manuscript) {
- $manuscript['journal'] = Channel::where(['id' => $manuscript['journal']])->value('name');
- }
- if ($this->request->isAjax()) {
- $keyword = $this->request->param('keyword');
- $manuscripts = AuthorManuscript::where(['title' => ['like', '%'. $keyword .'%'], 'status' => $status])
- ->whereRaw("FIND_IN_SET(". $this->auth->id .", `reviewer_ids`)")
- ->field('id,title,image,createtime,journal')
- ->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');
- }
- $this->success('', '', $manuscripts);
- }
- $this->view->assign('status', $status);
- $this->view->assign('list', $manuscripts);
- $this->view->assign('title', 'Show Reviewed Manuscripts');
- return $this->view->fetch();
- }
- /**
- * 手稿详情
- */
- public function article_details($id = null)
- {
- $id = $this->request->param('id');
- $type = $this->request->param('type');
- $status = $this->request->param('status', 'reviewer_details');
- $row = AuthorManuscript::where(['id' => $id])->find();
- $row['review_content'] = json_decode($row['review_content'], true);
- if ($row) {
- $row['keywords'] = explode(',', $row['keywords']);
- }
- // 判断是审稿人还是编辑,如果是编辑则可以看到全部意见
- $comments = Comments::where(['manuscript_id' => $row['id']])->select();
- if ($type == 'reviewer') {
- $comments = Comments::where(['manuscript_id' => $row['id'], 'type' => 'reviewer'])->select();
- }
- if ($type == 'editor') {
- $reviewers = InviteReviewer::where(['manuscript_id' => $row['id']])->select();
- // 邀请的审稿人信息
- if ($status == 'reviewer_details') {
- foreach ($reviewers as $reviewer) {
- $reviewer_role = UserRoleContent::where(['id' => $reviewer['role_id']])->find();
- if ($reviewer_role) {
- // 查询审稿人提交意见信息
- $reviewer_comment = Comments::where(['user_id' => $reviewer_role['user_id'], 'manuscript_id' => $row['id']])
- ->order('createtime', 'DESC')
- ->find();
- $reviewer_user = \app\admin\model\User::where(['id' => $reviewer_role['user_id']])->find();
- }
- $reviewer['nickname'] = $reviewer_user['nickname'];
- $reviewer['invited_time'] = date('Y-m-d', $reviewer['createtime']);
- $reviewer['reply_time'] = date('Y-m-d', $reviewer_comment['createtime'] ?? '');
- $reviewer['submission_time'] = date('Y-m-d', $reviewer_comment['createtime'] ?? '');
- $reviewer['status'] = $reviewer_comment['recommendation'] ?? '';
- }
- }
- // 审稿人信息
- if ($status == 'reviewer_suggestion') {
- foreach ($reviewers as $reviewer) {
- $reviewer_role = UserRoleContent::where(['id' => $reviewer['role_id']])->find();
- if ($reviewer_role) {
- // 查询审稿人提交意见数量
- $reviewer_comment_num = Comments::where(['user_id' => $reviewer_role['user_id'], 'manuscript_id' => $row['id']])
- ->count();
- $reviewer_user = \app\admin\model\User::where(['id' => $reviewer_role['user_id']])->find();
- }
- $reviewer['nickname'] = $reviewer_user['nickname'];
- $reviewer['affiliation'] = $reviewer_role['affiliation'];
- $reviewer['comment_num'] = $reviewer_comment_num;
- }
- }
- // 审稿人意见信息
- if ($status == 'review_report') {
- foreach ($reviewers as $reviewer) {
- $reviewer_role = UserRoleContent::where(['id' => $reviewer['role_id']])->find();
- if ($reviewer_role) {
- // 查询审稿人提交意见信息
- $reviewer_comment = Comments::where(['user_id' => $reviewer_role['user_id'], 'manuscript_id' => $row['id']])
- ->order('createtime', 'DESC')
- ->find();
- $reviewer_user = \app\admin\model\User::where(['id' => $reviewer_role['user_id']])->find();
- }
- $reviewer['nickname'] = $reviewer_user['nickname'];
- $reviewer['recommendation'] = $reviewer_comment['recommendation'];
- $reviewer['comment'] = $reviewer_comment['comments'];
- $reviewer['createtime'] = date('Y-m-d', $reviewer_comment['createtime']);
- }
- }
- $row['reviewer'] = $reviewers;
- }
- $row['comments'] = $comments ?? [];
- $this->view->assign('status', $status);
- $this->view->assign('row', $row);
- $this->view->assign('type', $type);
- $this->view->assign('title', 'Article Details');
- return $this->view->fetch();
- }
- /**
- * 审稿页面
- */
- public function conduct_review($id = null)
- {
- $id = $this->request->param('id');
- $type = $this->request->param('type');
- $row = Comments::where(['manuscript_id' => $id, 'type' => $type])->find();
- $this->view->assign('row', $row);
- $this->view->assign('id', $id);
- $this->view->assign('type', $type);
- $this->view->assign('title', 'Conduct Review');
- return $this->view->fetch();
- }
- /**
- * 申请创建特刊
- */
- public function special_issue()
- {
- $this->view->assign('title', 'Apply to creat a special issue');
- return $this->view->fetch();
- }
- /**
- * 申请成为编辑
- */
- public function become_an_editor()
- {
- $user_content = UserRoleContent::where(['user_id' => $this->auth->id, 'type' => 'editor'])->find();
- if (empty($user_content)) {
- $user_content['degree'] = '';
- $user_content['affiliation'] = '';
- $user_content['publication'] = '';
- $user_content['orcid'] = '';
- $user_content['homepage'] = '';
- $user_content['review_journal'] = '';
- $user_content['interested_journal'] = '';
- $user_content['resume'] = '';
- $user_content['journal_ids'] = '';
- }
- $this->view->assign('row', $user_content);
- $this->view->assign('title', 'Apply to become an editor');
- return $this->view->fetch();
- }
- /**
- * 编辑手稿
- */
- public function editing_manuscripts()
- {
- $limit = $this->request->param('limit', 10);
- $type = $this->request->param('type');
- $status = $this->request->param('status', 'all');
- $where = [];
- if ($status != 'all') {
- $where = ['status' => $status];
- }
- // 查询当前用户手稿
- $manuscripts = AuthorManuscript::whereRaw("FIND_IN_SET(". $this->auth->id .", `editor_ids`)")
- ->where($where)
- ->field('id,title,image,createtime,journal')
- ->order('createtime', 'DESC')
- ->paginate($limit);
- foreach ($manuscripts as $manuscript) {
- $manuscript['journal'] = Channel::where(['id' => $manuscript['journal']])->value('name');
- }
- 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);
- foreach ($manuscripts as $manuscript) {
- $manuscript['createtime'] = date('Y-m-d', $manuscript['createtime']);
- }
- $this->success('', '', $manuscripts);
- }
- $this->view->assign('status', $status);
- $this->view->assign('type', $type);
- $this->view->assign('list', $manuscripts);
- $this->view->assign('title', 'Editing Manuscripts');
- return $this->view->fetch();
- }
- /**
- * 提交处理意见
- */
- public function handing_suggestions()
- {
- $id = $this->request->param('id');
- $type = $this->request->param('type');
- $row = Comments::where(['manuscript_id' => $id, 'type' => $type, 'user_id' => $this->auth->id])->find();
- if (empty($row)) {
- $row['is_interest'] = '';
- }
- $this->view->assign('row', $row);
- $this->view->assign('id', $id);
- $this->view->assign('type', $type);
- $this->view->assign('title', 'Submit Handing Suggestions');
- return $this->view->fetch();
- }
- /**
- * 邀请审稿人
- */
- public function invite_reviewers()
- {
- $id = $this->request->param('id');
- // 构建分页参数
- $limit = $this->request->param('limit', 10);
- // 获取审稿人信息
- $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);
- $list = UserRoleContent::with(['user'])->where(['user_id' => ['in', $review_id_arr], 'type' => 'review'])->select();
- foreach ($list as $value) {
- $channel_name_arr = Channel::where(['id' => ['in', explode(',', $value['journal_ids'])]])->column('name');
- $value['journal'] = implode(',', $channel_name_arr);
- }
- $this->view->assign('id', $id);
- $this->view->assign('list', $list);
- $this->view->assign('title', 'Invite Reviewers');
- return $this->view->fetch();
- }
- /**
- * 获取审稿人列表
- *
- * @return void
- * @throws \think\exception\DbException
- */
- public function getReviewerList()
- {
- // 构建分页参数
- $limit = $this->request->param('limit', 10);
- // 获取审稿人信息
- $review_id_arr = \app\common\model\User::where(['is_review' => 'correct'])->column('id');
- $data = UserRoleContent::with(['user'])->where(['user_id' => ['in', $review_id_arr], 'type' => 'review'])->paginate($limit);
- // 返回表格数据和分页信息
- $this->success('', '', $data);
- }
- /**
- * 提交会议
- *
- * @return string
- * @throws \think\Exception
- */
- public function submit_conference()
- {
- $this->view->assign('title', 'Submit Conference');
- return $this->view->fetch();
- }
- /**
- * 参加会议
- *
- * @return string
- * @throws \think\Exception
- */
- public function conference_participate()
- {
- $param = $this->request->param();
- $id = $param['id'];
- $row = Participate::where(['id' => $id])->find();
- $this->view->assign('id', $id);
- $this->view->assign('row', $row);
- $this->view->assign('title', 'Submit Conference');
- return $this->view->fetch();
- }
- }
|