|
@@ -949,52 +949,55 @@ class User extends Api
|
|
|
public function incomplete_submit()
|
|
|
{
|
|
|
$params = $this->request->post('row/a');
|
|
|
- // 数组内容需转换为字符串
|
|
|
- if (array_key_exists('author', $params) && !empty($params['author'])) {
|
|
|
- $params['author_content'] = json_encode($params['author']);
|
|
|
- }
|
|
|
- if (array_key_exists('reviewer', $params) && !empty($params['reviewer'])) {
|
|
|
- $params['review_content'] = json_encode($params['reviewer']);
|
|
|
- }
|
|
|
- if (empty($params['title'])) {
|
|
|
- $params['title'] = 'Incomplete editing' . rand(0, 4);
|
|
|
- }
|
|
|
- if (empty($params['image'])) {
|
|
|
- $params['image'] = '/assets/img/index/manuscript_empty.png';
|
|
|
- }
|
|
|
- $params['status'] = 'incomplete_submission';
|
|
|
- $params['user_id'] = $this->auth->id;
|
|
|
- // 因使用create方法返回自增id,但是验证字段有前端自定义字段所以需要删除
|
|
|
- unset($params['author']);
|
|
|
- unset($params['reviewer']);
|
|
|
- $manuscript = new AuthorManuscript();
|
|
|
-
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- if (!empty($params['id'])) {
|
|
|
- $manuscript = AuthorManuscript::where(['id' => $params['id']])->find();
|
|
|
- $manuscript = $manuscript->allowField(true)->save($params);
|
|
|
- } else {
|
|
|
- $manuscript = $manuscript->allowField(true)->create($params);
|
|
|
+ if ($params['manuscript_zip']) {
|
|
|
+ // 数组内容需转换为字符串
|
|
|
+ if (array_key_exists('author', $params) && !empty($params['author'])) {
|
|
|
+ $params['author_content'] = json_encode($params['author']);
|
|
|
}
|
|
|
-
|
|
|
- // 手稿状态日志
|
|
|
- $log = ManuscriptLog::where(['manuscript_id' => $params['id'], 'user_id' => $this->auth->id, 'type' => 'user', 'status' => $params['status']])->find();
|
|
|
- if (!$log) {
|
|
|
- $log = new ManuscriptLog();
|
|
|
- $log->manuscript_id = $params['id'];
|
|
|
- $log->user_id = $this->auth->id;
|
|
|
- $log->type = 'user';
|
|
|
+ if (array_key_exists('reviewer', $params) && !empty($params['reviewer'])) {
|
|
|
+ $params['review_content'] = json_encode($params['reviewer']);
|
|
|
}
|
|
|
- $log->status = $params['status'];
|
|
|
- $log->save();
|
|
|
+ if (empty($params['title'])) {
|
|
|
+ $params['title'] = 'Incomplete editing' . rand(0, 4);
|
|
|
+ }
|
|
|
+ if (empty($params['image'])) {
|
|
|
+ $params['image'] = '/assets/img/index/manuscript_empty.png';
|
|
|
+ }
|
|
|
+ $params['status'] = 'incomplete_submission';
|
|
|
+ $params['user_id'] = $this->auth->id;
|
|
|
+ // 因使用create方法返回自增id,但是验证字段有前端自定义字段所以需要删除
|
|
|
+ unset($params['author']);
|
|
|
+ unset($params['reviewer']);
|
|
|
+ $manuscript = new AuthorManuscript();
|
|
|
|
|
|
- Db::commit();
|
|
|
- } catch (ValidateException|PDOException|Exception $e) {
|
|
|
- Db::rollback();
|
|
|
- $this->error($e->getMessage());
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
+ if (!empty($params['id'])) {
|
|
|
+ $manuscript = AuthorManuscript::where(['id' => $params['id']])->find();
|
|
|
+ $manuscript = $manuscript->allowField(true)->save($params);
|
|
|
+ } else {
|
|
|
+ $manuscript = $manuscript->allowField(true)->create($params);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 手稿状态日志
|
|
|
+ $log = ManuscriptLog::where(['manuscript_id' => $params['id'], 'user_id' => $this->auth->id, 'type' => 'user', 'status' => $params['status']])->find();
|
|
|
+ if (!$log) {
|
|
|
+ $log = new ManuscriptLog();
|
|
|
+ $log->manuscript_id = $params['id'];
|
|
|
+ $log->user_id = $this->auth->id;
|
|
|
+ $log->type = 'user';
|
|
|
+ }
|
|
|
+ $log->status = $params['status'];
|
|
|
+ $log->save();
|
|
|
+
|
|
|
+ Db::commit();
|
|
|
+ } catch (ValidateException|PDOException|Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
+ $this->error($e->getMessage());
|
|
|
+ }
|
|
|
+ $this->success('Success', $manuscript->id ?? $params['id']);
|
|
|
}
|
|
|
- $this->success('Success', $manuscript->id ?? $params['id']);
|
|
|
+ $this->success('Success', '');
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1068,4 +1071,100 @@ class User extends Api
|
|
|
}
|
|
|
$this->success('Successfully');
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 文章详情,根据表格类型获取对应表格信息
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function get_article_detail_table()
|
|
|
+ {
|
|
|
+ $status = $this->request->param('status');
|
|
|
+ $manuscript_id = $this->request->param('manuscript_id');
|
|
|
+ $manuscript = AuthorManuscript::get($manuscript_id);
|
|
|
+ $reviewers = InviteReviewer::where(['manuscript_id' => $manuscript_id])->select();
|
|
|
+ // 邀请的审稿人信息
|
|
|
+ if ($status == 'reviewer_details') {
|
|
|
+ foreach ($reviewers as $reviewer) {
|
|
|
+ $reviewer_role = UserRoleContent::where(['id' => $reviewer['role_id']])->find();
|
|
|
+ $reviewer['reply_time'] = '';
|
|
|
+ $reviewer['submission_time'] = '';
|
|
|
+ if ($reviewer_role) {
|
|
|
+ // 查询审稿人提交意见信息
|
|
|
+ $reviewer_comment = Comments::where(['user_id' => $reviewer_role['user_id'], 'manuscript_id' => $manuscript_id])
|
|
|
+ ->order('createtime', 'DESC')
|
|
|
+ ->find();
|
|
|
+ $reviewer_user = \app\admin\model\User::where(['id' => $reviewer_role['user_id']])->find();
|
|
|
+ if ($reviewer_comment) {
|
|
|
+ $reviewer['reply_time'] = date('Y-m-d', $reviewer_comment['createtime'] ?? time());
|
|
|
+ $reviewer['submission_time'] = date('Y-m-d', $reviewer_comment['createtime'] ?? time());
|
|
|
+ $reviewer['status'] = $reviewer_comment['recommendation'] ?? '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $reviewer['nickname'] = $reviewer_user['nickname'];
|
|
|
+ $reviewer['invited_time'] = date('Y-m-d', $reviewer['createtime']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 审稿人信息
|
|
|
+ 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' => $manuscript_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();
|
|
|
+ $reviewer['createtime'] = '';
|
|
|
+ if ($reviewer_role) {
|
|
|
+ // 查询审稿人提交意见信息
|
|
|
+ $reviewer_comment = Comments::where(['user_id' => $reviewer_role['user_id'], 'manuscript_id' => $manuscript_id])
|
|
|
+ ->order('createtime', 'DESC')
|
|
|
+ ->find();
|
|
|
+ $reviewer_user = \app\admin\model\User::where(['id' => $reviewer_role['user_id']])->find();
|
|
|
+ if ($reviewer_comment) {
|
|
|
+ $reviewer['createtime'] = date('Y-m-d', $reviewer_comment['createtime']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $reviewer['nickname'] = $reviewer_user['nickname'];
|
|
|
+ $reviewer['recommendation'] = $reviewer_comment['recommendation'] ?? '';
|
|
|
+ $reviewer['comment'] = $reviewer_comment['comments'] ?? '';
|
|
|
+ $reviewer['comment_id'] = $reviewer_comment['id'] ?? '';
|
|
|
+ $reviewer['is_send'] = $reviewer_comment['is_send'] ?? '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 作者回复意见
|
|
|
+ if ($status == 'author_report') {
|
|
|
+ // 查询作者提交意见信息回复
|
|
|
+ $author_comment = Comments::where(['user_id' => $manuscript_id, 'manuscript_id' => $manuscript_id, 'type' => 'author'])
|
|
|
+ ->order('createtime', 'DESC')
|
|
|
+ ->find();
|
|
|
+ if ($author_comment) {
|
|
|
+ $author_user = \app\admin\model\User::where(['id' => $manuscript['user_id']])->find();
|
|
|
+ $author['nickname'] = $author_user['nickname'] ?? '';
|
|
|
+ $author['comment'] = $author_comment['comments'] ?? '';
|
|
|
+ $author['createtime'] = date('Y-m-d', $author_comment['createtime']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data['reviewer'] = $reviewers;
|
|
|
+ $data['author'] = $author ?? [];
|
|
|
+ $data['user_id'] = $manuscript['user_id'];
|
|
|
+
|
|
|
+ $this->success('', $data);
|
|
|
+ }
|
|
|
}
|