| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\models;
- use app\models\common\admin\log\CommonActionLog;
- use Yii;
- use yii\behaviors\TimestampBehavior;
- /**
- * This is the model class for table "{{%goods_brand_cat}}".
- *
- * @property integer $id
- * @property integer $store_id
- * @property string $brand_cat_name
- * @property integer $is_delete
- * @property integer $sort
- * @property integer $status
- * @property string $created_at
- * @property string $updated_at
- */
- class GoodsBrandCat extends \yii\db\ActiveRecord
- {
- const STATUS_OPEN = 1;
- const STATUS_CLOSE = 0;
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%goods_brand_cat}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['store_id', 'is_delete', 'sort', 'status'], 'integer'],
- [['brand_cat_name', 'created_at', 'updated_at'], 'string'],
- ];
- }
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::class,
- ]
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'brand_cat_name' => '品牌分类名称',
- 'is_delete' => '是否删除',
- 'sort' => '排序(越大越靠前)',
- 'created_at' => '添加时间',
- 'updated_at' => '修改时间',
- 'status' => '是否显示',
- ];
- }
- public static function getList($store_id) {
- return self::find()->where(['store_id' => $store_id, 'is_delete' => 0, 'status' => 1])
- ->select('id, brand_cat_name')->orderBy('id DESC')->asArray()->all();
- }
- //获取指定的商品品牌分类
- public static function getBrandCat($id) {
- return self::findOne(['id' => $id, 'is_delete' => 0, 'status' => 1]);
- }
- }
|