FamilyRefundListAction.class.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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 FamilyRefundListAction extends CommonAction{
  10. /**
  11. * 提现审核记录
  12. */
  13. public function index()
  14. {
  15. //列表过滤器,生成查询Map对象
  16. $map = $this->_search ();
  17. if($_REQUEST['is_pay']!='')
  18. {
  19. $parameter.= "is_pay=" . intval($_REQUEST['is_pay']). "&";
  20. $sql_w .= "is_pay=".intval($_REQUEST['is_pay'])." and ";
  21. }
  22. if($_REQUEST['user_id']>0)
  23. {
  24. $parameter.= "user_id=" . intval($_REQUEST['user_id']). "&";
  25. $sql_w .= "user_id=".intval($_REQUEST['user_id'])." and ";
  26. }
  27. if(strim($_REQUEST['nick_name']!=''))
  28. {
  29. $parameter .= "nick_name like " . urlencode('%' . strim($_REQUEST['nick_name']) . '%') . "&";
  30. $sql_w .= "nick_name like '%" . strim($_REQUEST['nick_name']) . "%' and ";
  31. }
  32. // //追加默认参数
  33. // if($this->get("default_map"))
  34. // $map = array_merge($map,$this->get("default_map"));
  35. // if(strim($_REQUEST['nick_name'])!=''){//name
  36. // $user=M("User")->where("nick_name like '%".strim($_REQUEST['nick_name'])."%' ")->findAll();
  37. // $user_arr_id = array();
  38. // foreach($user as $k=>$v){
  39. // $user_arr_id[$k] =intval($v['id']);
  40. // }
  41. // //$user_str_id = implode(',',$user_arr_id);
  42. // $condition['user_id'] = array('in',$user_arr_id);
  43. // }
  44. // $map = array_merge($map,$condition);
  45. // if (method_exists ( $this, '_filter' )) {
  46. // $this->_filter ( $map );
  47. // }
  48. $model = D ();
  49. $sql_str = "select u.*,f.family_id from ".DB_PREFIX."user_refund as u LEFT JOIN ".DB_PREFIX."user as f on u.user_id = f.id where f.family_id <>0 ";
  50. $sql_str .= " and ".$sql_w." 1=1";
  51. // $count_sql = "SELECT count(*) as tpcount FROM ".DB_PREFIX."video WHERE 1=1 ";
  52. // $sql_str .= " and ".$sql_w." 1=1";
  53. //
  54. // $count_sql .= " and ".$sql_w." 1=1";
  55. $voList = $this->_Sql_list($model, $sql_str, "&".$parameter,'create_time',0,'');
  56. $this->assign ( 'list', $voList );
  57. $this->display ();
  58. return;
  59. }
  60. public function refund_allow(){
  61. $id=intval($_REQUEST['id']);
  62. $status=intval($_REQUEST['status']);
  63. $refund_data=M("UserRefund")->getById($id);
  64. $info=array();
  65. if($status){
  66. $info['do']='允许';
  67. }else{
  68. $info['do']='不允许';
  69. }
  70. $this->assign("info",$info);
  71. $this->assign("refund_data",$refund_data);
  72. $this->assign("status",$status);
  73. $this->display ();
  74. }
  75. public function refund_go_allow(){
  76. $id=intval($_REQUEST['id']);
  77. $status=intval($_REQUEST['status']);
  78. $refund_data = M("UserRefund")->getById($id);
  79. if($refund_data)
  80. {
  81. if($refund_data['is_pay']==1)
  82. {
  83. $this->error("已经允许提现");
  84. }
  85. $reply = strim($_REQUEST['reply']);
  86. if($status==1){
  87. $refund_data['is_pay'] = 1;
  88. $info="允许操作成功";
  89. }else{
  90. $refund_data['is_pay'] = 2;
  91. $info="未允许操作成功";
  92. }
  93. $refund_data['reply']=$reply;
  94. $list = M("UserRefund")->save($refund_data);
  95. if ($list !== false){
  96. save_log($refund_data['user_id'].$info,1);
  97. }else{
  98. save_log($refund_data['user_id'].$info,0);
  99. }
  100. $GLOBALS['msg']->manage_msg('MSG_MONEY_CARRY_RESULT',$refund_data['user_id'],$refund_data);
  101. $this->success($info);
  102. }else{
  103. $this->error("没有提现数据");
  104. }
  105. }
  106. public function delete() {
  107. //彻底删除指定记录
  108. $ajax = intval($_REQUEST['ajax']);
  109. $id = $_REQUEST ['id'];
  110. if (isset ( $id )) {
  111. $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
  112. $rel_data = M('UserRefund')->where($condition)->findAll();
  113. $list = M('UserRefund')->where ( $condition )->delete();
  114. foreach($rel_data as $data)
  115. {
  116. $info[] = "[id:".$data['id'].",ticket:".$data['ticket']."]";
  117. }
  118. if($info) $info = implode(",",$info);
  119. if ($list!==false) {
  120. save_log($info."成功删除",1);
  121. $this->success ("成功删除",$ajax);
  122. } else {
  123. save_log($info."删除出错",0);
  124. $this->error ("删除出错",$ajax);
  125. }
  126. } else {
  127. $this->error (l("INVALID_OPERATION"),$ajax);
  128. }
  129. }
  130. //导出电子表
  131. public function export_csv($page = 1)
  132. {
  133. $pagesize = 10;
  134. set_time_limit(0);
  135. $limit = (($page - 1)*intval($pagesize)).",".(intval($pagesize));
  136. //定义条件
  137. if(trim($_REQUEST['id'])!='')
  138. {
  139. $where.= "ur.id = ".intval($_REQUEST['id'])." and ";
  140. }
  141. if(trim($_REQUEST['user_id'])!='')
  142. {
  143. $where.= " ur.user_id = ".intval($_REQUEST['user_id'])." and ";
  144. }
  145. if(trim($_REQUEST['is_pay'])!='')
  146. {
  147. $where.= " ur.is_pay = ".intval($_REQUEST['is_pay'])." and ";
  148. }
  149. if(trim($_REQUEST['nick_name'])!='')
  150. {
  151. $where .= "u.nick_name like '%".trim($_REQUEST['nick_name'])."%' and ";
  152. }
  153. $time ='1970-01-01 16:00:00';
  154. $sql ="select ur.id as user_id,ur.money as money,ur.ticket as ticket,u.nick_name as user_name, FROM_UNIXTIME(ur.create_time+8*3600,'%Y-%m-%d %H:%i:%S') as create_time,ur.memo as memo,ur.is_pay as is_pay, FROM_UNIXTIME(ur.pay_time+8*3600,'%Y-%m-%d %H:%i:%S') as pay_time,ur.reply as reply,ur.ybdrawflowid as ybdrawflowid,ur.pay_log as pay_log from ".DB_PREFIX."user as u INNER JOIN ".DB_PREFIX."user_refund as ur on ur.user_id = u.id where ".$where." u.family_id<>0 limit ".$limit;
  155. $list=$GLOBALS['db']->getAll($sql);
  156. if($list)
  157. {
  158. register_shutdown_function(array(&$this, 'export_csv'), $page+1);
  159. $m_config = load_auto_cache('m_config');
  160. $ticket_name = $m_config['ticket_name']!=''?$m_config['ticket_name']:'印票';
  161. $refund_value = array( 'user_id'=>'""', 'money'=>'""', 'ticket'=>'""','user_name'=>'""','create_time'=>'""','memo'=>'""','is_pay'=>'""','pay_time'=>'""','reply'=>'""','ybdrawflowid'=>'""','pay_log'=>'""');
  162. if($page == 1)
  163. {
  164. $content = iconv("utf-8","gbk","提现编号,提现金额,$ticket_name,主播昵称,申请时间,申请备注,是否审核,确认支付时间,操作备注,业务单号,支付备注");
  165. $content = $content . "\n";
  166. }
  167. foreach($list as $k=>$v)
  168. {
  169. $refund_value['user_id'] = '"' . iconv('utf-8','gbk',$list[$k]['user_id']) . '"';
  170. $refund_value['money'] = '"' . iconv('utf-8','gbk',$list[$k]['money']) . '"';
  171. $refund_value['ticket'] = '"' . iconv('utf-8','gbk',$list[$k]['ticket']) . '"';
  172. $refund_value['user_name'] = '"' . iconv('utf-8','gbk',$list[$k]['user_name']) . '"';
  173. $refund_value['create_time'] = '"' . iconv('utf-8','gbk',$list[$k]['create_time']) . '"';
  174. $refund_value['memo'] = '"' . iconv('utf-8','gbk',$list[$k]['memo']) . '"';
  175. $refund_value['is_pay'] = '"' . iconv('utf-8','gbk',get_status($list[$k]['is_pay'])) . '"';
  176. $refund_value['pay_time'] = '"' . iconv('utf-8','gbk',$list[$k]['pay_time']) . '"';
  177. $refund_value['pay_time'] = str_replace($time,'0',$list[$k]['pay_time']);
  178. $refund_value['reply'] = '"' . iconv('utf-8','gbk',$list[$k]['reply']) . '"';
  179. $refund_value['ybdrawflowid'] = '"' . iconv('utf-8','gbk',$list[$k]['ybdrawflowid']) . '"';
  180. $refund_value['pay_log'] = '"' . iconv('utf-8','gbk',$list[$k]['pay_log']) . '"';
  181. // $refund_value['bank_info'] = '"' . iconv('utf-8','gbk',get_carray_info($list[$k]['user_bank_id'],$list[$k]['user_id'])) . '"';
  182. $content .= implode(",", $refund_value) . "\n";
  183. }
  184. //
  185. header("Content-Disposition: attachment; filename=refund_list.csv");
  186. echo $content ;
  187. }
  188. else
  189. {
  190. if($page==1)
  191. $this->error(L("NO_RESULT"));
  192. }
  193. }
  194. }
  195. ?>