LottoSms.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace frontend\models;
  3. use Yii;
  4. use common\helpers\TaobaoApiHelper;
  5. /**
  6. * This is the model class for table "bit_lotto_sms".
  7. *
  8. * @property integer $id
  9. * @property string $mobile
  10. * @property integer $in_time
  11. * @property integer $code
  12. * @property integer $code_time
  13. * @property string $lottery
  14. */
  15. class LottoSms extends \yii\db\ActiveRecord
  16. {
  17. /**
  18. * @inheritdoc
  19. */
  20. public static function tableName()
  21. {
  22. return 'bit_lotto_sms';
  23. }
  24. /**
  25. * @inheritdoc
  26. */
  27. public function attributeLabels()
  28. {
  29. return [
  30. 'id' => 'ID',
  31. 'mobile' => '手机号码',
  32. 'in_time' => '创建时间',
  33. 'code' => '验证码',
  34. 'code_time' => '验证码发送时间',
  35. 'lottery' => '中奖情况',
  36. ];
  37. }
  38. /**
  39. * 发送短信
  40. * @param string $mobile
  41. * @param string $code
  42. * @return array
  43. */
  44. public static function sendSmsCode($mobile, $code)
  45. {
  46. $mobile = (string) $mobile;
  47. $code = (string) $code;
  48. $tb = new TaobaoApiHelper();
  49. return $tb->sendSmsCode($mobile, $code);
  50. }
  51. }