<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/8 0008
 * Time: 下午 3:13
 */
namespace Common\Controller;
use Common\Controller\SmSController;
use Think\Controller;

class MsmFactory extends Controller
{
    private $UserPhone;//短信接收者手机

    public function __construct($UserPhone)
    {
        parent::__construct();
        //检测所使用的短信类型
        //0-短信关闭,1-华信,2大于
        $this->UserPhone = $UserPhone;
        $type = M('sms_check')->field('status')->where(['check_title'  => '开启短信'])->getField('status');
        $this->factory($type);
    }
    public function factory($type)
    {
        switch($type){
            case '0':
                return $this->error('短信功能暂未开启');
                break;
            case '1':
                return SMSController::getinstance();//华信
            break;

            case '2':
                $dayu = new sendSMS_DayuController($this->UserPhone);
                $dayu->send();
            break;
        }
    }
}