UserDiamondsLogAction.class.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Fanwe 方维直播系统
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: 云淡风轻(1956838968@qq.com)
  8. // +----------------------------------------------------------------------
  9. class UserDiamondsLogAction extends CommonAction
  10. {
  11. public function index()
  12. {
  13. $table = 'fanwe_user_diamonds_log log, fanwe_pai_goods goods, fanwe_user';
  14. $where = 'log.user_id = fanwe_user.id and log.pai_id = goods.id and log.type=1';
  15. if (isset($_REQUEST['name'])) {
  16. $where .= ' and goods.name like \'%' . addslashes(trim($_REQUEST['name'])) . '%\'';
  17. }
  18. if (isset($_REQUEST['user_name'])) {
  19. $where .= ' and fanwe_user.nick_name like \'%' . addslashes(trim($_REQUEST['user_name'])) . '%\'';
  20. }
  21. $begin_time = trim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
  22. $end_time = trim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
  23. if ($begin_time != 0) {
  24. $where .= ' and log.create_time >= \'' . addslashes($begin_time) . '\'';
  25. } elseif ($end_time != 0) {
  26. $where .= ' and log.create_time <= \'' . addslashes($end_time) . '\'';
  27. }
  28. $mod = M('user_diamonds_log');
  29. $count = $mod->table($table)->where($where)->count();
  30. $p = new Page($count, $listRows = 20);
  31. if ($count > 0) {
  32. $info = $mod->table($table)->where($where)->field('log.*,goods.name as goods_name,fanwe_user.nick_name')->order('log.id desc')->limit($p->firstRow . ',' . $p->listRows)->select();
  33. }
  34. foreach ($info as $key => $value) {
  35. $info[$key]['nick_name'] = emoji_decode($value['nick_name']);
  36. }
  37. $page = $p->show();
  38. $this->assign("page", $page);
  39. $this->assign("list", $info);
  40. $this->display();
  41. }
  42. public function edit()
  43. {
  44. header('location:http://' . $_SERVER['HTTP_HOST'] . '/'.get_manage_url_name().'?m=PaiGoods&a=edit&id=' . intval($_REQUEST['id']));
  45. die;
  46. }
  47. }