LinkUniacid.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 LinkUniacid extends \We7Table {
  8. protected $tableName = 'uni_link_uniacid';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'link_uniacid',
  13. 'module_name',
  14. 'version_id',
  15. );
  16. protected $default = array(
  17. 'uniacid' => 0,
  18. 'link_uniacid' => 0,
  19. 'module_name' => '',
  20. 'version_id' => 0,
  21. );
  22. public function searchWithUniacidModulenameVersionid($uniacid, $module_name, $version_id = 0) {
  23. if (!empty($version_id)) {
  24. $this->where('version_id', $version_id);
  25. }
  26. $this->where('uniacid', $uniacid)->where('module_name', $module_name);
  27. return $this;
  28. }
  29. public function getMainUniacid($sub_uniacid, $module_name, $version_id = 0) {
  30. $this->searchWithUniacidModulenameVersionid($sub_uniacid, $module_name, $version_id);
  31. return $this->getcolumn('link_uniacid');
  32. }
  33. public function getSubUniacids($main_uniacid, $module_name, $version_id = 0) {
  34. if (!empty($version_id)) {
  35. $this->where('version_id', $version_id);
  36. }
  37. $data = $this->where('link_uniacid', $main_uniacid)
  38. ->where('module_name', $module_name)
  39. ->getall('uniacid');
  40. if (empty($data)) {
  41. return array();
  42. } else {
  43. return array_keys($data);
  44. }
  45. }
  46. public function getAllMainUniacidsByModuleName($module_name) {
  47. $data = $this->where('module_name', $module_name)
  48. ->where('link_uniacid >', 0)
  49. ->getall('link_uniacid');
  50. if (empty($data)) {
  51. $data = array();
  52. }
  53. return array_keys($data);
  54. }
  55. public function getAllSubUniacidsByModuleName($module_name) {
  56. $data = $this->where('module_name', $module_name)
  57. ->where('link_uniacid >', 0)
  58. ->getall('uniacid');
  59. if (empty($data)) {
  60. $data = array();
  61. }
  62. return array_keys($data);
  63. }
  64. }