69 lines
2.3 KiB
PHP
69 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* SAAS应用系统 --- 十年开发经验汇集巨献!
|
|
* ==========================================================
|
|
* Copy right 2020-2050 成都众联思索科技有限公司,保留所有权利。
|
|
* ----------------------------------------------------------
|
|
* 官方网址: https://www.zoomtk.com
|
|
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
|
|
* 任何企业和个人未经允许对程序代码以任何形式任何目的再发布传播。
|
|
* 唯一发布渠道www.zoomtk.com;非官方渠道统一视为侵权行为。
|
|
* ==========================================================
|
|
*/
|
|
namespace addon\message\api\controller;
|
|
|
|
use addon\message\model\MessageRead;
|
|
use app\api\controller\BaseApi;
|
|
|
|
class Message extends BaseApi{
|
|
/**
|
|
* Common: 消息列表
|
|
* Author: wu-hui
|
|
* Time: 2023/03/04 16:07
|
|
* @return false|string
|
|
*/
|
|
public function messageList(){
|
|
// 用户登录
|
|
$token = $this->checkToken();
|
|
if ($token['code'] < 0) return $this->response($token);
|
|
// 参数获取
|
|
$page = input('page', 1);
|
|
$page_size = input('page_size', PAGE_LIST_ROWS);
|
|
$message_type = input('message_type',0);
|
|
// 获取内容
|
|
$field = [
|
|
'a.id',
|
|
'a.is_see',
|
|
'a.order_id',
|
|
'a.created_time',
|
|
'mc.type',
|
|
'mc.message_title',
|
|
'mc.message_content',
|
|
];
|
|
// 条件生成
|
|
$condition = [
|
|
['a.site_id','=',$this->site_id],
|
|
['a.member_id', '=', $this->member_id ],
|
|
];
|
|
if($message_type > 0) $condition[] = ['mc.type', '=', $message_type ];
|
|
// 表关联
|
|
$join = [
|
|
['message_center mc', 'mc.id = a.message_center_id', 'left'],
|
|
];
|
|
$list = (new MessageRead())->getPageList($condition, $page, $page_size, 'a.created_time desc,a.id desc', $field, 'a', $join);
|
|
|
|
return $this->response($list);
|
|
}
|
|
/**
|
|
* Common: 消息查看
|
|
* Author: wu-hui
|
|
* Time: 2023/03/04 16:31
|
|
*/
|
|
public function see(){
|
|
$id = input('id',0);
|
|
model('message_center_read')->update(['is_see'=>1], ['id'=>$id]);
|
|
|
|
return $this->response($this->success());
|
|
}
|
|
|
|
} |