RegisterVersion.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 RegisterVersion extends \We7Table {
  8. protected $tableName = 'wxapp_register_version';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'version_id',
  13. 'auditid',
  14. 'version',
  15. 'description',
  16. 'status',
  17. 'reason',
  18. 'upload_time',
  19. 'audit_info',
  20. 'submit_info',
  21. 'developer',
  22. );
  23. protected $default = array(
  24. 'uniacid' => '',
  25. 'version_id' => '',
  26. 'auditid' => '',
  27. 'version' => '',
  28. 'description' => '',
  29. 'status' => '0',
  30. 'reason' => '',
  31. 'upload_time' => '',
  32. 'audit_info' => '',
  33. 'submit_info' => '',
  34. 'developer' => '',
  35. );
  36. public function getWithAccountWxappOriginal($original) {
  37. $result = $this->query->from('wxapp_register_version', 'v')
  38. ->select('v.*')
  39. ->leftjoin('account_wxapp', 'a')
  40. ->on('v.uniacid', 'a.uniacid')
  41. ->where(array('a.original' => $original, 'v.auditid >' => 0, 'v.status' => WXAPP_REGISTER_VERSION_STATUS_CHECKING))
  42. ->orderby('id', 'DESC')
  43. ->get();
  44. return $result;
  45. }
  46. public function getByUniacidAndAuditid($uniacid, $auditid) {
  47. $result = $this->where('uniacid', $uniacid)->where('auditid', $auditid)->orderby('id', 'desc')->get();
  48. if (empty($result)) {
  49. return array();
  50. }
  51. $result = $this->dataunserializer($result);
  52. return $result;
  53. }
  54. public function getByUniacidAndVersionidAndStatus($uniacid, $version_id, $status) {
  55. $result = $this->query
  56. ->where('uniacid', $uniacid)
  57. ->where('version_id', $version_id)
  58. ->where('status', $status)
  59. ->get();
  60. if (empty($result)) {
  61. return array();
  62. }
  63. $result = $this->dataunserializer($result);
  64. return $result;
  65. }
  66. public function getByUniacid($uniacid) {
  67. $result = $this->where('uniacid', $uniacid)->orderby('id', 'desc')->getall();
  68. if (empty($result)) {
  69. return array();
  70. }
  71. foreach ($result as $key => $item) {
  72. $result[$key] = $this->dataunserializer($item);
  73. }
  74. return $result;
  75. }
  76. public function dataunserializer($data) {
  77. if (!empty($data['audit_info'])) {
  78. $data['audit_info'] = iunserializer($data['audit_info']);
  79. }
  80. if (!empty($data['submit_info'])) {
  81. $data['submit_info'] = iunserializer($data['submit_info']);
  82. }
  83. if (!empty($data['reason'])) {
  84. $data['reason'] = iunserializer($data['reason']);
  85. }
  86. $data['upload_time'] = date('Y-m-d H:i:s', $data['upload_time']);
  87. return $data;
  88. }
  89. }