12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace app\models;
- use Yii;
- /**
- * This is the model class for table "{{%email_tpl}}".
- *
- * @property int $id ID
- * @property string $key KEY
- * @property string $title 名称
- * @property string $tpl 模板内容
- * @property string $args 参数
- * @property int $type 类型 1:系统
- */
- class EmailTpl extends \app\common\models\EActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%email_tpl}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['key','title','tpl','type'], 'required'],
- [['type'], 'integer'],
- [['key', 'title'], 'string', 'max' => 50],
- [['args'], 'string', 'max' => 500],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => Yii::t('attr','email_tpl.id'),
- 'key' => Yii::t('attr','email_tpl.key'),
- 'title' => Yii::t('attr','email_tpl.title'),
- 'tpl' => Yii::t('attr','email_tpl.tpl'),
- 'args' => Yii::t('attr','email_tpl.args'),
- 'type' => Yii::t('attr','email_tpl.type'),
- ];
- }
- public static function typeOptions($k=null)
- {
- $options = array('1'=>'验证码','2'=>'通用');
- if(is_numeric($k))return $options[$k];
- return $options;
- }
- }
|