| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace app\service\model;
- use think\Model;
- /**
- * 会话记录模型
- */
- class ChatLog extends Model
- {
- /**
- * 数据筛选
- *
- * @access public
- * @param mixed $field 字段.
- * @param mixed $offset 分页开始.
- * @param mixed $limit 分页大小.
- * @param mixed $where 条件.
- * @return array 返回类型
- */
- public function selectChatLog($field, $offset, $limit, $where=[])
- {
- $result = $this->field($field);
- if (empty($where) === false) {
- $result = $result->where($where);
- }
- $result = $result->limit($offset, $limit)->order('time_line', 'desc')->select();
- return $result;
- }//end selectChatLog()
- /**
- * 数据总数
- *
- * @access public
- * @param mixed $where 条件
- * @return array 返回类型
- */
- public function countChatLog($where=[])
- {
- $result = $this;
- if (empty($where) === false) {
- $result = $result->where($where);
- }
- $result = $result->count();
- return $result;
- }//end countChatLog()
- /**
- * 用户数据筛选
- *
- * @access public
- * @param mixed $field 字段
- * @param mixed $offset 分页开始
- * @param mixed $limit 分页大小
- * @param mixed $where 条件
- * @param mixed $whereOr 条件
- * @return array 返回类型
- */
- public function userChatLog($field, $where, $whereOr, $offset, $limit)
- {
- $result = $this
- ->field($field)
- ->where($where)
- ->whereOr($whereOr)
- ->limit($offset, $limit)
- ->order('time_line', 'desc')
- ->select();
- return $result;
- }//end userChatLog()
- /**
- * 用户数据总数
- *
- * @access public
- * @param mixed $where 条件.
- * @param mixed $whereOr 条件.
- * @return array 返回类型
- */
- public function userChatLogCount($where, $whereOr)
- {
- $result = $this->where($where)->whereOr($whereOr)->count();
- return $result;
- }//end userChatLogCount()
- }
|