初始化仓库
This commit is contained in:
51
admin/controllers/base/NoticeController.php
Normal file
51
admin/controllers/base/NoticeController.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace admin\controllers\base;
|
||||
|
||||
use admin\components\BaseAdminController;
|
||||
use admin\controllers\AuthController;
|
||||
use common\models\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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user