$this->mainId, 'delStatus' => 0], 'inTurn DESC', 'id,name'); util::success(['list' => $list]); } public function actionList() { $where = ['mainId' => $this->mainId, 'delStatus' => 0]; $list = WlClass::getWlList($where); util::success($list); } //删除物流 ssh 20230105 public function actionDelWl() { $id = Yii::$app->request->get('id', 0); $wl = WlClass::getById($id, true); if (empty($wl)) { util::fail('没有物流信息'); } if ($wl->mainId != $this->mainId) { util::fail('无法操作'); } $wl->delStatus = 1; $wl->save(); util::complete(); } //添加物流 ssh 20230105 public function actionAdd() { $post = Yii::$app->request->post(); $post['mainId'] = $this->mainId ?? 0; $name = $post['name'] ?? ''; $name = trim($name); if (empty($name)) { util::fail('请填写名称'); } $has = WlClass::getByCondition(['mainId' => $this->mainId, 'name' => $name], true); if (!empty($has)) { $has->delStatus = 0; $has->save(); } else { WlClass::add($post); } util::complete('添加成功'); } public function actionUpdate() { $post = Yii::$app->request->post(); $name = $post['name'] ?? ''; $name = trim($name); $inTurn = $post['inTurn'] ?? 100; $id = $post['id'] ?? 0; unset($post['id']); $pre = WlClass::getById($id, true); if (empty($pre)) { util::fail('修改失败'); } if ($pre->mainId != $this->mainId) { util::fail('没有权限修改'); } if ($name != $pre->name) { $repeat = WlClass::getByCondition(['mainId' => $this->mainId, 'name' => $name], true); if (!empty($repeat)) { util::fail('名称已经存在'); } } $pre->name = $name; $pre->inTurn = $inTurn; $pre->save(); util::complete(); } }