[ 'class' => QueryParamAuth::className(), 'tokenParam' => "token",//access-token修改为token 'optional' => [//不需要认证方法名 array 'new-first','new-first2' ], ] ]); } /** * 最新一条 */ public function actionNewFirst() { $time = time(); $datas = Notice::find()->from("{{%notice}} a")->select("b.id,b.title")->leftJoin("{{%information}} b","a.sid = b.id")->where(['a.status'=>Notice::STATUS_ACTIVE,'b.type'=>Information::INFORMATION ]); //$datas = Notice::find()->select("{{%notice}}.sid,{{%information}}.title")->joinWith('information')->where(['{{%notice}}.status'=>Notice::STATUS_ACTIVE,'{{%information}}.type'=>Information::INFORMATION ]); $datas = $datas->andwhere(['<' , 'a.release_time' , $time]); $datas = $datas->andwhere(['>' , 'a.over_time' , $time]); $datas = $datas->orderBy('a.updated_at DESC')->asArray()->one(); return Apireturn::sent(1,'success',200,$datas); } }