<?php

/**
 * Created by PhpStorm.
 * User: Steven
 * Date: 2016/12/2
 * Time: 19:10
 */
class updateService extends commonService
{
    /**
     *修改密码
     *修改访问艺龙直连push接口的用户访问密码
     */
    public function changePassword($param)
    {
        //TODO:参数验证
        $res = utils::xml_encode(array('NewPassword' => '4s5f4s5e'), 'utf-16', 'ChangePasswordRequest');
        return $res;
    }

    /**
     * 更新房型状态（对应超售开关）
     * 按酒店编码、房型编码、日期范围设置房型开/关状态。酒店编码和房型编码需要在艺龙酒店预订系统中进行配置，将酒店供应商的编码与艺龙内部编码进行映射。
     * @param $param
     */
    public function UpdateRoomTypeStatus($param)
    {
        $array = array(
            'HotelCode' => 1,   //酒店代码
            'RoomTypeList' => array(
                'UpdateRoomTypeStatusChangeItem' => array(
                    'RequestID' => 1,
                    'RoomTypeCode' => 'CSD',
                    'Status' => 'open',
                    'BeginDate' => '2016-12-03 00:00:00',
                    'EndDate' => '2016-12-04 00:00:00',
                    'InventoryUpdateType' => 0
                )
            )
        );
        $request = utils::xml_encode($array, $this->LoginToken, 'UpdateRoomTypeStatusRequest');
        $res = utils::execute($request);
        return $res;
    }

    /**
     * 更新价格有效性
     * 按酒店编码、房型编码、房价代码、日期范围、每周的有效日 设置房价开/关状态。酒店编码、房型编码和房价需要在艺龙酒店预订系统中进行配置，将酒店供应商的编码与艺龙内部编码进行映射
     * @param $param
     * @return string
     */
    public function UpdateRoomRateStatusReuqest($param)
    {
        $array = array(
            'HotelCode' => 1,
            'RoomRateList' => array(
                'UpdateRoomRateStatusChangeItem' => array(
                    'RoomTypeCode' => 'CSD',
                    'Status' => 1, //1:Open;0:Close
                    'BeginDate' => '2016-12-03 00:00:00',
                    'EndDate' => '2016-12-04 00:00:00',
                    'DayOfWeek' => array(        //有效日设置
                        'Mon' => true,        //周一是否有效
                        'Tue' => true,
                        'Wed' => true,
                        'Thu' => true,
                        'Fri' => true,
                        'Sat' => true,
                        'Sun' => true
                    )
                )
            )
        );
        $res = utils::xml_encode($array, $this->LoginToken, 'UpdateRoomRateStatusReuqest');
        return $res;
    }

}