Client.php 1.66 KB
<?php

/**
 * Created by JetBrains PhpStorm.
 * User: elkan
 * Date: 14-8-5
 * Time: 下午6:04
 * To change this template use File | Settings | File Templates.
 */
class YHMOrders_Models_Delivery_Client
{

    /**
     *
     * @var YHMOrders_Models_Delivery_Dao
     */
    private static $dao;

    /**
     *
     * @return YHMOrders_Models_Delivery_Dao
     */
    static private function dao()
    {
        if (empty(self::$dao)) {
            self::$dao = new YHMOrders_Models_Delivery_Dao();
        }
        return self::$dao;
    }

    /**
     * 查询订单收货地址
     * @param int $order_code
     * @return int
     */
    static function getOneByOrderCode($order_code)
    {
        if ((int)$order_code < 1) {
            return 0;
        }
        return self::dao()->getOneByOrderCode((int)$order_code);
    }

    /**
     * 存储订单送货地址
     * @param $orderCode
     * @param $receiverName
     * @param $receiverMobile
     * @param $areaCode
     * @param $address
     * @param $zipCode
     * @return int
     */
    static function addDelivery($orderCode, $receiverName, $receiverMobile, $areaCode, $address, $zipCode)
    {
        return self::dao()->addDelivery($orderCode, $receiverName, $receiverMobile, $areaCode, $address, $zipCode);
    }
    
    /**
     * 插入发货信息
     * @param type $deliver_company_id
     * @param type $deliver_company_name
     * @param type $delivery_code
     * @return type
     */
    static function setDelivery($order_code,$deliver_company_id,$deliver_company_name,$delivery_code){
        return self::dao()->setDelivery($order_code,$deliver_company_id,$deliver_company_name,$delivery_code);
    }
}