Adminlog.php 1.9 KB

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