<?php namespace app\controllers\admin; use Illuminate\Support\Facades\DB; use Yii; use yii\web\Controller; class ArticleController extends CommonController{ public $enableCsrfValidation = false; //公告列表 public function actionGetlist(){ $request = Yii::$app->request; if ($request->isPost){ $sql="select * from {{%ybwm_article}}"; $data= YII::$app->db->createCommand($sql)->queryAll(); $count=count($data); return $this->result(1,'成功',$data,$count); } return $this->result(2,'请求异常'); } //获取公告详情 public function actionGetoper(){ $request = Yii::$app->request; if ($request->isPost){ $result=axios_request(); $data=YII::$app->db->createCommand('select * from {{%ybwm_article}} where id=:id', ['id' => $result['id']])->queryOne(); return $this->result(1,'成功',$data); } return $this->result(2,'请求异常'); } }