123456789101112131415161718192021222324252627 |
- <?php
- namespace frontend\controllers;
- use common\models\Information;
- use common\models\Notice;
- class NoticeController extends BasewechatController
- {
- //公告列表
- public function actionIndex()
- {
- $datas = Notice::find()->joinWith('information')->where(['bd_notice.status'=>Notice::STATUS_ACTIVE,'bd_information.type'=>Information::INFORMATION ]);
- $time = time();
- $datas = $datas->andwhere(['<' , 'bd_notice.release_time' , $time]);
- $datas = $datas->andwhere(['>' , 'bd_notice.over_time' , $time]);
- $datas = $datas->orderBy('bd_notice.updated_at DESC')->all();
- return $this->render('index',['datas'=>$datas]);
- }
- //公告详细
- public function actionNotice_detail()
- {
- $id = \Yii::$app->request->get('id');
- $data = Notice::find()->joinWith('information')->where('bd_notice.id = :id',[':id'=>$id])->asArray()->one();
- return $this->render('notice_detail',['data'=>$data]);
- }
- }
|