1
This commit is contained in:
@@ -103,6 +103,28 @@ class Contribute extends Base
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function contributeFileUrl(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'fileUrl'=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$sFileUrl = $data['file_url'];
|
||||
$aDealData = json_decode(ArticleParserService::uploadAndParse($sFileUrl),true);
|
||||
$iStatus = empty($aDealData['status']) ? 0 : $aDealData['status'];
|
||||
$sMsg = empty($aDealData['msg']) ? 'Content parsing failed' : $aDealData['msg'];
|
||||
if($iStatus != 1){
|
||||
return json_encode(['status' => 5, 'msg' => $sMsg]);
|
||||
}
|
||||
$aData = empty($aDealData['data']) ? '' : $aDealData['data'];
|
||||
if(empty($aData['title'])){
|
||||
return json_encode(['status' => 6,'msg' => 'The article title is empty']);
|
||||
}
|
||||
$result = $this->_addData($aData);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function myTestArticle(){
|
||||
|
||||
Reference in New Issue
Block a user