1
This commit is contained in:
@@ -45,6 +45,7 @@ class Production extends Controller
|
|||||||
protected $production_article_organ_obj = '';
|
protected $production_article_organ_obj = '';
|
||||||
protected $production_article_refer_obj = '';
|
protected $production_article_refer_obj = '';
|
||||||
protected $production_article_author_to_organ_obj = '';
|
protected $production_article_author_to_organ_obj = '';
|
||||||
|
protected $production_article_frag_obj = '';
|
||||||
|
|
||||||
public function __construct(\think\Request $request = null)
|
public function __construct(\think\Request $request = null)
|
||||||
{
|
{
|
||||||
@@ -81,12 +82,14 @@ class Production extends Controller
|
|||||||
$this->production_article_organ_obj = Db::name('production_article_organ');
|
$this->production_article_organ_obj = Db::name('production_article_organ');
|
||||||
$this->production_article_refer_obj = Db::name('production_article_refer');
|
$this->production_article_refer_obj = Db::name('production_article_refer');
|
||||||
$this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ');
|
$this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ');
|
||||||
|
$this->production_article_frag_obj = Db::name('production_article_frag');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加生产实例
|
* 添加生产实例
|
||||||
*/
|
*/
|
||||||
public function addProduction(){
|
public function addProduction()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'article_id' => 'require|number'
|
'article_id' => 'require|number'
|
||||||
@@ -144,9 +147,7 @@ class Production extends Controller
|
|||||||
$frag['main'][] = $v;
|
$frag['main'][] = $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$insert['main'] = isset($frag['main']) ? json_encode($frag['main']) : '';
|
||||||
|
|
||||||
|
|
||||||
$insert['article_id'] = $data['article_id'];
|
$insert['article_id'] = $data['article_id'];
|
||||||
$insert['journal_id'] = $article_info['journal_id'];
|
$insert['journal_id'] = $article_info['journal_id'];
|
||||||
$insert['ctime'] = time();
|
$insert['ctime'] = time();
|
||||||
@@ -157,7 +158,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 删除生产实例
|
* 删除生产实例
|
||||||
*/
|
*/
|
||||||
public function delProduction(){
|
public function delProduction()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id' => 'require|number'
|
'p_article_id' => 'require|number'
|
||||||
@@ -172,18 +174,22 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 编辑生产实例
|
* 编辑生产实例
|
||||||
*/
|
*/
|
||||||
public function editProduction(){
|
public function editProduction()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id' => 'require|number',
|
'p_article_id' => 'require|number',
|
||||||
|
'journal_stage_id' => 'require',
|
||||||
'title' => 'require',
|
'title' => 'require',
|
||||||
'type' => 'require',
|
'type' => 'require',
|
||||||
'icon' => 'require',
|
'icon' => 'require',
|
||||||
'tradition_tag' => 'require',
|
'tradition_tag' => 'require',
|
||||||
'tradition' => 'require',
|
'tradition' => 'require',
|
||||||
'doi'=>'require',
|
|
||||||
'abstract' => 'require',
|
'abstract' => 'require',
|
||||||
|
'acknowledgment' => 'require',
|
||||||
|
'abbreviation' =>'require',
|
||||||
'keywords' => 'require',
|
'keywords' => 'require',
|
||||||
|
'author_contribution'=>'require',
|
||||||
'fund' => 'require',
|
'fund' => 'require',
|
||||||
'abbr' => 'require',
|
'abbr' => 'require',
|
||||||
'pub_date' => 'require',
|
'pub_date' => 'require',
|
||||||
@@ -191,29 +197,136 @@ class Production extends Controller
|
|||||||
if (!$rule->check($data)) {
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
|
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
|
||||||
|
$journal_info = $this->journal_obj->where('journal_id', $p_info['journal_id'])->find();
|
||||||
|
|
||||||
|
|
||||||
$update['title'] = trim($data['title']);
|
$update['title'] = trim($data['title']);
|
||||||
|
$update['journal_stage_id'] = $data['journal_stage_id'];
|
||||||
$update['type'] = trim($data['type']);
|
$update['type'] = trim($data['type']);
|
||||||
$update['icon'] = trim($data['icon']);
|
$update['icon'] = trim($data['icon']);
|
||||||
$update['tradition_tag'] = trim($data['tradition_tag']);
|
$update['tradition_tag'] = trim($data['tradition_tag']);
|
||||||
$update['tradition'] = trim($data['tradition']);
|
$update['tradition'] = trim($data['tradition']);
|
||||||
|
$update['author_contribution'] = trim($data['author_contribution']);
|
||||||
$update['mhoo'] = isset($data['mhoo']) ? trim($data['mhoo']) : '';
|
$update['mhoo'] = isset($data['mhoo']) ? trim($data['mhoo']) : '';
|
||||||
$update['doi'] = trim($data['doi']);
|
|
||||||
$update['ltai'] = isset($data['ltai']) ? trim($data['ltai']) : '';
|
$update['ltai'] = isset($data['ltai']) ? trim($data['ltai']) : '';
|
||||||
$update['abstract'] = trim($data['abstract']);
|
$update['abstract'] = trim($data['abstract']);
|
||||||
$update['keywords'] = trim($data['keywords']);
|
$update['keywords'] = trim($data['keywords']);
|
||||||
|
$update['abbreviation'] = trim($data['abbreviation']);
|
||||||
|
$update['acknowledgment'] = trim($data['acknowledgment']);
|
||||||
$update['fund'] = trim($data['fund']);
|
$update['fund'] = trim($data['fund']);
|
||||||
$update['abbr'] = trim($data['abbr']);
|
$update['abbr'] = trim($data['abbr']);
|
||||||
$update['pub_date'] = trim($data['pub_date']);
|
$update['pub_date'] = trim($data['pub_date']);
|
||||||
$update['npp'] = $data['npp'];
|
$update['npp'] = isset($data['npp'])?$data['npp']:'';
|
||||||
|
|
||||||
|
//生成doi号
|
||||||
|
$doi = '';
|
||||||
|
if ($p_info['doi'] == '') {
|
||||||
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Journal/getStageDetail';
|
||||||
|
$cs['journal_stage_id'] = $data['journal_stage_id'];
|
||||||
|
$list = object_to_array(json_decode(myPost($url, $cs)));
|
||||||
|
$re = $list['data']['stage'];
|
||||||
|
$doi = $this->createdoi($re['stage_year'], $re['stage_vol'], $journal_info['abbr']);
|
||||||
|
}else{
|
||||||
|
$doi = $p_info['doi'];
|
||||||
|
}
|
||||||
|
$update['doi'] = $doi;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->production_article_obj->where('p_article_id', $data['p_article_id'])->update($update);
|
$this->production_article_obj->where('p_article_id', $data['p_article_id'])->update($update);
|
||||||
|
return jsonSuccess($update);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文章排版结果列表
|
||||||
|
*/
|
||||||
|
public function getArticleFrags(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$list = $this->production_article_frag_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
||||||
|
|
||||||
|
$re['frags'] = $list;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑文章主要内容
|
||||||
|
*/
|
||||||
|
public function editMainContent(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_article_id' => 'require|number',
|
||||||
|
'main'=>'require'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$update['main'] = json_encode($data['main']);
|
||||||
|
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($update);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function createdoi($year, $vol, $abbr)
|
||||||
|
{
|
||||||
|
$frag = '';
|
||||||
|
$doi = $abbr . $year . $vol . rand(1000, 9999);
|
||||||
|
$frag = $doi;
|
||||||
|
$check = $this->production_article_obj->where('doi', $doi)->find();
|
||||||
|
if ($check) {
|
||||||
|
$frag = $this->createdoi($year, $vol, $abbr);
|
||||||
|
}
|
||||||
|
return $frag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取引用文献列表
|
||||||
|
*/
|
||||||
|
public function getReferList(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$list = $this->production_article_refer_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
||||||
|
$re['refers'] = $list;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改参考文献的最终结果
|
||||||
|
*/
|
||||||
|
public function editReferFrag()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_refer_id' => 'require',
|
||||||
|
'refer_frag' => 'require'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$update['refer_frag'] = trim($data['refer_frag']);
|
||||||
|
$updata['cs'] = 1;
|
||||||
|
$this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->update($updata);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取生产实例列表
|
* 获取生产实例列表
|
||||||
*/
|
*/
|
||||||
public function getProductionList(){
|
public function getProductionList()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'editor_id' => 'require|number',
|
'editor_id' => 'require|number',
|
||||||
@@ -236,10 +349,110 @@ class Production extends Controller
|
|||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排版主方法入口
|
||||||
|
*/
|
||||||
|
public function doTypeSetting()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$p_info = $this->production_article_obj->where('p_article_id',$data['p_article_id'])->find();
|
||||||
|
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
|
||||||
|
$journal_info = $this->journal_obj->where('journal_id', $p_info['journal_id'])->find();
|
||||||
|
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
|
||||||
|
|
||||||
|
$typesetInfo = [];
|
||||||
|
$typesetInfo['info_title'] = $p_info['title'];
|
||||||
|
$typesetInfo['info_type'] = $p_info['type'];
|
||||||
|
$typesetInfo['doi'] = $p_info['doi'];
|
||||||
|
$typesetInfo['topic'] = '';
|
||||||
|
$typesetInfo['mainText'] = $p_info['main'];
|
||||||
|
|
||||||
|
$au_res = $this->authorFormate($data['p_article_id']);
|
||||||
|
|
||||||
|
$typesetInfo['author'] = $au_res['author'];
|
||||||
|
$typesetInfo['authorAddress'] = $au_res['address'];
|
||||||
|
$typesetInfo['authorContribution'] = $p_info['author_contribution'];
|
||||||
|
|
||||||
|
//查询通讯作者
|
||||||
|
$corr_authors = $this->production_article_author_obj->where('p_article_id',$data['p_article_id'])->where('is_report',1)->where('state',0)->select();
|
||||||
|
$corrauthor = '';
|
||||||
|
$corremail = '';
|
||||||
|
foreach($corr_authors as $v){
|
||||||
|
$corrauthor .= $v['first_name']. ' '.$v['last_name'].'. ';
|
||||||
|
$corremail .= $v['email'].'. ';
|
||||||
|
}
|
||||||
|
$typesetInfo['authorCorresponding'] = substr(trim($corrauthor),0,-1);
|
||||||
|
$typesetInfo['authorCorrespondingEmail'] = substr(trim($corremail),0,-1);
|
||||||
|
$typesetInfo['traditon'] = $p_info['tradition'];
|
||||||
|
$typesetInfo['journal'] = $journal_info['title'];
|
||||||
|
$typesetInfo['jabbr'] = $journal_info['jabbr'];
|
||||||
|
|
||||||
|
//查询分期
|
||||||
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Journal/getStageDetail';
|
||||||
|
$cs['journal_stage_id'] = $p_info['journal_stage_id'];
|
||||||
|
$list = object_to_array(json_decode(myPost($url, $cs)));
|
||||||
|
$stage_re = $list['data']['stage'];
|
||||||
|
|
||||||
|
$typesetInfo['stage'] = $stage_re['stage_year'].';'.$stage_re['stage_vol'].'('.$stage_re['stage_no'].'):'.$p_info['npp'];//2022;6(1):17
|
||||||
|
$typesetInfo['little_author'] = $p_info['abbr'];
|
||||||
|
$typesetInfo['website'] = $journal_info['website'];
|
||||||
|
$typesetInfo['acknowledgment'] = $p_info['acknowledgment'];
|
||||||
|
$typesetInfo['received_date'] = date("d F Y", $article_info['ctime']);;
|
||||||
|
$typesetInfo['accepted_date'] = date("d F Y", $article_info['rtime']);
|
||||||
|
$typesetInfo['online_date'] = $p_info['pub_date'];//这里可能会有问题
|
||||||
|
$typesetInfo['abbreviation'] = $p_info['abbreviation'];
|
||||||
|
$typesetInfo['abstractText'] = $p_info['abstract'];
|
||||||
|
$typesetInfo['keywords'] = $p_info['keywords'];
|
||||||
|
$typesetInfo['userAccount'] = $editor_info['nickname'];
|
||||||
|
|
||||||
|
//获取文件
|
||||||
|
$files = $this->article_file_obj
|
||||||
|
->where('article_id', $article_info['article_id'])
|
||||||
|
->where('type_name', 'manuscirpt')
|
||||||
|
->order('ctime desc')
|
||||||
|
->limit(1)
|
||||||
|
->select();
|
||||||
|
if (count($files) == 0) {
|
||||||
|
return jsonError('No Manuscript');
|
||||||
|
}
|
||||||
|
$typesetInfo['filename'] = "http://api.tmrjournals.com/public/" . $files[0]['file_url'];
|
||||||
|
|
||||||
|
$rs = $this->production_article_refer_obj->where('p_article_id',$p_info['p_article_id'])->where('state',0)->select();
|
||||||
|
$refers = [];
|
||||||
|
foreach ($rs as $v) {
|
||||||
|
$refers[] = $v['refer_frag'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$typesetInfo['refers'] = json_encode($refers);
|
||||||
|
|
||||||
|
$url = "http://ts.tmrjournals.com/api/typeset/webGetDocx";
|
||||||
|
$res = object_to_array(json_decode(myPost1($url, $typesetInfo)));
|
||||||
|
|
||||||
|
if (!isset($res['data']['file']) || $res['data']['file'] == '') {
|
||||||
|
return jsonError('create error');
|
||||||
|
}
|
||||||
|
$file_res = $res['data']['file'];
|
||||||
|
$tf_insert['p_article_id'] = $p_info['p_article_id'];
|
||||||
|
$tf_insert['url'] = $file_res;
|
||||||
|
$tf_insert['ctime'] = time();
|
||||||
|
$this->production_article_frag_obj->insert($tf_insert);
|
||||||
|
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取生产实例详情
|
* 获取生产实例详情
|
||||||
*/
|
*/
|
||||||
public function getProductionDetail(){
|
public function getProductionDetail()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id' => 'require|number'
|
'p_article_id' => 'require|number'
|
||||||
@@ -265,7 +478,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 添加作者机构
|
* 添加作者机构
|
||||||
*/
|
*/
|
||||||
public function addAuthorOrgan(){
|
public function addAuthorOrgan()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id' => 'require|number',
|
'p_article_id' => 'require|number',
|
||||||
@@ -286,7 +500,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 删除作者机构
|
* 删除作者机构
|
||||||
*/
|
*/
|
||||||
public function delAuthorOrgan(){
|
public function delAuthorOrgan()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_organ_id' => 'require|number'
|
'p_article_organ_id' => 'require|number'
|
||||||
@@ -302,7 +517,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 编辑作者机构信息
|
* 编辑作者机构信息
|
||||||
*/
|
*/
|
||||||
public function editAuthorOrgan(){
|
public function editAuthorOrgan()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_organ_id' => 'require|number',
|
'p_article_organ_id' => 'require|number',
|
||||||
@@ -318,7 +534,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 获取机构列表
|
* 获取机构列表
|
||||||
*/
|
*/
|
||||||
public function getOrganList(){
|
public function getOrganList()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id' => 'require|number'
|
'p_article_id' => 'require|number'
|
||||||
@@ -335,7 +552,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 添加作者
|
* 添加作者
|
||||||
*/
|
*/
|
||||||
public function addAuthor(){
|
public function addAuthor()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id' => 'require|number',
|
'p_article_id' => 'require|number',
|
||||||
@@ -378,7 +596,6 @@ class Production extends Controller
|
|||||||
Db::rollback();
|
Db::rollback();
|
||||||
return jsonError("system error");
|
return jsonError("system error");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -520,7 +737,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 删除作者
|
* 删除作者
|
||||||
*/
|
*/
|
||||||
public function delAuthor(){
|
public function delAuthor()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_author_id' => 'require'
|
'p_article_author_id' => 'require'
|
||||||
@@ -535,7 +753,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 获取作者列表
|
* 获取作者列表
|
||||||
*/
|
*/
|
||||||
public function getAuthorlist(){
|
public function getAuthorlist()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id' => 'require'
|
'p_article_id' => 'require'
|
||||||
@@ -558,7 +777,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 更改附加文件
|
* 更改附加文件
|
||||||
*/
|
*/
|
||||||
public function editArticleFile() {
|
public function editArticleFile()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id' => 'require',
|
'p_article_id' => 'require',
|
||||||
@@ -589,7 +809,8 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 上传文章图片文件
|
* 上传文章图片文件
|
||||||
*/
|
*/
|
||||||
public function up_articlepic_file(){
|
public function up_articlepic_file()
|
||||||
|
{
|
||||||
$file = request()->file('articleicon');
|
$file = request()->file('articleicon');
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$info = $file->move(ROOT_PATH . 'public' . DS . 'articleicon');
|
$info = $file->move(ROOT_PATH . 'public' . DS . 'articleicon');
|
||||||
@@ -609,7 +830,8 @@ class Production extends Controller
|
|||||||
*
|
*
|
||||||
* @return upurl:图片地址
|
* @return upurl:图片地址
|
||||||
*/
|
*/
|
||||||
public function up_article_file($type) {
|
public function up_article_file($type)
|
||||||
|
{
|
||||||
$file = request()->file($type);
|
$file = request()->file($type);
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$info = $file->move(ROOT_PATH . 'public' . DS . $type);
|
$info = $file->move(ROOT_PATH . 'public' . DS . $type);
|
||||||
@@ -621,5 +843,58 @@ class Production extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function authorFormate($p_article_id)
|
||||||
|
{
|
||||||
|
// $authors = $this->article_author_obj->where('article_id', $article_id)->where('state', 0)->select();
|
||||||
|
|
||||||
|
$authors = $this->production_article_author_obj->where('p_article_id',$p_article_id)->where('state',0)->select();
|
||||||
|
//组装地址数组
|
||||||
|
$address = [];
|
||||||
|
foreach ($authors as $v) {
|
||||||
|
$cac = $this->production_article_author_to_organ_obj
|
||||||
|
->field('t_production_article_organ.*')
|
||||||
|
->join('t_production_article_organ','t_production_article_organ.p_article_organ_id = t_production_article_author_to_organ.p_article_organ_id','left')
|
||||||
|
->where('t_production_article_author_to_organ.p_article_author_id',$v['p_article_author_id'])
|
||||||
|
->where('t_production_article_author_to_organ.state',0)
|
||||||
|
->select();
|
||||||
|
foreach($cac as $val){
|
||||||
|
if(!in_array($val['organ_name'],$address)){
|
||||||
|
$address[] = $val['organ_name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//构建数组字符串
|
||||||
|
$author = '';
|
||||||
|
foreach ($authors as $v) {
|
||||||
|
$cache_str = $v['first_name'] . ' ' . $v['last_name'] . '<q>';
|
||||||
|
$cac = $this->production_article_author_to_organ_obj
|
||||||
|
->field('t_production_article_organ.*')
|
||||||
|
->join('t_production_article_organ','t_production_article_organ.p_article_organ_id = t_production_article_author_to_organ.p_article_organ_id','left')
|
||||||
|
->where('t_production_article_author_to_organ.p_article_author_id',$v['p_article_author_id'])
|
||||||
|
->where('t_production_article_author_to_organ.state',0)
|
||||||
|
->select();
|
||||||
|
foreach ($cac as $val) {
|
||||||
|
$cache_str .= (intval(search_array_val($address, $val['organ_name'])) + 1) . " ";
|
||||||
|
}
|
||||||
|
if ($v['is_first'] == 1) {
|
||||||
|
$cache_str .= '*';
|
||||||
|
}
|
||||||
|
if ($v['is_report'] == 1) {
|
||||||
|
$cache_str .= '#';
|
||||||
|
}
|
||||||
|
$cache_str = trim($cache_str);
|
||||||
|
$cache_str .= '</q>';
|
||||||
|
$author .= $cache_str;
|
||||||
|
}
|
||||||
|
//组装address
|
||||||
|
$address_str = '';
|
||||||
|
foreach ($address as $k => $v) {
|
||||||
|
$address_str .= ($k + 1) . ' ' . $v . ' ';
|
||||||
|
}
|
||||||
|
$frag['author'] = $author;
|
||||||
|
$frag['address'] = $address_str;
|
||||||
|
return $frag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user