RechargeOfflineNoticeAction.class.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 RechargeOfflineNoticeAction extends CommonAction{
  10. public function com_search(){
  11. $map = array ();
  12. /*
  13. if (!isset($_REQUEST['end_time']) || $_REQUEST['end_time'] == '') {
  14. $_REQUEST['end_time'] = to_date(get_gmtime(), 'Y-m-d');
  15. }
  16. if (!isset($_REQUEST['start_time']) || $_REQUEST['start_time'] == '') {
  17. $_REQUEST['start_time'] = dec_date($_REQUEST['end_time'], 7);
  18. }
  19. $map['start_time'] = trim($_REQUEST['start_time']);
  20. $map['end_time'] = trim($_REQUEST['end_time']);
  21. $map['is_paid'] = 1;
  22. $this->assign("start_time",$map['start_time']);
  23. $this->assign("end_time",$map['end_time']);
  24. */
  25. $map['start_time'] = trim($_REQUEST['start_time']);
  26. $map['end_time'] = trim($_REQUEST['end_time']);
  27. if ($map['start_time'] == ''&&$map['end_time'] != ''){
  28. $this->error('开始时间 不能为空');
  29. exit;
  30. }
  31. if ($map['start_time'] != ''&&$map['end_time'] == ''){
  32. $this->error('结束时间 不能为空');
  33. exit;
  34. }
  35. if ($map['start_time'] != ''&&$map['end_time'] != '') {
  36. $d = explode('-',$map['start_time']);
  37. if (checkdate($d[1], $d[2], $d[0]) == false){
  38. $this->error("开始时间不是有效的时间格式:{$map['start_time']}(yyyy-mm-dd)");
  39. exit;
  40. }
  41. $d = explode('-',$map['end_time']);
  42. if (checkdate($d[1], $d[2], $d[0]) == false){
  43. $this->error("结束时间不是有效的时间格式:{$map['end_time']}(yyyy-mm-dd)");
  44. exit;
  45. }
  46. if (to_timespan($map['start_time']) > to_timespan($map['end_time'])){
  47. $this->error('开始时间不能大于结束时间:'.$map['start_time'].'至'.$map['end_time']);
  48. exit;
  49. }
  50. $q_date_diff = 31;
  51. $this->assign("q_date_diff",$q_date_diff);
  52. if ($q_date_diff > 0 && (abs(to_timespan($map['end_time']) - to_timespan($map['start_time'])) / 86400 + 1 > $q_date_diff)){
  53. $this->error("查询时间间隔不能大于 {$q_date_diff} 天");
  54. exit;
  55. }
  56. $map['start_time']=to_timespan($map['start_time'])+app_conf('TIME_ZONE')*3600;
  57. $map['end_time']=to_timespan($map['end_time'])+86399+app_conf('TIME_ZONE')*3600;
  58. }else{
  59. $map = array ();
  60. }
  61. return $map;
  62. }
  63. public function index()
  64. {
  65. $map = $this->com_search();
  66. if(trim($_REQUEST['notice_sn'])!='')
  67. {
  68. $condition['notice_sn'] = $_REQUEST['notice_sn'];
  69. }
  70. /*$payment_id = M("Payment")->where("class_name = 'Otherpay'")->getField("id");
  71. $condition['payment_id'] = $payment_id;*/
  72. $condition['payment_id'] = 0;
  73. if($map['start_time'] != '' && $map['end_time']!= ''){
  74. $condition['create_time']= array("between",array($map['start_time'],$map['end_time']));
  75. unset($map['start_time']);
  76. unset($map['end_time']);
  77. }
  78. if($_REQUEST['is_paid']!=''&&intval($_REQUEST['is_paid'])==0)
  79. {
  80. $condition['is_paid']=0;
  81. }elseif (intval($_REQUEST['is_paid'])==1){
  82. $condition['is_paid']=1;
  83. }
  84. if(intval($_REQUEST['is_paid'])==-1 || !isset($_REQUEST['is_paid']))unset($_REQUEST['is_paid']);
  85. $map = array_merge($map,$condition);
  86. if (method_exists ( $this, '_filter' )) {
  87. $this->_filter ( $map );
  88. }
  89. $model = D ('PaymentNotice');
  90. if (! empty ( $model )) {
  91. $this->_list ( $model, $map );
  92. }
  93. //print_r($condition);exit();
  94. $this->display ();
  95. return;
  96. }
  97. public function delete() {
  98. //彻底删除指定记录
  99. $ajax = intval($_REQUEST['ajax']);
  100. $id = $_REQUEST ['id'];
  101. if (isset ( $id )) {
  102. $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
  103. $rel_data = M(PaymentNotice)->where($condition)->findAll();
  104. $list = M(PaymentNotice)->where ( $condition )->delete();
  105. foreach($rel_data as $data)
  106. {
  107. $info[] = "[单号:".$data['notice_sn']."]";
  108. }
  109. if($info) $info = implode(",",$info);
  110. if ($list!==false) {
  111. save_log($info."成功删除",1);
  112. $this->success ("成功删除",$ajax);
  113. } else {
  114. save_log($info."删除出错",0);
  115. $this->error ("删除出错",$ajax);
  116. }
  117. } else {
  118. $this->error (l("INVALID_OPERATION"),$ajax);
  119. }
  120. }
  121. }
  122. ?>