12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace app\modules\admin\models;
- use Yii;
- /**
- * This is the model class for table "{{%sysconfig}}".
- *
- * @property int $id ID
- * @property string $name 配置标识符
- * @property string|null $value 配置
- * @property string $bak 备注
- * @property int $type 1:key-value 键值对
- * @property int $is_system 1:系统自带
- * @property int $list_order 排序
- * @property int $disabled 1:禁用
- */
- class Sysconfig extends \app\common\models\EActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return '{{%sysconfig}}';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['name','type','bak'], 'required'],
- [['value'], 'string'],
- [['type', 'is_system', 'list_order', 'disabled'], 'integer'],
- [['name', 'bak'], 'string', 'max' => 50],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => Yii::t('attr','sysconfig.id'),
- 'name' => Yii::t('attr','sysconfig.name'),
- 'value' => Yii::t('attr','sysconfig.value'),
- 'bak' => Yii::t('attr','sysconfig.bak'),
- 'type' => Yii::t('attr','sysconfig.type'),
- 'is_system' => Yii::t('attr','sysconfig.is_system'),
- 'list_order' => Yii::t('attr','sysconfig.list_order'),
- 'disabled' => Yii::t('attr','sysconfig.disabled'),
- ];
- }
- //配置类型
- public static function typeOptions($k=null)
- {
- $options = array('1'=>'键值对','2'=>'普通选项组','3'=>'普通值');
- if(is_numeric($k))return $options[$k];
- return $options;
- }
- }
|