model = $attr; $form->store_id = get_store_id(); $form->supplier_id = get_supplier_id(); $form->attributes = $data; return $this->asJson($form->save()); } /** * 获取规格库列表 * @return \yii\web\Response */ public function actionList() { $store_id = get_store_id(); $supplier_id = get_supplier_id(); $list = AttrLibrary::getList($store_id, 0, $supplier_id); return $this->asJson([ 'code' => 0, 'data' => [ 'list' => $list ] ]); } /** * 批量删除 * @return \yii\web\Response */ public function actionStatus() { $res = AttrLibrary::updateAll(['is_delete' => 1], ['id' => get_params('id',[])]); return $this->asJson([ 'code' => 0, 'data' => [ 'updateCount' => $res ] ]); } /** * 删除分类 * @return \yii\web\Response */ public function actionDel() { $attr = AttrLibrary::findOne(get_params('id')); if (empty($attr)) { return $this->asJson([ 'code' => 1, 'msg' => '查无此分类' ]); } $attr->is_delete = 1; if ($attr->save()) { return $this->asJson([ 'code' => 0, 'msg' => '删除成功' ]); }else { return $this->asJson([ 'code' => 1, 'msg' => '删除失败' ]); } } }