Files
shopxo/application/index/controller/Message.php

118 lines
3.3 KiB
PHP
Raw Normal View History

2018-12-28 18:58:37 +08:00
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
2019-02-18 13:52:07 +08:00
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
2018-12-28 18:58:37 +08:00
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\index\controller;
2019-12-24 15:18:56 +08:00
use app\service\SeoService;
use app\service\MessageService;
2018-12-28 18:58:37 +08:00
/**
* 消息管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class Message extends Common
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-11-30
* @desc description
*/
public function __construct()
{
parent::__construct();
// 是否登录
2019-02-14 23:06:04 +08:00
$this->IsLogin();
2018-12-28 18:58:37 +08:00
}
/**
* 消息列表
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-28
* @desc description
*/
public function Index()
{
2020-06-29 23:00:56 +08:00
// 总数
$total = MessageService::MessageTotal($this->form_where);
2018-12-28 18:58:37 +08:00
// 分页
2020-06-29 23:00:56 +08:00
$page_params = [
'number' => $this->page_size,
'total' => $total,
'where' => $this->data_request,
'page' => $this->page,
'url' => MyUrl('index/message/index'),
];
2018-12-28 18:58:37 +08:00
$page = new \base\Page($page_params);
// 获取列表
2020-06-29 23:00:56 +08:00
$data_params = [
'where' => $this->form_where,
'm' => $page->GetPageStarNumber(),
'n' => $this->page_size,
];
$ret = MessageService::MessageList($data_params);
2018-12-28 18:58:37 +08:00
2020-07-31 18:55:47 +08:00
// 消息更新未已读
MessageService::MessageRead(['user'=>$this->user]);
2019-12-24 15:18:56 +08:00
// 浏览器名称
$this->assign('home_seo_site_title', SeoService::BrowserSeoTitle('我的消息', 1));
2020-06-29 23:00:56 +08:00
// 基础参数赋值
$this->assign('params', $this->data_request);
$this->assign('page_html', $page->GetPageHtml());
$this->assign('data_list', $ret['data']);
2018-12-28 18:58:37 +08:00
return $this->fetch();
}
2020-06-29 23:00:56 +08:00
/**
* 详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-29
* @desc description
*/
public function Detail()
{
if(!empty($this->data_request['id']))
{
// 条件
$where = [
['id', '=', intval($this->data_request['id'])],
];
// 获取列表
$data_params = [
'm' => 0,
'n' => 1,
'where' => $where,
];
$ret = MessageService::MessageList($data_params);
$data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0];
$this->assign('data', $data);
}
$this->assign('is_header', 0);
$this->assign('is_footer', 0);
return $this->fetch();
}
2018-12-28 18:58:37 +08:00
}
?>