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