|
|
@@ -26,6 +26,28 @@ class ItemController extends BaseController
|
|
|
//批量删除花材 ssh 202302026
|
|
|
public function actionBatchRemove()
|
|
|
{
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $string = $post['ids'] ?? '';
|
|
|
+ $ids = json_decode($string, true);
|
|
|
+ $ids = array_unique(array_filter($ids));
|
|
|
+ if (empty($list)) {
|
|
|
+ util::fail('请选择花材');
|
|
|
+ }
|
|
|
+ $infoList = ItemClass::getAllByCondition(['id' => ['in', $ids]], null, 'id,name,mainId,status,delStatus,removeStatus', null, true);
|
|
|
+ if (empty($infoList)) {
|
|
|
+ util::fail('请选择花材哦');
|
|
|
+ }
|
|
|
+ foreach ($infoList as $info) {
|
|
|
+ if ($info->mainId != $this->mainId) {
|
|
|
+ util::fail('请选择自己的花材');
|
|
|
+ }
|
|
|
+ $name = $info->name ?? '';
|
|
|
+ if ($info->delStatus != 1) {
|
|
|
+ util::fail($name . '这个花材停用了才能删除');
|
|
|
+ }
|
|
|
+ $info->removeStatus = 1;
|
|
|
+ $info->save();
|
|
|
+ }
|
|
|
util::complete('操作成功');
|
|
|
}
|
|
|
|