1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\api\controller;
- use app\common\exception\BaseException;
- use think\facade\Request;
- use app\api\service\News as NewsService;
- class News extends Base {
-
- public function index(){
- try{
- return $this->returnAjax("ok",1,NewsService::getList(Request::param()));
- }catch (BaseException $ex){
- return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());
- }
- }
-
- public function view(){
- try {
- return $this->returnAjax("ok",1,NewsService::detail(Request::param("id","0","intval")));
- }catch (\Exception $ex){
- return $this->returnAjax($ex->getMessage(),0);
- }
- }
- }
|