Ndr_adminAction.class.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 Ndr_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/bounce/list';
  23. $e_date = date('Y-m-d',strtotime("+1 day"));
  24. $s_date = date("Y-m-d", strtotime("-30 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. 'limit' => 100,//返回前100条数据
  42. 'startDate' => $start_date,
  43. 'endDate' => $end_date
  44. );
  45. $result = make_curl($post_url,$params);
  46. $list = $result['info']['dataList'];
  47. $where = "uid ='$uid'";
  48. foreach($list as $ls){
  49. $email = $ls['email'];
  50. $r = $admin->select_ndr_user($where,$email);
  51. if(empty($r)){
  52. $data['email'] = $email;
  53. $data['uid'] = $uid;
  54. $insert = $admin->insert_ndr_user($data);
  55. }
  56. }
  57. $this->assign('list',$list);
  58. $this->assign('date_show',$date_show);
  59. $this->assign('info',$info);
  60. $this->display("index.html");
  61. }
  62. //退信列表管理-删除操作
  63. public function delete(){
  64. $api_user = $_SESSION['API_USER'];
  65. $api_key = $_SESSION['API_KEY'];
  66. $post_url = 'http://api.sendcloud.net/apiv2/bounce/delete';
  67. $e_date = date('Y-m-d',time());
  68. $s_date = date("Y-m-d", strtotime("-30 day"));
  69. $params = array(
  70. 'apiUser' => $api_user,
  71. 'apiKey' => $api_key,
  72. 'startDate' => $s_date,
  73. 'endDate' => $e_date
  74. );
  75. $result = make_curl($post_url,$params);
  76. $info = $result['message'];
  77. header("Location:/?a=ndr_admin&m=index&info=$info");
  78. exit();
  79. }
  80. // class end
  81. }
  82. ?>