新增方法
This commit is contained in:
@@ -4438,4 +4438,54 @@ class Production extends Base
|
||||
Db::commit();
|
||||
return json_encode(array('status' => 1,'msg' => 'PDF generated successfully'));
|
||||
}
|
||||
/**
|
||||
* 获取排版生成PDF历史版本
|
||||
* @param p_article_id 文章ID
|
||||
*/
|
||||
public function getProductionArticlePdf($aParam = []){
|
||||
|
||||
//获取参数
|
||||
$aParam = empty($aParam) ? $this->request->post() : $aParam;
|
||||
|
||||
//必填值验证
|
||||
$iPArticleId = empty($aParam['p_article_id']) ? '' : $aParam['p_article_id'];
|
||||
if(empty($iPArticleId)){
|
||||
return json_encode(array('status' => 2,'msg' => 'Please select an article' ));
|
||||
}
|
||||
|
||||
//查询文章
|
||||
$aWhere = ['p_article_id' => $iPArticleId,'state' => ['in',[0,2]]];
|
||||
$aProductionArticle = Db::name('production_article')->field('article_id,pdf_id')->where($aWhere)->find();
|
||||
if(empty($aProductionArticle)){
|
||||
return json_encode(array('status' => 3,'msg' => 'No articles found' ));
|
||||
}
|
||||
$iArticleId = empty($aProductionArticle['article_id']) ? 0 : $aProductionArticle['article_id'];
|
||||
if(empty($iArticleId)){
|
||||
return json_encode(array('status' => 4,'msg' => 'Unbound article' ));
|
||||
}
|
||||
//日志查询
|
||||
$aWhere = ['article_id' => $iArticleId,'p_article_id' => $iPArticleId,'state' => 2];
|
||||
$aPdf = Db::name('production_article_pdf')->field('pdf_id,url,create_time')->where($aWhere)->select();
|
||||
return json_encode(array('status' => 1,'msg' => 'success','data' => $aPdf));
|
||||
}
|
||||
/**
|
||||
* 获取生产文章信息
|
||||
* @param p_article_id 文章ID
|
||||
*/
|
||||
public function getProductionArticle($aParam = []){
|
||||
|
||||
//获取参数
|
||||
$aParam = empty($aParam) ? $this->request->post() : $aParam;
|
||||
|
||||
//必填值验证
|
||||
$iPArticleId = empty($aParam['p_article_id']) ? '' : $aParam['p_article_id'];
|
||||
if(empty($iPArticleId)){
|
||||
return json_encode(array('status' => 2,'msg' => 'Please select an article' ));
|
||||
}
|
||||
|
||||
//查询文章
|
||||
$aWhere = ['p_article_id' => $iPArticleId,'state' => ['in',[0,2]]];
|
||||
$aProductionArticle = Db::name('production_article')->field('pdf_id,file_sub_table')->where($aWhere)->find();
|
||||
return json_encode(array('status' => 1,'msg' => 'success','data' => $aPdf));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user