invoice.model.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * 买家发票模型
  4. *
  5. */
  6. defined('InShopNC') or exit('Access Invalid!');
  7. class invoiceModel extends Model {
  8. public function __construct() {
  9. parent::__construct('invoice');
  10. }
  11. /**
  12. * 取得买家默认发票
  13. *
  14. * @param array $condition
  15. */
  16. public function getDefaultInvInfo($condition = array()) {
  17. return $this->where($condition)->order('inv_state asc')->find();
  18. }
  19. /**
  20. * 取得单条发票信息
  21. *
  22. * @param array $condition
  23. */
  24. public function getInvInfo($condition = array()) {
  25. return $this->where($condition)->find();
  26. }
  27. /**
  28. * 取得发票列表
  29. *
  30. * @param unknown_type $condition
  31. * @return unknown
  32. */
  33. public function getInvList($condition, $limit = '', $field = '*') {
  34. return $this->field($field)->where($condition)->limit($limit)->select();
  35. }
  36. /**
  37. * 删除发票信息
  38. *
  39. * @param unknown_type $condition
  40. * @return unknown
  41. */
  42. public function delInv($condition) {
  43. return $this->where($condition)->delete();
  44. }
  45. /**
  46. * 编辑发票信息
  47. *
  48. * @param unknown_type $condition
  49. * @param unknown_type $data
  50. * @return unknown
  51. */
  52. public function editInv($condition, $data){
  53. return $this->where($condition)->update($data);
  54. }
  55. /**
  56. * 新增发票信息
  57. *
  58. * @param unknown_type $data
  59. * @return unknown
  60. */
  61. public function addInv($data) {
  62. return $this->insert($data);
  63. }
  64. }