EmailTpl.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%email_tpl}}".
  6. *
  7. * @property int $id ID
  8. * @property string $key KEY
  9. * @property string $title 名称
  10. * @property string $tpl 模板内容
  11. * @property string $args 参数
  12. * @property int $type 类型 1:系统
  13. */
  14. class EmailTpl extends \app\common\models\EActiveRecord
  15. {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public static function tableName()
  20. {
  21. return '{{%email_tpl}}';
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['key','title','tpl','type'], 'required'],
  30. [['type'], 'integer'],
  31. [['key', 'title'], 'string', 'max' => 50],
  32. [['args'], 'string', 'max' => 500],
  33. ];
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function attributeLabels()
  39. {
  40. return [
  41. 'id' => Yii::t('attr','email_tpl.id'),
  42. 'key' => Yii::t('attr','email_tpl.key'),
  43. 'title' => Yii::t('attr','email_tpl.title'),
  44. 'tpl' => Yii::t('attr','email_tpl.tpl'),
  45. 'args' => Yii::t('attr','email_tpl.args'),
  46. 'type' => Yii::t('attr','email_tpl.type'),
  47. ];
  48. }
  49. public static function typeOptions($k=null)
  50. {
  51. $options = array('1'=>'验证码','2'=>'通用');
  52. if(is_numeric($k))return $options[$k];
  53. return $options;
  54. }
  55. }