CreditsRecord.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\Mc;
  7. class CreditsRecord extends \We7Table {
  8. protected $tableName = 'mc_credits_record';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'clerk_id',
  12. 'clerk_type',
  13. 'createtime',
  14. 'credittype',
  15. 'module',
  16. 'num',
  17. 'operator',
  18. 'real_uniacid',
  19. 'remark',
  20. 'store_id',
  21. 'uid',
  22. 'uniacid',
  23. );
  24. protected $default = array(
  25. 'clerk_id' => '0',
  26. 'clerk_type' => '1',
  27. 'createtime' => '',
  28. 'credittype' => '',
  29. 'module' => '',
  30. 'num' => '0.00',
  31. 'operator' => '',
  32. 'real_uniacid' => '',
  33. 'remark' => '',
  34. 'store_id' => '0',
  35. 'uid' => '',
  36. 'uniacid' => '',
  37. );
  38. public function getCreditsRecordListByUidAndCredittype($uid, $credittype) {
  39. return $this->query->from('mc_credits_record', 'r')
  40. ->select('r.*, u.username as username')
  41. ->leftjoin('users', 'u')
  42. ->on(array('r.operator' => 'u.uid'))
  43. ->where('r.uid', $uid)
  44. ->where('r.credittype', $credittype)
  45. ->orderby('r.id', 'desc')
  46. ->getall();
  47. }
  48. public function searchWithUniacid($uniacid) {
  49. return $this->query->where('uniacid', $uniacid);
  50. }
  51. }