<?php


namespace Heanup\App\Api\Controller;


use Heanup\App\Api\Config\SiteRule;
use Heanup\App\Api\Package\Database\Num;
use Heanup\App\Api\RestfulController;
use Heanup\Library\Sms;

class Message extends RestfulController
{
    public $message;
    /**
     * @var array
     */
    public $number_info;

    /**
     * @inheritDoc
     */
    protected function getData()
    {
        $id=$this->getQuery()->intval("id");
        $num_info=Num::getLine($id);
        if ($num_info){
            $lib_class=SiteRule::getData($num_info['site']);
            $lib=new Sms($lib_class);
            $this->message=$lib->getMessage($num_info['country'], $num_info['phone']);
            $this->number_info=$num_info;
//            $this->showSuccess($this->message);
            $this->render();
        }

    }

    /**
     * @inheritDoc
     */
    protected function postData()
    {

    }

    /**
     * @inheritDoc
     */
    protected function putData()
    {

    }

    /**
     * @inheritDoc
     */
    protected function deleteData()
    {

    }
}