You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

48 lines
1.2 KiB

<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Http\Model\Article;
class ArticleController extends CommonController
{
public function __construct()
{
parent::__construct();
}
public function articleList(Request $request)
{
//参数
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
if($request->input('typeid', null) !== null){$data['typeid'] = $request->input('typeid');}
$data['ischeck'] = Article::IS_CHECK;
$res = Article::getList($data);
if($res == false)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
public function articleDetail(Request $request)
{
//参数
$data['id'] = $request->input('id');
$data['ischeck'] = Article::IS_CHECK;
$res = Article::getOne($data);
if($res === false)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
}