<?php

namespace frontend\models;

use Yii;
use common\helpers\TaobaoApiHelper;

/**
 * This is the model class for table "bit_lotto_sms".
 *
 * @property integer $id
 * @property string $mobile
 * @property integer $in_time
 * @property integer $code
 * @property integer $code_time
 * @property string $lottery
 */
class LottoSms extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'bit_lotto_sms';
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'mobile' => '手机号码',
            'in_time' => '创建时间',
            'code' => '验证码',
            'code_time' => '验证码发送时间',
            'lottery' => '中奖情况',
        ];
    }
    
    /**
     * 发送短信
     * @param string $mobile
     * @param string $code
     * @return array
     */
    public static function sendSmsCode($mobile, $code)
    {
        $mobile = (string) $mobile;
        $code = (string) $code;
        
        $tb = new TaobaoApiHelper();
        return $tb->sendSmsCode($mobile, $code);
    }
    
}