TimestampBehavior::class ] ]; } /** * @inheritdoc */ public function rules() { return [ [['id', 'store_id', 'sort', 'is_show', 'is_delete', 'created_at', 'updated_at'], 'integer'], [['name'], 'string'], ]; } public function attributeLabels() { return [ 'id' => '', 'store_id' => '商城ID', 'name' => '分类名称', 'sort' => '排序', 'is_show' => '状态:1:开启,0:禁用', 'is_delete' => '', 'created_at' => '创建时间', 'updated_at' => '更新时间' ]; } public static function getList($store_id, $id = 0, $is_enable = 1) { $where = [ 'is_delete' => 0, 'is_show' => $is_enable, 'store_id' => $store_id ]; if ($id) { $where['id'] = $id; } $list = self::find()->where($where)->orderBy('sort')->select('id, name')->asArray()->all(); foreach ($list as &$item) { $item['id'] = intval($item['id']); } return $list; } }