云优CMS如何按orderby排序上一条下一条信息

日期:2018-10-10 11:51:28    作者:云优CMS    人气:744

1、\app\index\controller\Show.php

搜索:

$prev = $conmodel->getContentPrev($category['id'], $content['id']);

$next = $conmodel->getContentNext($category['id'], $content['id']);

修改为:

$prev = $conmodel->getContentPrev($category['id'], $content['id'], $content['sort']);

$next = $conmodel->getContentNext($category['id'], $content['id'], $content['sort']);


2、\app\index\model\ContentModel.php

搜索:

public function getContentNext($cid, $id){

        $where['id'] = ['GT', $id];

修改为:

public function getContentNext($cid, $sort){

        $where['sort'] = ['GT', $sort];


搜索:

public function getContentPrev($cid, $id){

        $where['id'] = ['GT', $id];

修改为:

public function getContentPrev($cid, $sort){

        $where['sort'] = ['LT', $sort];