Client.php 2.25 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 YHMSupport_Models_Choicegoods_Client {

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

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

    /**
     * 精选商品列表
     * @return type
     */
    static function getList($offset, $num) {
        return self::dao()->getList((int) $offset, (int) $num);
    }

    /**
     * 添加精选商品关联
     * @param number $product_skc
     * @param number $order_by
     * @param number $create_uid
     */
    public static function setChoice($product_skc, $order_by = 1, $create_uid = 0) {
        return self::dao()->setChoice($product_skc, $order_by, $create_uid);
    }

    /**
     * 删除精选
     * @param type $product_skc
     * @return int
     */
    public static function delChoice($product_skc) {
        if ((int) $product_skc < 1) {
            return 0;
        }
        return self::dao()->delChoice($product_skc);
    }

    /**
     * 获取精选总数
     * @return type
     */
    public static function getCount() {

        return self::dao()->getCount();
    }

    public static function setSortBySkc($skc, $sort) {
        if ((int) $skc < 1) {
            return 0;
        }
        return self::dao()->setSortBySkc((int) $skc, $sort);
    }

    /**
     * 根据类型获取总数
     * @return type
     */
    public static function getCountByType($type = '0', $keyword = '') {
        return self::dao()->getCountByType($type, $keyword);
    }

    /**
     * 根据类型精选商品列表
     * @return type
     */
    static function getListByType($type = '0', $keyword = '', $offset, $num) {
        return self::dao()->getListByType($type, $keyword, (int) $offset, (int) $num);
    }
    /**
     * 精选商品列表
     * @return type
     */
    static function getGoodsList($offset, $num) {
        return self::dao()->getGoodsList((int) $offset, (int) $num);
    }

}