game_logModel.class.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. *
  4. */
  5. class game_logModel extends Model
  6. {
  7. public function getList($field = '', $where = '', $order = '', $limit = 20)
  8. {
  9. return $this->field($field)->order($order)->limit($limit)->select($where);
  10. }
  11. public function addLog($podcast_id, $long_time, $game_id, $banker_id = 0)
  12. {
  13. $podcast_id = intval($podcast_id);
  14. $long_time = intval($long_time);
  15. $game_id = intval($game_id);
  16. $banker_id = intval($banker_id);
  17. $data = array(
  18. 'podcast_id' => $podcast_id,
  19. 'long_time' => $long_time,
  20. 'game_id' => $game_id,
  21. 'banker_id' => $banker_id,
  22. 'create_time' => NOW_TIME,
  23. 'create_date' => to_date(NOW_TIME, 'Y-m-d H:i:s'),
  24. 'create_time_ymd' => to_date(NOW_TIME, 'Y-m-d'),
  25. 'create_time_y' => to_date(NOW_TIME, 'Y'),
  26. 'create_time_m' => to_date(NOW_TIME, 'm'),
  27. 'create_time_d' => to_date(NOW_TIME, 'd'),
  28. );
  29. return $this->insert($data);
  30. }
  31. public function stop($id)
  32. {
  33. return $this->update(array('long_time' => 0), array('id' => intval($id)));
  34. }
  35. public function multiAddLog($game_log_id, $result, $bet, $suit_patterns, $podcast_income, $income)
  36. {
  37. $table = DB_PREFIX . 'game_log';
  38. self::$sql = "UPDATE $table
  39. SET `status` = 2,
  40. `result` = $result,
  41. `suit_patterns` = '$suit_patterns',
  42. `bet` = '$bet',
  43. `podcast_income` = $podcast_income,
  44. `income` = $income
  45. WHERE
  46. `id` = $game_log_id";
  47. return Connect::exec(self::$sql);
  48. }
  49. }