AccountModulesShortcut.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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\Uni;
  7. class AccountModulesShortcut extends \We7Table {
  8. protected $tableName = 'uni_account_modules_shortcut';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'title',
  12. 'url',
  13. 'icon',
  14. 'uniacid',
  15. 'version_id',
  16. 'module_name',
  17. );
  18. protected $default = array(
  19. 'title' => '',
  20. 'url' => '',
  21. 'icon' => '',
  22. 'uniacid' => '0',
  23. 'version_id' => '0',
  24. 'module_name' => '',
  25. );
  26. public function saveShortcut($fill, $id = 0) {
  27. if (!empty($id)) {
  28. $this->where('id', $id);
  29. }
  30. return $this->fill($fill)->save();
  31. }
  32. public function getShortcutListByUniacidAndModule($uniacid, $module, $pageindex = 1, $pagesize = 15) {
  33. $list = $this->query->where(array('uniacid' => $uniacid, 'module_name' => $module))->page($pageindex, $pagesize)->getall();
  34. $total = $this->getLastQueryTotal();
  35. return array('lists' => $list, 'total' => $total);
  36. }
  37. public function getShortcutById($id) {
  38. return $this->where('id', $id)->get();
  39. }
  40. public function deleteShortcutById($id) {
  41. return $this->where('id', $id)->delete();
  42. }
  43. }