You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

update_lionking_ticket_memcache.php 4.2 KiB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Redstop
  5. * Date: 2016/12/17
  6. * Time: 11:57
  7. */
  8. header("Content-type:text/html;charset=utf-8");
  9. require_once __DIR__.'/../Common/Mysql.php';
  10. require_once __DIR__.'/../Common/zizai_api.inc';
  11. $start_date = date("Y-m-d");
  12. $disney_memory = get_memcache('lion_threater_info');
  13. $disney_memory2 = $disney_memory;
  14. foreach( $disney_memory2 as $disney_date => $data_info ) {
  15. if( $disney_date < $start_date ) {
  16. unset( $disney_memory[$disney_date]);
  17. }
  18. }
  19. $pdo = conn1();
  20. $sql = " SELECT * FROM outside_ticket WHERE prod_code IN('DSNSZW') AND ticket_date >= '{$start_date}' AND update_time >= '{$start_date} 00:00:00' AND cancel_flag = 0 ORDER BY ticket_date,ticket_time ";
  21. $result = $pdo->query($sql);
  22. $rowset = $result->fetchAll();
  23. $disney_ticket_array = array();
  24. foreach( $rowset as $row_info ) {
  25. $ticket_date = $row_info["ticket_date"];
  26. $ticket_time = $row_info["ticket_time"];
  27. if( !isset($disney_ticket_array[$ticket_date]) ) {
  28. $disney_ticket_array[$ticket_date] = array();
  29. }
  30. if( !isset($disney_ticket_array[$ticket_date][$ticket_time]) ) {
  31. $disney_ticket_array[$ticket_date][$ticket_time] = array();
  32. }
  33. if( !isset($disney_ticket_array[$ticket_date][$ticket_time]["tic_info"]) ) {
  34. $disney_ticket_array[$ticket_date][$ticket_time]["tic_info"] = array( "0" => 0, "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0 );
  35. }
  36. if( !isset($disney_ticket_array[$ticket_date][$ticket_time]["price"]) ) {
  37. $disney_ticket_array[$ticket_date][$ticket_time]["price"] = array( "0" => 0, "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0 );
  38. }
  39. if( !isset($disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"]) ) {
  40. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"] = array();
  41. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][] = array( "ticketid" => "", "ticketname" => "AA区域", "ticketprice" => 900, "ticketcount" => 0, "agentprice" => 720 );
  42. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][] = array( "ticketid" => "", "ticketname" => "AB区域", "ticketprice" => 700, "ticketcount" => 0, "agentprice" => 560 );
  43. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][] = array( "ticketid" => "", "ticketname" => "BA区域", "ticketprice" => 490, "ticketcount" => 0, "agentprice" => 392 );
  44. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][] = array( "ticketid" => "", "ticketname" => "BB区域", "ticketprice" => 390, "ticketcount" => 0, "agentprice" => 312 );
  45. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][] = array( "ticketid" => "", "ticketname" => "CA区域", "ticketprice" => 290, "ticketcount" => 0, "agentprice" => 232 );
  46. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][] = array( "ticketid" => "", "ticketname" => "CB区域", "ticketprice" => 190, "ticketcount" => 0, "agentprice" => 152 );
  47. }
  48. $ticket_name = $row_info["ticket_name"];
  49. $ticket_index = 0;
  50. if( mb_strpos($ticket_name, "AB") ) {
  51. $ticket_index = 1;
  52. } else if( mb_strpos($ticket_name, "BA") ) {
  53. $ticket_index = 2;
  54. } else if( mb_strpos($ticket_name, "BB") ) {
  55. $ticket_index = 3;
  56. } else if( mb_strpos($ticket_name, "CA") ) {
  57. $ticket_index = 4;
  58. } else if( mb_strpos($ticket_name, "CB") ) {
  59. $ticket_index = 5;
  60. }
  61. $disney_ticket_array[$ticket_date][$ticket_time]["tic_info"][$ticket_index] = $row_info["ticket_num"];
  62. $disney_ticket_array[$ticket_date][$ticket_time]["price"][$ticket_index] = (int)$row_info["ticket_price"];
  63. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][$ticket_index]["ticketid"] = $row_info["ticket_code"];
  64. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][$ticket_index]["ticketprice"] = $row_info["ticket_price"];
  65. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][$ticket_index]["ticketcount"] = $row_info["ticket_num"];
  66. $disney_ticket_array[$ticket_date][$ticket_time]["ticket_array"][$ticket_index]["agentprice"] = $row_info["agent_price"];
  67. }
  68. foreach( $disney_ticket_array as $disney_date => $disney_ticket ) {
  69. $disney_memory[$disney_date] = $disney_ticket;
  70. }
  71. set_memcache('lion_threater_info', $disney_memory);
  72. exit();