[$startTime, $endTime], ...] * @param mixed $begin 起始查询位置 * @param mixed $pageSize 分页大小 * @param mixed $toArray 是否专为数组 * @param mixed $orderBy 排序字段 * @param mixed $join 关联关系 ['article' => 'oney_buy.info_identity = article.identity', ...] * @return array JsonString */ public function accountNews($select, $where = '', $between = '', $begin = '', $pageSize = '', $toArray = 0, $orderBy = ['write_time' => 'desc'], $join = '') { // 查询字段 $result = $this -> select($select); // 循环关联 if (!empty($join)) { foreach ($join as $key => $value) { $result = $result -> join($key, $value); } } // 查询条件 if (!empty($where)) { $result = $result -> where($where); } // 循环获取查询区间 if (!empty($between)) { foreach ($between as $key => $value) { $result = $result -> whereBetween($key, $value); } } // 查询起始 if (strlen($begin)) { $result = $result -> offset($begin); } // 分页大小 if (strlen($pageSize)) { $result = $result -> limit($pageSize); } // 循环排序规则 foreach ($orderBy as $key => $value) { $result = $result -> orderBy($key, $value); } // 获取数据 $result = $result -> get(); if ($toArray) { $result = $result -> toArray(); } return $result; } /** * 用户消息条数 * * @access public * @param mixed $where 查询条件 * @param mixed $between 查询条件区间 * @return array JsonString */ public function accountNewsTotal($where, $between) { $result = $this; // 查询条件 if (!empty($where)) { $result = $result -> where($where); } // 循环获取查询区间 if (!empty($between)) { foreach ($between as $key => $value) { $result = $result -> whereBetween($key, $value); } } // 获取数据 $result = $result -> count(); return $result; } }