Commit e04dcd6f authored by hujun's avatar hujun

推送公告

parent 6d4ba29e
...@@ -138,6 +138,19 @@ class PushMessageService ...@@ -138,6 +138,19 @@ class PushMessageService
return ; return ;
} }
/**
* 推送全部人员,带跳转。
*
* @param string $title
* @param string $content
* @param string $url
*/
public function pushAll(string $title = '', string $content = '', string $url = '') {
$url = $this->push->http_host(). '/'. $url;
$this->push->push_message_for_all($title, $content, $url);
return ;
}
/** /**
* 普通消息推送 * 普通消息推送
* *
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
namespace app\index\controller; namespace app\index\controller;
use app\api_broker\service\PushMessageService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\model\PushFeed; use app\model\PushFeed;
use think\Request; use think\Request;
...@@ -85,11 +86,14 @@ class Notice extends Basic ...@@ -85,11 +86,14 @@ class Notice extends Basic
$data['steel_phone'] = 0; $data['steel_phone'] = 0;
$data['type'] = 1; $data['type'] = 1;
$num = $this->m_push->editData($data); $num = $this->m_push->editData($data);
if ($num < 1) { if ($num < 1) {
return $this->response(101, '新增公告失败!'); return $this->response(101, '新增公告失败!');
} }
$service_push = new PushMessageService();
$url = 'app/dist/index.html#/announcementDetails?id='.$this->m_push->id;
$service_push->pushAll($data['title'], $data['content'], $url);
return $this->response(200, '新增成功!'); return $this->response(200, '新增成功!');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment