Adminlog.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 数据层模型
  10. */
  11. class Adminlog extends BaseModel
  12. {
  13. public $page_info;
  14. /**
  15. * 获取日志记录列表
  16. * @author csdeshang
  17. * @param type $condition 查询条件
  18. * @param type $pagesize 分页信息
  19. * @param type $order 排序
  20. * @return type
  21. */
  22. public function getAdminlogList($condition, $pagesize = '', $order)
  23. {
  24. if ($pagesize) {
  25. $result = Db::name('adminlog')->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  26. $this->page_info = $result;
  27. return $result->items();
  28. } else {
  29. return Db::name('adminlog')->where($condition)->order($order)->select()->toArray();
  30. }
  31. }
  32. /**
  33. * 删除日志记录
  34. * @author csdeshang
  35. * @param type $condition 删除条件
  36. * @return type
  37. */
  38. public function delAdminlog($condition)
  39. {
  40. return Db::name('adminlog')->where($condition)->delete();
  41. }
  42. /**
  43. * 获取日志条数
  44. * @author csdeshang
  45. * @param type $condition 查询条件
  46. * @return type
  47. */
  48. public function getAdminlogCount($condition)
  49. {
  50. return Db::name('adminlog')->where($condition)->count();
  51. }
  52. /**
  53. * 增加日子
  54. * @author csdeshang
  55. * @param type $data
  56. * @return type
  57. */
  58. public function addAdminlog($data)
  59. {
  60. return Db::name('adminlog')->insertGetId($data);
  61. }
  62. }