LivePayLogAction.class.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. class LivePayLogAction extends CommonAction
  3. {
  4. public function index()
  5. {
  6. $room_id = intval($_REQUEST['room_id']);
  7. $table_name = 'live_pay_log';
  8. $video = M('Video')->where(array('id' => $room_id))->find();
  9. if (empty($video)) {
  10. $table_name = 'live_pay_log_history';
  11. }
  12. $where = "video_id =" . $room_id;
  13. $sql_str = "SELECT l.id , l.video_id, l.create_ym , l.to_user_id , l.create_time , l.from_user_id , l.create_date ,l.total_diamonds ,l.live_fee, l.live_pay_time , u.nick_name
  14. FROM " . DB_PREFIX . "{$table_name} as l
  15. LEFT JOIN " . DB_PREFIX . "user AS u ON l.to_user_id = u.id" . "
  16. WHERE $where ";
  17. $count_sql = "SELECT count(l.id) as tpcount
  18. FROM " . DB_PREFIX . "{$table_name} as l
  19. LEFT JOIN " . DB_PREFIX . "user AS u ON l . to_user_id = u . id" . "
  20. WHERE $where ";
  21. $model = D($table_name);
  22. $volist = $this->_Sql_list($model, $sql_str, '', 1, 0, $count_sql);
  23. foreach ($volist as $k => $v) {
  24. $volist[$k]['create_time'] = to_date('Y-m-d H:i:s', $volist[$k]['create_time']);
  25. }
  26. $this->assign("room_id", $room_id);
  27. $this->assign("list", $volist);
  28. $this->display();
  29. }
  30. }