50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace admin\controllers\base;
|
|
|
|
use admin\components\BaseAdminController;
|
|
use common\models\oldDb\SystemNotice;
|
|
|
|
/**
|
|
* @doc-module 公告
|
|
*/
|
|
class NoticeController extends BaseAdminController
|
|
{
|
|
|
|
/**
|
|
* @doc-name 公告列表
|
|
*/
|
|
public function actionList()
|
|
{
|
|
$get = \Yii::$app->request->get();
|
|
$query = SystemNotice::find()->where(['base_type'=>99]);
|
|
$this->field = [
|
|
SystemNotice::class => [
|
|
'id', 'scene_type', 'content','base_type'
|
|
]
|
|
];
|
|
return $this->create($query,$get);
|
|
|
|
}
|
|
|
|
/**
|
|
* @doc-name 发送公告
|
|
* @doc-param string content 发送公告
|
|
* @doc-param int type 3全部4所有医生5所有用户 发送公告
|
|
*/
|
|
public function actionAddNotice()
|
|
{
|
|
$get = \Yii::$app->request->get();
|
|
$this->requestValidate($get, [
|
|
[['type', 'content'], 'required']
|
|
]);
|
|
|
|
$SystemNotice = new SystemNotice();
|
|
$SystemNotice->content = $get['content'];
|
|
$SystemNotice->scene_type = $get['type'];
|
|
$SystemNotice->base_type = 99;
|
|
|
|
|
|
$SystemNotice->saveOrFail();
|
|
}
|
|
} |