人人商城

Versions.php 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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\Wxapp;
  7. class Versions extends \We7Table {
  8. protected $tableName = 'wxapp_versions';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'multiid',
  13. 'version',
  14. 'description',
  15. 'modules',
  16. 'design_method',
  17. 'template',
  18. 'quickmenu',
  19. 'createtime',
  20. 'appjson',
  21. 'default_appjson',
  22. 'use_default',
  23. 'type',
  24. 'entry_id',
  25. 'last_modules',
  26. );
  27. protected $default = array(
  28. 'uniacid' => '',
  29. 'multiid' => '',
  30. 'version' => '',
  31. 'description' => '',
  32. 'modules' => '',
  33. 'design_method' => '',
  34. 'template' => '',
  35. 'quickmenu' => '',
  36. 'createtime' => '',
  37. 'appjson' => '',
  38. 'default_appjson' => '',
  39. 'use_default' => 1,
  40. 'type' => 0,
  41. 'entry_id' => 0,
  42. 'last_modules' => '',
  43. );
  44. public function latestVersion($uniacid) {
  45. return $this->query->where('uniacid', $uniacid)->orderby('id', 'desc')->limit(4)->getall('id');
  46. }
  47. public function getById($version_id) {
  48. $result = $this->query->where('id', $version_id)->get();
  49. if (!empty($result)) {
  50. $result['modules'] = iunserializer($result['modules']);
  51. $result['quickmenu'] = iunserializer($result['quickmenu']);
  52. $result['last_modules'] = iunserializer($result['last_modules']);
  53. }
  54. return $result;
  55. }
  56. public function getByUniacidAndVersion($uniacid, $version) {
  57. $result = $this->query->where('uniacid', $uniacid)->where('version', $version)->get();
  58. if (!empty($result)) {
  59. $result['modules'] = iunserializer($result['modules']);
  60. $result['quickmenu'] = iunserializer($result['quickmenu']);
  61. $result['last_modules'] = iunserializer($result['last_modules']);
  62. }
  63. return $result;
  64. }
  65. }