|
@@ -9,6 +9,7 @@ use app\admin\model\cms\Conference;
|
|
|
use app\admin\model\cms\Email;
|
|
|
use app\admin\model\cms\InviteReviewer;
|
|
|
use app\admin\model\cms\Issue;
|
|
|
+use app\admin\model\cms\ManuscriptLog;
|
|
|
use app\admin\model\cms\Participate;
|
|
|
use app\admin\model\EmailContent;
|
|
|
use app\common\controller\Api;
|
|
@@ -490,29 +491,12 @@ class User extends Api
|
|
|
if (!$params['keywords']) $this->error('Keywords Cannot be Empty');
|
|
|
if (!$params['number_page']) $this->error('Number of Pages Cannot be Empty');
|
|
|
if (!$params['author']) $this->error('Author Cannot be Empty');
|
|
|
- if (!$params['reviewer']) $this->error('Reviewer Cannot be Empty');
|
|
|
- // 添加
|
|
|
- if (!$params['id']) {
|
|
|
- $result = false;
|
|
|
- Db::startTrans();
|
|
|
- try {
|
|
|
- $params['user_id'] = $this->auth->id;
|
|
|
-
|
|
|
- // 数组内容需转换为字符串
|
|
|
- $params['author_content'] = json_encode($params['author']);
|
|
|
- $params['review_content'] = json_encode($params['reviewer']);
|
|
|
+ if (array_key_exists('reviewer', $params)) {
|
|
|
+ if (!$params['reviewer']) $this->error('Reviewer Cannot be Empty');
|
|
|
+ }
|
|
|
|
|
|
- $model = new AuthorManuscript();
|
|
|
- $result = $model->allowField(true)->save($params);
|
|
|
- Db::commit();
|
|
|
- } catch (ValidateException|PDOException|Exception $e) {
|
|
|
- Db::rollback();
|
|
|
- $this->error($e->getMessage());
|
|
|
- }
|
|
|
- if ($result === false) {
|
|
|
- $this->error('No rows were inserted');
|
|
|
- }
|
|
|
- } else {
|
|
|
+ // 修改
|
|
|
+ if ($params['id']) {
|
|
|
// 修改操作
|
|
|
$row = AuthorManuscript::where(['id' => $params['id']])->find();
|
|
|
if (empty($row)) $this->error('Submit Failed');
|
|
@@ -520,7 +504,25 @@ class User extends Api
|
|
|
try {
|
|
|
// 数组内容需转换为字符串
|
|
|
$params['author_content'] = json_encode($params['author']);
|
|
|
- $params['review_content'] = json_encode($params['reviewer']);
|
|
|
+ if (array_key_exists('reviewer', $params)) {
|
|
|
+ $params['review_content'] = json_encode($params['reviewer']);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果修改时状态是未编辑完得状态 提交后则修改完处理中状态
|
|
|
+ if ($row['status'] == 'incomplete_submission') {
|
|
|
+ $params['status'] = 'processing';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 手稿状态日志
|
|
|
+ $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();
|
|
|
|
|
|
$result = $row->allowField(true)->save($params);
|
|
|
Db::commit();
|
|
@@ -548,7 +550,27 @@ class User extends Api
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
$params['user_id'] = $this->auth->id;
|
|
|
+
|
|
|
+ // 获取手稿
|
|
|
+ $manuscript = AuthorManuscript::where(['id' => $params['manuscript_id']])->find();
|
|
|
+ if ($manuscript) {
|
|
|
+ $manuscript['status'] = $params['status'];
|
|
|
+ $manuscript->save();
|
|
|
+ }
|
|
|
+
|
|
|
$result = $model->allowField(true)->save($params);
|
|
|
+
|
|
|
+ // 手稿状态日志
|
|
|
+ $log = ManuscriptLog::where(['manuscript_id' => $params['manuscript_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();
|
|
@@ -625,7 +647,7 @@ class User extends Api
|
|
|
// 去重数组
|
|
|
$unique_reviewer_ids_arr = array_filter(array_unique($merged_reviewer_ids_arr));
|
|
|
$manuscript['reviewer_ids'] = implode(',', $unique_reviewer_ids_arr);
|
|
|
-// $manuscript['status'] =
|
|
|
+ $manuscript['status'] = $params['status'];
|
|
|
$result = $manuscript->save();
|
|
|
Db::commit();
|
|
|
} catch (ValidateException|PDOException|Exception $e) {
|
|
@@ -857,6 +879,18 @@ class User extends Api
|
|
|
} 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();
|