ChannelDataManager.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: wxm
  5. * Date: 2019/5/7
  6. * Time: 11:06
  7. */
  8. namespace app\admin\controller;
  9. use think\Db;
  10. class ChannelDataManager extends Admin{
  11. /**
  12. * 不进行父类的登录验证,所以增加构造方法重写了父类的初始化方法
  13. */
  14. protected function _initialize()
  15. {
  16. parent::_initialize();
  17. }
  18. /**
  19. * 游戏点位 查询条件获取
  20. */
  21. public function getIndexParam(){
  22. $game_id = $this->request->request('game_id'); //游戏id
  23. $username = $this->request->request('username'); //玩家账号
  24. $order = $this->request->request('order_id');// 订单编号
  25. $channel_id = $this->request->request('channel_id');// 渠道编号
  26. $type = input('request.recharge_type', 0, 'intval');
  27. $where = [];
  28. // // 未软删除的数据
  29. // $where['delete_time'] = 0;
  30. if (input('request.recharge_type') != '') {
  31. // dump( $where['v.content'] = '' );
  32. $where['v.content'] = ['LIKE', "%\"type\";i:{$type};%"];
  33. }
  34. if (!empty($game_id)){
  35. $where['his.game_id'] = $game_id;
  36. }
  37. if (!empty($order) ) {
  38. $where['v.bill_id'] = $order;
  39. }
  40. if (!empty($username) ) {
  41. $account_id = model('Common/Members')->where(['username' => $username])->value('id');
  42. if ( ! empty($account_id) ) {
  43. $where['his.account_id'] = (int)$account_id;
  44. }
  45. }
  46. if (!empty($channel_id) ) {
  47. if ( ! empty($channel_id) ) {
  48. $where['his.src_id'] = (int)$channel_id;
  49. }
  50. }
  51. //开始时间和结束时间都有时---预计上线时间
  52. if(input('request.on_start') != '' && input('request.on_end') != ''){
  53. $where['v.uptime'] = [
  54. ['>=', strtotime(input('request.on_start'))],
  55. ['<=', strtotime(input('request.on_end').' 23:59:59')],
  56. ];
  57. }
  58. //开始时间
  59. elseif (input('request.on_start') != '') {
  60. $where['v.uptime'] = ['>=', strtotime(input('request.on_start'))];
  61. }
  62. //结束时间
  63. elseif (input('request.on_end') != '') {
  64. $where['v.uptime'] = ['<=', strtotime(input('request.on_end').' 23:59:59')];
  65. }
  66. //开始时间和结束时间都有时---创建时间
  67. if(input('request.cr_start') != '' && input('request.cr_end') != ''){
  68. $where['v.create_time'] = [
  69. ['>=', strtotime(input('request.cr_start'))],
  70. ['<=', strtotime(input('request.cr_end').' 23:59:59')],
  71. ];
  72. }
  73. //开始时间
  74. elseif (input('request.cr_start') != '') {
  75. $where['v.create_time'] = ['>=', strtotime(input('request.cr_start'))];
  76. }
  77. //结束时间
  78. elseif (input('request.cr_end') != '') {
  79. $where['v.create_time'] = ['<=', strtotime(input('request.cr_end').' 23:59:59')];
  80. }
  81. $where['v.platform'] = 1;
  82. return $where;
  83. }
  84. public function index(){
  85. $where = $this->getIndexParam();
  86. // $param = input('request.'); //分页带条件 ??/
  87. $channelList = model('Common/Channel')->getAllByCondition('id,name');
  88. $gameList = model('Common/Game')->getAllByCondition('id,name');
  89. $this->assign('game_list', $gameList);
  90. $this->assign('channel_list',$channelList);
  91. $list = Db::table('cy_third_recharge_log')->alias('v')
  92. ->join('cy_ttbhistory his', 'his.id = v.ttbhis_id')
  93. ->join('cy_members c', 'c.id= v.userid')
  94. ->join('nw_channel n', 'n.id= his.src_id', 'left')
  95. ->field("v.*,c.username as user_name ,
  96. his.ptb as ptb,
  97. his.ptb_real as ptb_real,
  98. n.name as channel_name")->order('v.create_time desc')->where($where)
  99. ->paginate(10, false, ['query' => input('get.')])
  100. ->each(function($item, $key){
  101. if(isset(unserialize($item['content'])['data'])){
  102. $item += unserialize($item['content'])['data'];
  103. if(isset($item['channelGameFlag'])){
  104. $item['game_name'] = model('Common/Game')->where(['id'=>(int)$item['channelGameFlag']])->value('name');
  105. }
  106. $item['account'] = aesDecode($item['account'], 'CIFCB1UIEN5D52ZZ');
  107. if(isset($item['type'])){
  108. $item['type'] = $item['type'] == 1? '首充':'续充';
  109. }
  110. }
  111. unset($item['content']);
  112. return $item;
  113. });
  114. $this->assign('list', $list);
  115. $this->assign('page', $list->render());
  116. $this->assign('total', $list->total());
  117. return $this->fetch('index');
  118. }
  119. }