Files
hospital-applets-api/app/Services/MessageNoticeService.php
T
2023-03-27 09:08:34 +08:00

80 lines
2.4 KiB
PHP

<?php
namespace App\Services;
use App\Model\MessageNotice;
/**
* 通知消息
* 不区分各端
*/
class MessageNoticeService extends BaseService
{
/**
* 获取医生服务消息列表-分页
* @return array
*/
public function getDoctorMessageService(): array
{
$user_info = $this->request->getAttribute("userInfo") ?? [];
$page = $this->request->input('page', 1);
$per_page = $this->request->input('per_page', 10);
$params = array();
$params['user_id'] = $user_info['user_id'];
$params['user_type'] = 2;
$params['notice_type'] = 1; // 消息类型(1:医生服务通知 2:医生系统公告 3:患者系统消息
$params['send_status'] = 1;
$result = MessageNotice::getMessageNoticePage($params, ["*"], $page, $per_page);
if (!empty($result['data'])) {
foreach ($result['data'] as &$item) {
if (!empty($item['link_params'])) {
$item['link_params'] = json_decode($item['link_params']);
}
if (!empty($item['show_params'])) {
$item['show_params'] = json_decode($item['show_params']);
}
}
}
return success($result);
}
/**
* 获取医生系统公告列表-分页
* @return array
*/
public function getDoctorMessageSystem(): array
{
$user_info = $this->request->getAttribute("userInfo") ?? [];
$page = $this->request->input('page', 1);
$per_page = $this->request->input('per_page', 10);
$params = array();
$params['user_id'] = $user_info['user_id'];
$params['user_type'] = 2;
$params['notice_type'] = 2; // 消息类型(1:医生服务通知 2:医生系统公告 3:患者系统消息
$params['send_status'] = 1;
$result = MessageNotice::getMessageNoticePage($params, ["*"], $page, $per_page);
if (!empty($result['data'])) {
foreach ($result['data'] as &$item) {
if (!empty($item['link_params'])) {
$item['link_params'] = json_decode($item['link_params'], true);
}
if (!empty($item['show_params'])) {
$item['show_params'] = json_decode($item['show_params'], true);
}
}
}
return success($result);
}
public function getDoctorMessageSystemInfo(){
}
}