<?php
/**
 * 增值服务价格
 *
 */
class VasPrice extends Vas{
    public function __construct($table = 'vas_price') {
        parent::__construct($table);
    }
    
    /**
     * 某个服务实际需要的价格
     * string $type 类型
     */
    public function ServicePrice($type){
        $priceList = parent::findByType($type);
        $priceList['cost_price'] = $priceList['cost_price']!=0 ? $priceList['cost_price'] : '';
		$priceList['current_price'] = $priceList['current_price']!=0 ? $priceList['current_price'] : '';
        if($priceList['cost_price']&&$priceList['current_price']){
            $price = $priceList['cost_price']>=$priceList['current_price'] ? $priceList['current_price'] : FALSE;
        }elseif($priceList['cost_price']||$priceList['current_price']){
            $price = $priceList['cost_price'] ? $priceList['cost_price'] : $priceList['current_price'];
        }else{
            $price = FALSE;
        }
        return $price;
    }
    
    
    
    
}
