|
- <?php
- /**
- * Created by PhpStorm.
- * User: Redstop
- * Date: 2016/12/17
- * Time: 11:57
- */
- header("Content-type:text/html;charset=utf-8");
- require_once __DIR__.'/../Common/Mysql.php';
- require_once __DIR__.'/../Common/zizai_api.inc';
-
- $update_time = date("Y-m-d H:i:s");
- $end_date = date("Y-m-d", strtotime("+2 months"));
- $date = date("Y-m-d");
- while( $date <= $end_date ) {
- $godate = $date;
- $gotime = "";
- $disney1 = get_ticket_array(API_USER, API_PASSWORD, DISNEY_CODE1, $godate, $gotime);
- $disney2 = get_ticket_array(API_USER, API_PASSWORD, DISNEY_CODE2, $godate, $gotime);
- $pdo_insert = conn1();
- foreach ($disney1 as $disney_info) {
- $prod_name = "迪士尼一日门票";
- $prod_code = DISNEY_CODE1;
-
- $cs_prod_id = 0;
- if( mb_strpos($disney_info["ticketname"], "成人") != false ) {
- $cs_prod_id = 387538;
- } else if( mb_strpos($disney_info["ticketname"], "老人") != false ) {
- $cs_prod_id = 387539;
- } else if( mb_strpos($disney_info["ticketname"], "儿童") != false ) {
- $cs_prod_id = 387540;
- }
-
- $insert_sql = " INSERT INTO outside_ticket (supplier_id,prod_name,prod_code, ticket_code, ticket_date, ticket_time, ticket_name, ticket_comment, ticket_num, ticket_price, agent_price, cancel_flag, update_time, cs_prod_id) " .
- " VALUES (3, '{$prod_name}', '{$prod_code}', '{$disney_info["ticketid"]}', '{$godate}', '', '{$disney_info["ticketname"]}', '', {$disney_info["ticketcount"]}, {$disney_info["ticketprice"]}, {$disney_info["agentprice"]}, 0, '{$update_time}', {$cs_prod_id} ) ON DUPLICATE KEY UPDATE ticket_num={$disney_info["ticketcount"]},update_time='{$update_time}',cancel_flag=0;";
- $pdo_insert->exec($insert_sql);
- }
-
- foreach ($disney2 as $disney_info) {
- $prod_name = "迪士尼两日门票";
- $prod_code = DISNEY_CODE2;
- $cs_prod_id = 0;
- if( mb_strpos($disney_info["ticketname"], "成人") != false ) {
- $cs_prod_id = 387541;
- } else if( mb_strpos($disney_info["ticketname"], "老人") != false ) {
- $cs_prod_id = 387542;
- } else if( mb_strpos($disney_info["ticketname"], "儿童") != false ) {
- $cs_prod_id = 387543;
- }
- $insert_sql = " INSERT INTO outside_ticket (supplier_id,prod_name,prod_code, ticket_code, ticket_date, ticket_time, ticket_name, ticket_comment, ticket_num, ticket_price, agent_price, cancel_flag, update_time, cs_prod_id) " .
- " VALUES (3, '{$prod_name}', '{$prod_code}', '{$disney_info["ticketid"]}', '{$godate}', '', '{$disney_info["ticketname"]}', '', {$disney_info["ticketcount"]}, {$disney_info["ticketprice"]}, {$disney_info["agentprice"]}, 0, '{$update_time}', {$cs_prod_id} ) ON DUPLICATE KEY UPDATE ticket_num={$disney_info["ticketcount"]},update_time='{$update_time}',cancel_flag=0;";
- $pdo_insert->exec($insert_sql);
- }
- $date = date("Y-m-d", strtotime($date." +1 days"));
- }
- exit();
|