tixian.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');
  3. need_manager();
  4. need_auth('order');
  5. $condition = array(
  6. );
  7. /* filter */
  8. $uemail = strval($_GET['uemail']);
  9. if ($uemail) {
  10. $uuser = Table::Fetch('user', $uemail, 'username');
  11. if($uuser) $condition['user_id'] = $uuser['id'];
  12. else $uemail = null;
  13. }
  14. $id = abs(intval($_GET['id']));
  15. if ($id) $condition['id'] = $id;
  16. $cbday = strval($_GET['cbday']);
  17. $ceday = strval($_GET['ceday']);
  18. if ($cbday) {
  19. $cbtime = strtotime($cbday);
  20. $condition[] = "addtime >= '{$cbtime}'";
  21. }
  22. if ($ceday) {
  23. $cetime = strtotime($ceday);
  24. $condition[] = "addtime <= '{$cetime}'";
  25. }
  26. $is_fahuo = -1;
  27. //is_fahuo -1 0 1 2
  28. if(isset($_GET['is_fahuo']) && $_GET['is_fahuo']>=0 )
  29. {
  30. $is_fahuo = intval($_GET['is_fahuo']);
  31. $condition['state'] = $is_fahuo;
  32. }
  33. /* end fiter */
  34. $count = Table::Count('tixian_order', $condition);
  35. list($pagesize, $offset, $pagestring) = pagestring($count, 20);
  36. $orders = DB::LimitQuery('tixian_order', array(
  37. 'condition' => $condition,
  38. 'order' => 'ORDER BY id DESC',
  39. 'size' => $pagesize,
  40. 'offset' => $offset,
  41. ));
  42. $pay_ids = Utility::GetColumn($orders, 'pay_id');
  43. $pays = Table::Fetch('pay', $pay_ids);
  44. $user_ids = Utility::GetColumn($orders, 'user_id');
  45. $users = Table::Fetch('user', $user_ids);
  46. $team_ids = Utility::GetColumn($orders, 'team_id');
  47. $teams = Table::Fetch('team', $team_ids);
  48. if(isset($_GET['daochu']) )
  49. {
  50. $orders = DB::LimitQuery('tixian_order', array(
  51. 'condition' => $condition,
  52. 'order' => 'ORDER BY id DESC',
  53. 'size' => $pagesize,
  54. 'offset' => $offset,
  55. ));
  56. $list = array();
  57. $name = '提现订单信息'.date('Ymd').'.csv';
  58. $kn = array(
  59. 'id' => 'ID',
  60. 'name' => '用户',
  61. 'mobile' => '转账银行',
  62. 'province' => '转账账户',
  63. 'city' => '账户名',
  64. 'area' => '提现金额',
  65. 'street' => '状态',
  66. 'address' => '处理时间',
  67. 'express_id' => '申请时间',
  68. );
  69. $kn_str = implode(',',$kn);
  70. $str = $kn_str."\n";
  71. $str = iconv('utf-8','gb2312',$str);
  72. foreach($orders as $one)
  73. {
  74. $str .= $one['id'].",";
  75. $str .= iconv('utf-8','gb2312',$users[$one['user_id']]['username']).",";
  76. $str .= iconv('utf-8','gb2312',$users[$one['user_id']]['bankname']).",";
  77. $str .= "\t".iconv('utf-8','gb2312',$users[$one['user_id']]['bankaccount']).",";
  78. $str .= iconv('utf-8','gb2312',$users[$one['user_id']]['bankusername']).",";
  79. $str .= iconv('utf-8','gb2312',$currency.moneyit($one['money'])).",";
  80. if($one['state'] ==0)
  81. {
  82. $str .= iconv('utf-8','gb2312','申请中').",";
  83. }elseif( $one['state'] ==1)
  84. {
  85. $str .= iconv('utf-8','gb2312','已放款').",";
  86. }elseif($one['state'] ==2)
  87. {
  88. $str .= iconv('utf-8','gb2312','已拒绝').",";
  89. }
  90. if(!empty($one['shentime']))
  91. {
  92. $str .= iconv('utf-8','gb2312',date('Y-m-d H:i:s',$one['shentime'])).",";
  93. }else{
  94. $str .= iconv('utf-8','gb2312','-').",";
  95. }
  96. $str .= iconv('utf-8','gb2312',date('Y-m-d H:i:s',$one['addtime']))."\n";
  97. }
  98. header("Content-type:text/csv");
  99. header("Content-Disposition:attachment;filename=".$name);
  100. header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
  101. header('Expires:0');
  102. header('Pragma:public');
  103. echo $str;
  104. die();
  105. }
  106. include template('manage_order_tixian');