AdminOperateLog.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * AdminOperateLog.php UTF-8
  4. * 后台操作记录表
  5. *
  6. * @date : 2018/5/22 18:13
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : chenbingling <cbl@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\model\user;
  13. use think\Model;
  14. class AdminOperateLog extends Model {
  15. protected $name = 'admin_operate_log';
  16. public function __construct($data = []) {
  17. parent::__construct($data);
  18. }
  19. /**
  20. * 操作记录
  21. *
  22. * @param array $map
  23. * @param int $offset
  24. *
  25. * @return bool|\think\Paginator
  26. * @throws \think\exception\DbException
  27. */
  28. public function userOperateLogInfo($map = [], $offset = 10) {
  29. $_data = $this
  30. ->where($map)
  31. ->order('id desc')
  32. ->paginate($offset);
  33. return $_data;
  34. }
  35. /**
  36. * 插入记录
  37. * @param $data
  38. *
  39. * @return bool|int|string
  40. */
  41. public function addLog($data) {
  42. $_res = $this->insert($data);
  43. if ($_res !== false) {
  44. return true;
  45. }
  46. return $_res;
  47. }}