Client.php 1.46 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_Activity_Client {

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

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

    /**
     * 获取搜索的banner
     * @return type
     */
    static function getActivityList($Today) {
        return self::dao()->getActivityList($Today);
    }

    /**
     * 根据活动id获取活动信息
     * @param int $id
     * @return int
     */
    static function getInfoById($id) {
        if ((int) $id < 1) {
            return 0;
        }
        return self::dao()->getInfoById((int) $id);
    }

    /**
     * 获取活动商品
     * @param int $activity_id
     * @return int
     */
    static function getGoodsListByActivityId($activity_id, $offset, $num) {
        if ((int) $activity_id < 1) {
            return 0;
        }
        return self::dao()->getGoodsListByActivityId((int) $activity_id, (int) $offset, (int) $num);
    }

    ###### admin #####

    /**
     * 删除活动
     * @param type $id
     */
    static function delById($id) {
        return self::dao()->delById((int) $id);
    }

}