| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace app\admin\model;
- use think\Model;
- /**
- * 智能问答模型
- */
- class Robot extends Model
- {
- /**
- * select数据筛选
- *
- * @access public
- * @param mixed $join 关联
- * @param mixed $where 条件
- * @param mixed $offset 分页开始
- * @param mixed $limit 分页大小
- * @param mixed $order 排序
- * @return array 返回类型
- */
- public function selectJoin($join, $where=[], $offset='', $limit='', $order=['robot_updateTime'=>'desc'])
- {
- $result = $this;
- if (empty($join) === false) {
- $result = $result->alias('a');
- foreach ($join as $k => $v) {
- $result = $result->join($k, $v);
- }
- }
- if (empty($where) === false) {
- $result = $result->where($where);
- }
- if (empty($offset) === false && empty($limit) === false) {
- $result = $result->limit($offset, $limit);
- }
- if (empty($order) === false) {
- foreach ($order as $k => $v) {
- $result = $result->order($k, $v);
- }
- }
- $result = $result->select();
- return $result;
- }//end selectJoin()
- /**
- * select数据筛选
- *
- * @access public
- * @param mixed $where 条件
- * @return array 返回类型
- */
- public function count($where=[])
- {
- $result = $this;
- if (empty($where) === false) {
- $result = $result->where($where);
- }
- $result = $result->count();
- return $result;
- }//end count()
- }
|