MobileMsg.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "wz_mobile_msg".
  6. *
  7. * @property int $id ID
  8. * @property string $mobile 手机号
  9. * @property string $title 标题
  10. * @property string $content 内容
  11. * @property string $remarks 备注
  12. * @property string $error 错误记录
  13. * @property int $type 短信类型 1:验证码 2:普通内容
  14. * @property int $sent_time 发送时间
  15. * @property int $real_sent_time 真实发送时间(如定时发送)
  16. */
  17. class MobileMsg extends \app\common\models\EActiveRecord
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public static function tableName()
  23. {
  24. return '{{%mobile_msg}}';
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['mobile', 'content', 'remarks'], 'required'],
  33. [['content', 'remarks'], 'string'],
  34. [['type', 'sent_time', 'real_sent_time'], 'integer'],
  35. [['mobile'], 'string', 'max' => 20],
  36. [['title', 'error'], 'string', 'max' => 255],
  37. ];
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function attributeLabels()
  43. {
  44. return [
  45. 'id' => Yii::t('attr','mobile_msg.id'),
  46. 'mobile' => Yii::t('attr','mobile_msg.mobile'),
  47. 'title' => Yii::t('attr','mobile_msg.title'),
  48. 'content' => Yii::t('attr','mobile_msg.content'),
  49. 'remarks' => Yii::t('attr','mobile_msg.remarks'),
  50. 'error' => Yii::t('attr','mobile_msg.error'),
  51. 'type' => Yii::t('attr','mobile_msg.type'),
  52. 'sent_time' => Yii::t('attr','mobile_msg.sent_time'),
  53. 'real_sent_time' => Yii::t('attr','mobile_msg.real_sent_time'),
  54. ];
  55. }
  56. public static function typeOptions($k=null)
  57. {
  58. $options = array('1'=>'验证码','2'=>'通用');
  59. if(is_numeric($k))return $options[$k];
  60. return $options;
  61. }
  62. }