1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace app\models;
- use Yii;
- /**
- * This is the model class for table "{{%bad_word}}".
- *
- * @property int $id ID
- * @property string $bad_word 敏感词
- * @property int $type 敏感级别
- * @property string $replace_word 换替文字
- * @property int $create_time 添加时间
- * @property int $list_order 排序
- */
- class BadWord extends \app\common\models\EActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%bad_word}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['bad_word','type'], 'required'],
- [['type', 'create_time', 'list_order'], 'integer'],
- [['bad_word', 'replace_word'], 'string', 'max' => 20],
- // [['bad_word'], 'unique'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => Yii::t('attr','bad_word.id'),
- 'bad_word' => Yii::t('attr','bad_word.bad_word'),
- 'type' => Yii::t('attr','bad_word.type'),
- 'replace_word' => Yii::t('attr','bad_word.replace_word'),
- 'create_time' => Yii::t('attr','bad_word.create_time'),
- 'list_order' => Yii::t('attr','bad_word.list_order'),
- ];
- }
- //类型
- public static function typeOptions($k=null)
- {
- $options = array('1'=>'禁止显示(全局)','2'=>'禁止显示(未登录)','3'=>'禁止显示(非会员)','4'=>'禁止搜索(全局)','5'=>'禁止搜索(未登录用户)','6'=>'禁止搜索(非会员)','88'=>'禁止发布(全局)','99'=>'全局替换');
- if(is_numeric($k))return $options[$k];
- return $options;
- }
- }
|