game_logModel.class.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. *
  4. */
  5. class game_logModel extends NewModel
  6. {
  7. public function getList($field = '', $where = '', $order = '', $limit = 20)
  8. {
  9. return $this->field($field)->order($order)->limit($limit)->select($where);
  10. }
  11. /**
  12. * 新增游戏日志
  13. * @param integer $podcast_id 直播id
  14. * @param integer $long_time 游戏时长
  15. * @param integer $game_id 游戏(种类)id
  16. * @param integer $banker_id 庄家用户id
  17. */
  18. public function addLog($podcast_id, $long_time, $game_id, $banker_id = 0)
  19. {
  20. $data = array(
  21. 'podcast_id' => intval($podcast_id),
  22. 'long_time' => intval($long_time),
  23. 'game_id' => intval($game_id),
  24. 'banker_id' => intval($banker_id),
  25. 'create_time' => NOW_TIME,
  26. 'create_date' => to_date(NOW_TIME, 'Y-m-d H:i:s'),
  27. 'create_time_ymd' => to_date(NOW_TIME, 'Y-m-d'),
  28. 'create_time_y' => to_date(NOW_TIME, 'Y'),
  29. 'create_time_m' => to_date(NOW_TIME, 'm'),
  30. 'create_time_d' => to_date(NOW_TIME, 'd'),
  31. );
  32. return $this->insert($data);
  33. }
  34. /**
  35. * 停止游戏
  36. * @param integer $id 游戏日志id
  37. * @return integer 受影响行数
  38. */
  39. public function stop($id)
  40. {
  41. return $this->update(['long_time' => 0], ['id' => intval($id)]);
  42. }
  43. /**
  44. * [multiAddLog description]
  45. * @param [type] $game_log_id [description]
  46. * @param [type] $result [description]
  47. * @param [type] $bet [description]
  48. * @param [type] $suit_patterns [description]
  49. * @param [type] $podcast_income [description]
  50. * @param [type] $income [description]
  51. * @return [type] [description]
  52. */
  53. public function resultLog($game_log_id, $result, $bet, $suit_patterns, $podcast_income, $income)
  54. {
  55. $status = 2;
  56. $data = compact('result', 'bet', 'suit_patterns', 'podcast_income', 'income', 'status');
  57. return $this->update($data, ['id' => intval($game_log_id)]);
  58. }
  59. }