国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

webman-admin后臺管理字典設(shè)置添加一直提示:字典名稱只能是字母數(shù)字的組合(bug反饋)

不敗少龍

問題描述

默認的字典名: dict_name是有下劃線,添加和編輯一直提示錯誤: 字典名稱只能是字母數(shù)字的組合

程序代碼或配置

在正則校驗規(guī)則中修改成 "/^[a-zA-Z0-9_]+$/"

    /**
     * 插入
     * @param Request $request
     * @return Response
     * @throws BusinessException|Throwable
     */
    public function insert(Request $request): Response
    {
        if ($request->method() === 'POST') {
            $name = $request->post('name');
            if (Dict::get($name)) {
                return $this->json(1, '字典已經(jīng)存在');
            }
            if (!preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
                return $this->json(2, '字典名稱只能是字母數(shù)字的組合');
            }
            $values = (array)$request->post('value', []);
            Dict::save($name, $values);
        }
        return raw_view('dict/insert');
    }

    /**
     * 更新
     * @param Request $request
     * @return Response
     * @throws BusinessException|Throwable
     */
    public function update(Request $request): Response
    {
        if ($request->method() === 'POST') {
            $name = $request->post('name');
            if (!Dict::get($name)) {
                return $this->json(1, '字典不存在');
            }
            if (!preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
                return $this->json(2, '字典名稱只能是字母數(shù)字的組合');
            }
            Dict::save($name, $request->post('value'));
        }
        return raw_view('dict/update');
    }

操作系統(tǒng)環(huán)境及workerman/webman等具體版本

webman2.1,webman_admin2.0

374 1 0
1個回答

walkor 打賞

感謝反饋,下個版本修復(fù)

  • 暫無評論
??