60], [['sort'], 'default', 'value' => 100], [['is_show'], 'default', 'value' => 1], [['is_delete'], 'default', 'value' => 0] ]; } /** * 保存分类 * @return array */ public function save() { $this->model->parent_id = $this->parent_id; $this->model->is_show = $this->is_show; if ($this->is_show == 0) { // 产品分类隐藏同时下架该分类下所有商品 /*$goods_ids = GoodsCat::find()->where(['is_delete' => 0, 'store_id' => get_store_id(), 'cat_id' => post_params('id')])->select('goods_id')->asArray()->all(); Goods::updateAll(['status' => Goods::STATUS_DISABLE],['in', 'id', array_column($goods_ids, 'goods_id')]);*/ } $this->model->cat_name = $this->cat_name; $this->model->sort = $this->sort; $this->model->store_id = $this->store_id; if ($this->model->save()) { return [ 'code' => 0, 'msg' => '提交成功' ]; } else { return [ 'code' => 0, 'msg' => '保存失败' ]; } } }