diff --git a/application/api/controller/Preaccept.php b/application/api/controller/Preaccept.php
index dfd5dad..234c474 100644
--- a/application/api/controller/Preaccept.php
+++ b/application/api/controller/Preaccept.php
@@ -32,7 +32,7 @@ class Preaccept extends Base
if($production_info==null){
return jsonError("Object is null");
}
- $list = $this->production_article_refer_obj->where("p_article_id",$production_info['p_article_id'])->where('state',0)->select();
+ $list = $this->production_article_refer_obj->where("p_article_id",$production_info['p_article_id'])->where('state',0)->order("index")->select();
$re["refers"] = $list;
return jsonSuccess($re);
@@ -59,6 +59,116 @@ class Preaccept extends Base
return jsonSuccess([]);
}
+ /**添加refer
+ * @return \think\response\Json
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ */
+ public function addRefer(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "article_id"=>"require",
+ "pre_p_refer_id"=>"require",
+ "doi"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $p_info = $this->production_article_obj->where('article_id',$data['article_id'])->where('state',0)->find();
+ $pre_refer = $this->production_article_refer_obj->where('p_refer_id',$data['pre_p_refer_id'])->find();
+ $this->production_article_refer_obj->where('p_article_id',$p_info['p_article_id'])->where("index",">",$pre_refer['index'])->where('state',0)->setInc('index');
+ $insert['p_article_id'] = $p_info['p_article_id'];
+ $insert['refer_doi'] = $data['doi'];
+ $insert['index'] = $pre_refer['index']+1;
+ $insert['ctime'] = time();
+ $adId = $this->production_article_refer_obj->insertGetId($insert);
+ my_doiToFrag2($this->production_article_refer_obj->where('p_refer_id',$adId)->find());
+ return jsonSuccess([]);
+ }
+
+ /**删除refer
+ * @return \think\response\Json
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\exception\PDOException
+ */
+ public function delRefer(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "p_refer_id"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $refer_info = $this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->find();
+ $this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->where('index',">",$refer_info['index'])->setDec('index');
+ $this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->update(['state'=>1]);
+ return jsonSuccess([]);
+ }
+
+ /**编辑refer
+ * @return \think\response\Json
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\exception\PDOException
+ */
+ public function editRefer(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "p_refer_id"=>"require",
+ "doi"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->update(['refer_doi'=>$data['doi']]);
+ my_doiToFrag2($this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->find());
+ return jsonSuccess([]);
+ }
+
+ /**调整refer排序
+ * @return \think\response\Json
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ */
+ public function sortRefer(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "p_refer_id"=>"require",
+ "act"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $refer_info = $this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->find();
+ if($data['act']=="up"){
+ $up_info = $this->production_article_refer_obj->where('p_article_id',$refer_info['p_article_id'])->where('index',$refer_info['index']-1)->find();
+ if(!$up_info){
+ return jsonError("system error");
+ }
+ $this->production_article_refer_obj->where('p_refer_id',$up_info['p_refer_id'])->setInc("index");
+ $this->production_article_refer_obj->where('p_refer_id',$refer_info['p_refer_id'])->setDec("index");
+ }else{
+ $down_info = $this->production_article_refer_obj->where('p_article_id',$refer_info['p_article_id'])->where('index',$refer_info['index']+1)->find();
+ if(!$down_info){
+ return jsonError("system error");
+ }
+ $this->production_article_refer_obj->where('p_refer_id',$refer_info['p_refer_id'])->setInc("index");
+ $this->production_article_refer_obj->where('p_refer_id',$down_info['p_refer_id'])->setDec("index");
+ }
+ return jsonSuccess([]);
+ }
+
+
+
public function addRefersByExcel(){
$data = $this->request->post();
$rule = new Validate([
@@ -74,12 +184,14 @@ class Preaccept extends Base
}
$file = ROOT_PATH . 'public' . DS . "referFile".DS.$data['referFile'];
$list = $this->readRefersExcel($file);
- foreach ($list as $v){
+ foreach ($list as $k=> $v){
$ca['p_article_id'] = $production_info['p_article_id'];
$ca['refer_content'] = $v['content'];
$ca['refer_doi'] = $v['doi'];
+ $ca['index'] = $k;
$ca['ctime'] = time();
- $this->production_article_refer_obj->insert($ca);
+ $adId=$this->production_article_refer_obj->insertGetId($ca);
+ my_doiToFrag2($this->production_article_refer_obj->where('p_refer_id',$adId)->find());
}
return jsonSuccess([]);
}
@@ -117,7 +229,7 @@ class Preaccept extends Base
- /**上传引用文献文件
+ /**上传引用文献文件,并返回读取到的内容
* @return \think\response\Json|void
*/
public function up_refer_file(){
diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php
index b2d7dee..fb78dea 100644
--- a/application/api/controller/Production.php
+++ b/application/api/controller/Production.php
@@ -1406,6 +1406,7 @@ class Production extends Base
foreach ($data['refers'] as $k => $v) {
$cache_insert['p_article_id'] = $p_info['p_article_id'];
$cache_insert['refer_content'] = $v;
+ $cache_insert['index'] = $k;
$cache_insert['ctime'] = time();
$this->production_article_refer_obj->insert($cache_insert);
}
diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index dc6f4ed..1c73dfd 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -137,6 +137,22 @@ class User extends Base
$insert['icon'] = $icon;
$insert['ctime'] = time();
$this->user_to_yboard_obj->insert($insert);
+
+ //发送通知邮件给用户
+// $report_tt = "Dear " . $inser_data['realname'] . ',
';
+// $report_tt .= "We are delighted to welcome you as a new author for our journal, " . $journal_info['title'] . ". We have received your submission and are excited to review it for potential publication.
";
+// $report_tt .= "As a next step, we have created an account for you on our journal's website. Your account is [Username: " . trim($v['email']) . " password:$password]";
+// $report_tt .= "and you can access your account by visiting " . $journal_info['website'] . " and logging in.
";
+// $report_tt .= "If you have any questions or need assistance with accessing your account, please don't hesitate to contact us. We are here to support you throughout the submission and review process.
";
+// $report_tt .= "Thank you for choosing to submit your work to our journal. We look forward to working with you.
";
+// $report_tt .= "Best regards,
" . $journal_info['title'];
+// $maidata['email'] = trim($v['email']);
+// $maidata['title'] = $journal_info['title'];
+// $maidata['content'] = $report_tt;
+// $maidata['tmail'] = $journal_info['email'];
+// $maidata['tpassword'] = $journal_info['epassword'];
+// Queue::push('app\api\job\mail@fire', $maidata, "tmail");
+
return jsonSuccess([]);
}