EmailRecord.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%email_record}}".
  6. *
  7. * @property int $id ID
  8. * @property string $address 邮箱地址
  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. */
  16. class EmailRecord extends \app\common\models\EActiveRecord
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public static function tableName()
  22. {
  23. return '{{%email_record}}';
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function rules()
  29. {
  30. return [
  31. [['address', 'content'], 'required'],
  32. [['content', 'remarks'], 'string'],
  33. [['type', 'sent_time'], 'integer'],
  34. [['address'], 'string', 'max' => 50],
  35. [['title', 'error'], 'string', 'max' => 255],
  36. ];
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => Yii::t('attr','email_record.id'),
  45. 'address' => Yii::t('attr','email_record.address'),
  46. 'title' => Yii::t('attr','email_record.title'),
  47. 'content' =>Yii::t('attr','email_record.content'),
  48. 'remarks' => Yii::t('attr','email_record.remarks'),
  49. 'error' =>Yii::t('attr','email_record.error'),
  50. 'type' => Yii::t('attr','email_record.type'),
  51. 'sent_time' => Yii::t('attr','email_record.sent_time'),
  52. ];
  53. }
  54. public static function typeOptions($k=null)
  55. {
  56. $options = array('1'=>'验证码','2'=>'通用');
  57. if(is_numeric($k))return $options[$k];
  58. return $options;
  59. }
  60. }