Client.php 1.24 KB
<?php
class  YHMOrders_Models_Cart_Client {
	/**
	 *
	 * @var YHMOrders_Models_Cart_Dao
	 */
	private static $dao;
	
    /**
     * 
     * @return YHMOrders_Models_Cart_Dao
     */
	static private function dao() {
		if (empty(self::$dao)) {
			self::$dao = new YHMOrders_Models_Cart_Dao();
		}
		return self::$dao;
	}
	
	/**
	 *
	 * @param int $uid
	 * @param int $product_sku
	 * @param float $last_price
	 * @return int
	 */
	public static  function getDetailByUid($uid,$product_sku,$last_price)
	{
		if(empty($uid) || empty($product_sku) || empty($last_price))
		{
			return 0;
		}
		return self::dao()->getDetailByUid($uid, $product_sku, $last_price);
	}
	/**
	 *
	 * @param array $params
	 * @return number
	 */
	public static  function setGoodsByUid($params)
	{
		if(empty($params))
		{
			return 0;
		}
		return self::dao()->setGoodsByUid($params);
	}
	
	/**
	 * 更新购物车
	 * @param int $uid
	 * @param int $product_sku
	 * @param deciaml $last_price
	 * @param number $buy_number
	 */
	public static function updateGoodsByNum($uid,$product_sku,$last_price,$buy_number=1)
	{
		if(empty($uid) || empty($product_sku) || empty($last_price) || empty($buy_number)) return 0;
		return self::dao()->updateGoodsByNum($uid, $product_sku, $last_price);
	}
	
	
}