Respond_adminAction.class.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /**
  3. * 投递回应
  4. */
  5. require_once( ONU_ROOT . 'application/module/ctrl/Action.class.php');
  6. require_once ( ONU_ROOT . 'application/lib/data/adminAction.php');
  7. class Respond_adminAction extends Action{
  8. public function __construct(){
  9. parent::__construct();
  10. if(empty($_SESSION['mds_user'])){
  11. header("Location:/?a=index&m=admin_login");
  12. exit();
  13. }
  14. }
  15. //投递回应
  16. public function index(){
  17. $admin = new AdvertAdminAction();
  18. $api_user = $_SESSION['API_USER'];
  19. $api_key = $_SESSION['API_KEY'];
  20. $uid = $_SESSION['user_infos']['id'];
  21. $info = $_REQUEST['info'];
  22. $post_url = 'http://api.sendcloud.net/apiv2/data/emailStatus';
  23. $e_date = date("Y-m-d", strtotime("+1 day"));
  24. $s_date = date("Y-m-d", strtotime("-1 day"));
  25. $date_show = trim($_REQUEST['date_show']);
  26. if($date_show){
  27. $date_array = explode("-",$_REQUEST['date_show']);
  28. $BeginDate2 = $date_array[0];
  29. $BeginDate2 = date('Y-m-d',strtotime($BeginDate2));
  30. $EndDate = $date_array[1];
  31. $EndDate = date('Y-m-d',strtotime($EndDate));
  32. }
  33. $start_date = $BeginDate2 ? $BeginDate2 : $s_date;
  34. $end_date = $EndDate ? $EndDate : $e_date;
  35. $B = date('Y/m/d',strtotime($start_date));
  36. $e = date('Y/m/d',strtotime($end_date));
  37. $date_show = $B.'-'.$e;
  38. $params = array(
  39. 'apiUser' => $api_user,
  40. 'apiKey' => $api_key,
  41. 'apiUserList' => $api_user,
  42. 'startDate' => $start_date,
  43. 'endDate' => $end_date
  44. );
  45. $result = make_curl($post_url,$params);
  46. $list = $result['info']['voList'];
  47. $list = $this->listByDate($list);
  48. $this->assign('list',$list);
  49. $this->assign('date_show',$date_show);
  50. $this->assign('info',$info);
  51. $this->display("index.html");
  52. }
  53. //按时间排序
  54. function listByDate($list,$desc){
  55. if(empty($desc)){//降序
  56. for($i=0; $i<count($list) ;$i++){
  57. for($j=0; $j<$i; $j++){
  58. if($list[$i]['requestTime'] > $list[$j]['requestTime']){
  59. $temp = $list[$i];
  60. $list[$i] = $list[$j];
  61. $list[$j] = $temp;
  62. }
  63. }
  64. }
  65. }else{
  66. for($i=0; $i<count($list) ;$i++){
  67. for($j=0; $j<$i; $j++){
  68. if($list[$i]['requestTime'] < $list[$j]['requestTime']){
  69. $temp = $list[$i];
  70. $list[$i] = $list[$j];
  71. $list[$j] = $temp;
  72. }
  73. }
  74. }
  75. }
  76. return $list;
  77. }
  78. // class end
  79. }
  80. ?>