StatVisit.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. namespace We7\Table\System;
  7. class StatVisit extends \We7Table {
  8. protected $tableName = 'system_stat_visit';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'modulename',
  13. 'uid',
  14. 'displayorder',
  15. 'createtime',
  16. 'updatetime',
  17. );
  18. protected $default = array(
  19. 'uniacid' => '',
  20. 'modulename' => '',
  21. 'uid' => '',
  22. 'displayorder' => 0,
  23. 'createtime' => '',
  24. 'updatetime' => '',
  25. );
  26. public function deleteVisitRecord($uid, $delete_modules = array()) {
  27. if (!empty($delete_modules)) {
  28. $this->query->where('modulename', $delete_modules);
  29. }
  30. return $this->query->where('uid', $uid)
  31. ->where('uniacid', 0)
  32. ->delete();
  33. }
  34. public function getVistedModule($uid) {
  35. return $this->query->where('uid', $uid)->where('uniacid', 0)->getall('modulename');
  36. }
  37. public function getVisitedModuleById($id) {
  38. return $this->query->where('id', $id)->get();
  39. }
  40. public function updateVisitedModuleUniacid($id, $uniacid) {
  41. return $this->where('id', $id)->fill('uniacid', $uniacid)->save();
  42. }
  43. }