Money_record.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. *------Create thems Model------
  4. *------SCWPHP Version 1.0.0------
  5. *------Dev Model Jions------
  6. *------Create Time 2019-04-16 13:05:26------
  7. */
  8. namespace App\Commons\Model;
  9. use \System\Model;
  10. class Money_record extends Model {
  11. // 对象表
  12. protected $table = 'money_details';
  13. public $timestamps = false;
  14. /**
  15. * 盈亏记录
  16. *
  17. * @access public
  18. * @param mixed $moneyRecordSelect 查询参数
  19. * @param mixed $moneyRecordWhere 查询条件
  20. * @param mixed $moneyRecordBetween 查询条件区间
  21. * @param mixed $begin 起始查询位置
  22. * @param mixed $pageSize 分页大小
  23. * @param mixed $orderBy 排序字段
  24. * @return array JsonString
  25. */
  26. public function moneyRecord($moneyRecordSelect, $moneyRecordWhere, $moneyRecordBetween, $begin, $pageSize, $orderBy = 'money_time') {
  27. $result = $this
  28. -> select($moneyRecordSelect)
  29. -> where($moneyRecordWhere)
  30. -> whereBetween('money_time', $moneyRecordBetween)
  31. -> offset($begin)
  32. -> limit($pageSize)
  33. -> orderBy($orderBy)
  34. -> get();
  35. return $result;
  36. }
  37. /**
  38. * 盈亏记录总数
  39. *
  40. * @access public
  41. * @param mixed $moneyRecordWhere 查询条件
  42. * @param mixed $moneyRecordBetween 查询条件区间
  43. * @return array JsonString
  44. */
  45. public function moneyRecordTotal($moneyRecordWhere, $moneyRecordBetween) {
  46. $result = $this
  47. -> where($moneyRecordWhere)
  48. -> whereBetween('money_time', $moneyRecordBetween)
  49. -> count();
  50. return $result;
  51. }
  52. }