$this->shopId]); if (empty($info)) { $data = [ 'sjId' => $this->sjId, 'shopId' => $this->shopId, ]; CustomLevelClass::add($data, true); $info = CustomLevelClass::getByCondition(['shopId' => $this->shopId]); } util::success(['info' => $info]); } //添加修改等级 shish 20211016 public function actionReplace() { $post = Yii::$app->request->post(); $info = CustomLevelClass::getByCondition(['shopId' => $this->shopId], true); if (empty($info)) { util::fail('出错了'); } $id = $info->id ?? 0; $qtNum = $post['qtNum'] ?? 0; if (is_numeric($qtNum) == false || $qtNum <= 0) { util::fail('青铜等级的数量要大于0'); } $byNum = $post['byNum'] ?? 0; if ($byNum <= $qtNum) { util::fail('白银等级的数量要大于青铜'); } $hjNum = $post['hjNum'] ?? 0; if ($hjNum <= $byNum) { util::fail('黄金等级的数量要大于白银'); } $zsNum = $post['zsNum'] ?? 0; if ($zsNum <= $hjNum) { util::fail('钻石等级的数量要大于黄金'); } CustomLevelClass::updateById($id, $post); util::complete('修改成功'); } }