mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-23 18:00:29 +08:00
Update News.php
This commit is contained in:
parent
789f60ce86
commit
699c18db76
@ -86,9 +86,9 @@ class News extends Auth
|
|||||||
*/
|
*/
|
||||||
public function delCollect()
|
public function delCollect()
|
||||||
{
|
{
|
||||||
$data = $this->_getCollectWhere(1);
|
$map = $this->_getCollectWhere(1);
|
||||||
if ($this->app->db->name('DataNewsXCollect')->where($data)->delete() !== false) {
|
if ($this->app->db->name('DataNewsXCollect')->where($map)->delete() !== false) {
|
||||||
NewsService::instance()->syncNewsTotal($data['cid']);
|
NewsService::instance()->syncNewsTotal($map['cid']);
|
||||||
$this->success('取消收藏成功!');
|
$this->success('取消收藏成功!');
|
||||||
} else {
|
} else {
|
||||||
$this->error('取消收藏失败!');
|
$this->error('取消收藏失败!');
|
||||||
@ -101,8 +101,8 @@ class News extends Auth
|
|||||||
*/
|
*/
|
||||||
public function getCollect()
|
public function getCollect()
|
||||||
{
|
{
|
||||||
$query = $this->_query('DataNewsXCollect');
|
$map = ['mid' => $this->mid, 'type' => 1];
|
||||||
$query->where(['mid' => $this->mid, 'type' => 1]);
|
$query = $this->_query('DataNewsXCollect')->where($map);
|
||||||
$result = $query->order('id desc')->page(true, false, false, 15);
|
$result = $query->order('id desc')->page(true, false, false, 15);
|
||||||
NewsService::instance()->buildListByCid($result['list']);
|
NewsService::instance()->buildListByCid($result['list']);
|
||||||
$this->success('获取收藏记录成功!', $result);
|
$this->success('获取收藏记录成功!', $result);
|
||||||
@ -141,6 +141,19 @@ class News extends Auth
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取会员收藏的资讯
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
*/
|
||||||
|
public function getLike()
|
||||||
|
{
|
||||||
|
$map = ['mid' => $this->mid, 'type' => 2];
|
||||||
|
$query = $this->_query('DataNewsXCollect')->where($map);
|
||||||
|
$result = $query->order('id desc')->page(true, false, false, 15);
|
||||||
|
NewsService::instance()->buildListByCid($result['list']);
|
||||||
|
$this->success('获取点赞记录成功!', $result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取会员的浏览历史
|
* 获取会员的浏览历史
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
@ -149,7 +162,8 @@ class News extends Auth
|
|||||||
*/
|
*/
|
||||||
public function getHistory()
|
public function getHistory()
|
||||||
{
|
{
|
||||||
$query = $this->_query('DataNewsXHistory')->where(['mid' => $this->mid]);
|
$map = ['mid' => $this->mid];
|
||||||
|
$query = $this->_query('DataNewsXHistory')->where($map);
|
||||||
$result = $query->order('id desc')->page(true, false, false, 15);
|
$result = $query->order('id desc')->page(true, false, false, 15);
|
||||||
NewsService::instance()->buildListByCid($result['list']);
|
NewsService::instance()->buildListByCid($result['list']);
|
||||||
$this->success('获取浏览历史成功!', $result);
|
$this->success('获取浏览历史成功!', $result);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user