| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.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_cat}}".
- *
- * @property integer $id
- * @property integer $store_id
- * @property string $brand_name
- * @property string $brand_logo
- * @property integer $is_delete
- * @property integer $sort
- * @property integer $is_show
- * @property string $created_at
- * @property string $updated_at
- */
- class GoodsBrand extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%goods_brand}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['store_id', 'is_delete', 'sort', 'is_show'], 'integer'],
- [['brand_name', 'brand_logo', 'created_at', 'updated_at'], 'string'],
- ];
- }
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::class,
- ]
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'brand_name' => '品牌名称',
- 'brand_logo' => '品牌logo',
- 'is_delete' => '是否删除',
- 'sort' => '排序(越大越靠前)',
- 'created_at' => '添加时间',
- 'updated_at' => '修改时间',
- 'is_show' => '是否显示',
- ];
- }
- // public function afterSave($insert, $changedAttributes)
- // {
- /*$data = $insert ? json_encode($this->attributes) : json_encode($changedAttributes);
- CommonActionLog::storeActionLog('', $insert, $this->is_delete, $data, $this->id);*/
- // }
- public static function getList($store_id) {
- return self::find()->where(['store_id' => $store_id, 'is_delete' => 0, 'is_show' => 1])
- ->select('id, brand_name, brand_logo')->orderBy('id DESC')->asArray()->all();
- }
- }
|