voucher.php 971 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. class Voucher extends DooModel {
  4. public $id;
  5. public $vanme;
  6. public $vcode;
  7. public $vcost;
  8. public $vcount;
  9. public $vstarttime;
  10. public $vendtime;
  11. public $vaddtime;
  12. public $status;
  13. public $_table = 'zh_voucher';
  14. public $_primarykey = 'id';
  15. public $_fields = array('id', 'vname', 'vcode', 'vcost', 'vcount', 'vstarttime', 'vendtime', 'vaddtime', 'status');
  16. public function __construct() {
  17. parent::setupModel(__CLASS__);
  18. }
  19. public function getAll($sql = '', $limit){
  20. if(!empty($sql)){
  21. return $this->find(array('where' => $sql, 'desc' => 'id', 'limit' => $limit, 'asArray' => TRUE));
  22. }else{
  23. return $this->find(array('desc' => 'id', 'limit' => $limit, 'asArray' => TRUE));
  24. }
  25. }
  26. public function getRowbyCode($code){
  27. return $this->getOne(array('where' => 'vcode="'.$code.'"', 'asArray' => TRUE));
  28. }
  29. }
  30. ?>