Money_buy_str.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. *------Create thems Model------
  4. *------SCWPHP Version 1.0.0------
  5. *------Dev Model Jions------
  6. *------Create Time 2019-04-15 16:05:26------
  7. */
  8. namespace App\Commons\Model;
  9. use \System\Model;
  10. class Money_buy_str extends Model {
  11. // 对象表
  12. protected $table = 'money_buy_str';
  13. public $timestamps = false;
  14. /**
  15. * 投注记录
  16. *
  17. * @access public
  18. * @param mixed $select 查询字段
  19. * @param mixed $moneyBuyWhere 查询条件
  20. * @param mixed $moneyBuyBetween 查询条件区间
  21. * @param mixed $begin 起始查询位置
  22. * @param mixed $pageSize 分页大小
  23. * @param mixed $orderBy 排序字段
  24. * @return array JsonString
  25. */
  26. public function moneyBuyStr($select, $moneyBuyWhere, $moneyBuyBetween, $begin, $pageSize, $orderBy = 'money_time') {
  27. $result = $this
  28. -> select($select)
  29. -> join('st_bet_str','money_buy_str.bet_str_id','=','st_bet_str.id')
  30. -> where($moneyBuyWhere)
  31. -> whereBetween('money_time', $moneyBuyBetween)
  32. -> offset($begin)
  33. -> limit($pageSize)
  34. -> orderBy($orderBy)
  35. -> get();
  36. return $result;
  37. }
  38. /**
  39. * 投注记录总数
  40. *
  41. * @access public
  42. * @param mixed $moneyBuyWhere 查询条件
  43. * @param mixed $moneyBuyBetween 查询条件区间
  44. * @return array JsonString
  45. */
  46. public function moneyBuyTotal($moneyBuyWhere, $moneyBuyBetween) {
  47. $result = $this
  48. -> where($moneyBuyWhere)
  49. -> whereBetween('money_time', $moneyBuyBetween)
  50. -> count();
  51. return $result;
  52. }
  53. /**
  54. *
  55. * @access public
  56. * @param mixed $batch_id 批次ID
  57. * @return array JsonString
  58. *
  59. * */
  60. public function getByBatchId($batch_id){
  61. $result = $this->where(['batch_id',$batch_id])->get();
  62. return $result ;
  63. }
  64. }