<?php
/**
 * 快递公共类
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author xiaogg <xiaogg@sina.cn>
 */
namespace Common\Vendor;
class Distribute{
    static $class;
    /**
     * 构造方法，用于实例化一个处理对象
     * @param string $classname 要使用的类库
     */
    public function __construct($classname = ''){
        /* 判断调用库的类型 */
        if(empty($classname))$classname=M('Distribute')->where('status=1')->order('id desc')->getField('code');
        if(!$classname)return '';
        $sms_config=M('Distribute')->where("code='".$classname."'")->field(true)->cache(true)->find();      
        /* 引入处理库 */
        $classname=ucfirst($classname);
        $classfullname  =    "Common\\Vendor\\Distribute\\".$classname;
        $this->class = new $classfullname($sms_config);
    }
    public function __call($method,$data) {
       if(method_exists($this->class,$method))return $this->class->$method($data);
    }
}