Notice.php
1023 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* Author: DOUBLE Y
* Date: 2019/4/10 16:49
* Email: 731633799@qq.com
*/
namespace addons\voicenotice\controller;
use addons\voicenotice\library\Voice;
use app\admin\library\Auth;
use think\addons\Controller;
class Notice extends Controller
{
private $admin_auth = null;
public function _initialize()
{
$this->admin_auth = Auth::instance();
if (!$this->admin_auth->isLogin()) {
$this->error("请先登录管理后台", "");
}
}
public function voice() //监听消息列表
{
if ($this->request->isGet()) {
$info = Voice::init()->notice($this->admin_auth->id);
return json($info);
}
exit;
}
public function delNotice() //点击清除消息队列
{
if ($this->request->isPost()) {
$id = $this->request->param("id");
$id && Voice::init()->delete($id);
$this->success("清除成功", null, ['state' => true]);
}
exit;
}
}