| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace common\models;
- use Yii;
- /**
- * This is the model class for table "{{%AD_LOCATION}}".
- *
- * @property string $ID
- * @property string $LOCATION_NAME 分类名
- * @property string $REMARK 状态
- * @property int $TYPE 类型
- * @property string $CREATE_ADMIN 创建管理员
- * @property string $UPDATE_ADMIN 更新管理员
- * @property int $CREATED_AT 创建时间
- * @property int $UPDATED_AT 更新时间
- */
- class AdLocation extends \common\components\ActiveRecord
- {
- const TYPE_SLIDE = 1;
- const TYPE_IMAGE = 2;
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%AD_LOCATION}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['LOCATION_NAME', 'REMARK', 'TYPE', 'CREATE_ADMIN', 'CREATED_AT'], 'required'],
- [['TYPE', 'CREATED_AT', 'UPDATED_AT'], 'integer'],
- [['ID', 'CREATE_ADMIN', 'UPDATE_ADMIN'], 'string', 'max' => 32],
- [['LOCATION_NAME'], 'string', 'max' => 48],
- [['REMARK'], 'string', 'max' => 255],
- [['LOCATION_NAME'], 'unique'],
- [['ID'], 'unique'],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'ID' => 'ID',
- 'LOCATION_NAME' => '分类名',
- 'REMARK' => '状态',
- 'TYPE' => '类型',
- 'CREATE_ADMIN' => '创建管理员',
- 'UPDATE_ADMIN' => '更新管理员',
- 'CREATED_AT' => '创建时间',
- 'UPDATED_AT' => '更新时间',
- ];
- }
- /**
- * 获取全部广告为
- * @return array
- */
- public static function getAllLocation(){
- return static::find()->where('1=1')->orderBy('CREATED_AT DESC')->indexBy('ID')->asArray()->all();
- }
- }
|