MobileMsgTpl.php 1.5 KB

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