// +---------------------------------------------------------------------- namespace Admin\Model; use Think\Model; /** * 文档基础模型 */ class RebateListModel extends Model{ /* 自动验证规则 */ protected $_validate = array( ); /** * 构造函数 * @param string $name 模型名称 * @param string $tablePrefix 表前缀 * @param mixed $connection 数据库连接信息 */ public function __construct($name = '', $tablePrefix = '', $connection = '') { /* 设置默认的表前缀 */ $this->tablePrefix ='tab_'; /* 执行构造方法 */ parent::__construct($name, $tablePrefix, $connection); } /** * 列表 * * @param int $p * @param array $map * * @return mixed * * @author: 鹿文学[lwx] * @since: 2019\4\11 0011 13:40 * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function lists($p=1, $map=array()) { $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 if(isset($_REQUEST['row'])) { $row = $_REQUEST['row']; } else { $row = 10; } $list = $this->alias('rl')->field('rl.*, small_id, small_account') ->join('tab_spend as s on s.pay_order_number = rl.pay_order_number', 'left') ->where($map) ->page($page, $row) ->order('rl.id desc') ->select(); $count = $this->alias('rl')->where($map)->count(); $data['data'] = $list; $page = set_pagination($count,$row); if($page) { $data['page']=$page; } return $data; } }