<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 開始使用 1. 填寫好控制器名稱 2. 填寫好表單元素 3. 點同步字段,會將表單元素自動同步到表字段,如果不想建表,也要點一下同步,不然前端校驗通過不了,包含 `id`、`status`、`isdelete`、`create_time`、`update_time` 的數據類型隨便填寫,模型會根據選項自動生成,不按此處選擇的數據類型生成 4. 勾選需要生成的首頁菜單 5. 勾選是否創建模型和驗證器 6. 點擊生成 ![](https://box.kancloud.cn/a62b546a97e46b3fc25fb05fbb1fda8c_1835x965.png) ![](https://box.kancloud.cn/0e1bf7ad815f8c3f1a2ff41cb532eabe_1844x841.png) ![](https://box.kancloud.cn/ae490052ba9ffd6e003d4434428626a2_1837x961.png) >[info] 以下代碼、日志全部是自動生成,沒有做任何修改,包括縮進,嚴格的縮進非常方便二次編輯和查閱 ## 生成文件 ### controller/UserInfo.php ``` <?php namespace app\admin\controller; \think\Loader::import('controller/Controller', \think\Config::get('traits_path') , EXT); use app\admin\Controller; class UserInfo extends Controller { use \app\admin\traits\controller\Controller; // 方法黑名單 protected static $blacklist = []; protected function filter(&$map) { if ($this->request->param("name")) { $map['name'] = ["like", "%" . $this->request->param("name") . "%"]; } if ($this->request->param("email")) { $map['email'] = ["like", "%" . $this->request->param("email") . "%"]; } } } ``` ### view/user_info/index.html ``` {extend name="template/base" /} {block name="content"} <div class="page-container"> {include file="form" /} <div class="cl pd-5 bg-1 bk-gray"> <span class="l"> {tp:menu menu="add,delete,recyclebin" /} </span> <span class="r pt-5 pr-5"> 共有數據 :<strong>{$count ?? '0'}</strong> 條 </span> </div> <table class="table table-border table-bordered table-hover table-bg mt-20"> <thead> <tr class="text-c"> {include file="th" /} <th width="70">操作</th> </tr> </thead> <tbody> {volist name="list" id="vo"} <tr class="text-c"> {include file="td" /} <td class="f-14"> {tp:menu menu='sedit' /} {tp:menu menu='sdelete' /} </td> </tr> {/volist} </tbody> </table> <div class="page-bootstrap">{$page ?? ''}</div> </div> {/block} {block name="script"} <script> $(function () { $("[name='sex']").find("[value='{$Request.param.sex}']").attr("selected", true); }) </script> {/block} ``` ### view/user_info/recyclebin.html ``` {extend name="template/recyclebin" /} {block name="script"} <script> $(function () { $("[name='sex']").find("[value='{$Request.param.sex}']").attr("selected", true); }) </script> {/block} ``` ### view/user_info/th.html ``` <th width="25"><input type="checkbox"></th> <th width="">姓名</th> <th width="">{:sort_by('性別','sex')}</th> <th width="">{:sort_by('年齡','age')}</th> <th width="">生日</th> <th width="">郵箱</th> ``` ### view/user_info/td.html ``` <td><input type="checkbox" name="id[]" value="{$vo.id}"></td> <td>{$vo.name|high_light=$Request.param.name}</td> <td>{$vo.sex}</td> <td>{$vo.age}</td> <td>{$vo.birthday}</td> <td>{$vo.email|high_light=$Request.param.email}</td> ``` ### view/user_info/form.html ``` <form class="mb-20" method="get" action="{:\\think\\Url::build($Request.action)}"> <input type="text" class="input-text" style="width:250px" placeholder="姓名" name="name" value="{$Request.param.name}" > <div class="select-box" style="width:250px"> <select name="sex" class="select"> <option value="1">男</option> <option value="2">女</option> <option value="0">未填寫</option> </select> </div> <input type="text" class="input-text" style="width:250px" placeholder="郵箱" name="email" value="{$Request.param.email}" > <button type="submit" class="btn btn-success"><i class="Hui-iconfont">&#xe665;</i> 搜索</button> </form> ``` ### view/user_info/edit.html ``` {extend name="template/base" /} {block name="content"} <div class="page-container"> <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}"> <input type="hidden" name="id" value="{:isset($vo.id)?$vo.id:''}"> <div class="row cl"> <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>姓名:</label> <div class="formControls col-xs-6 col-sm-6"> <input type="text" class="input-text" placeholder="姓名" name="name" value="{$vo.name ?? '未填寫'}" > </div> <div class="col-xs-3 col-sm-3"></div> </div> <div class="row cl"> <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>性別:</label> <div class="formControls col-xs-6 col-sm-6 skin-minimal"> <div class="radio-box"> <input type="radio" name="sex" id="sex-1" value="1" datatype="*" nullmsg="請選擇性別"> <label for="sex-1">男</label> </div> <div class="radio-box"> <input type="radio" name="sex" id="sex-2" value="2" datatype="*" nullmsg="請選擇性別"> <label for="sex-2">女</label> </div> <div class="radio-box"> <input type="radio" name="sex" id="sex-0" value="0" datatype="*" nullmsg="請選擇性別"> <label for="sex-0">未填寫</label> </div> </div> <div class="col-xs-3 col-sm-3"></div> </div> <div class="row cl"> <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>年齡:</label> <div class="formControls col-xs-6 col-sm-6"> <input type="number" class="input-text" placeholder="年齡" name="age" value="{$vo.age ?? ''}" > </div> <div class="col-xs-3 col-sm-3"></div> </div> <div class="row cl"> <label class="form-label col-xs-3 col-sm-3">生日:</label> <div class="formControls col-xs-6 col-sm-6"> <input type="text" class="input-text Wdate" placeholder="生日" name="birthday" value="{$vo.birthday ?? ''}" {literal} onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" {/literal} > </div> <div class="col-xs-3 col-sm-3"></div> </div> <div class="row cl"> <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>郵箱:</label> <div class="formControls col-xs-6 col-sm-6"> <input type="text" class="input-text" placeholder="郵箱" name="email" value="{$vo.email ?? ''}" > </div> <div class="col-xs-3 col-sm-3"></div> </div> <div class="row cl"> <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3"> <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button> <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button> </div> </div> </form> </div> {/block} {block name="script"} <script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script> <script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script> <script> $(function () { $("[name='sex'][value='{$vo.sex ?? '0'}']").attr("checked", true); $('.skin-minimal input').iCheck({ checkboxClass: 'icheckbox-blue', radioClass: 'iradio-blue', increaseArea: '20%' }); $("#form").Validform({ tiptype: 2, ajaxPost: true, showAllError: true, callback: function (ret){ ajax_progress(ret); } }); }) </script> {/block} ``` ### view/user_info/config.php ``` <?php return array ( 'module' => 'admin', 'menu' => array ( 0 => 'add', 1 => 'delete', 2 => 'recyclebin', ), 'create_config' => true, 'controller' => 'UserInfo', 'title' => '用戶信息', 'form' => array ( 0 => array ( 'title' => '姓名', 'name' => 'name', 'type' => 'text', 'option' => '', 'default' => '未填寫', 'search' => '1', 'search_type' => 'text', 'require' => '1', 'validate' => array ( 'datatype' => '*', 'nullmsg' => '請填寫姓名', 'errormsg' => '', ), ), 1 => array ( 'title' => '性別', 'name' => 'sex', 'type' => 'radio', 'option' => '1:男#2:女#0:未填寫', 'default' => '0', 'sort' => '1', 'search' => '1', 'search_type' => 'select', 'require' => '1', 'validate' => array ( 'datatype' => '*', 'nullmsg' => '', 'errormsg' => '', ), ), 2 => array ( 'title' => '年齡', 'name' => 'age', 'type' => 'number', 'option' => '', 'default' => '', 'sort' => '1', 'search_type' => 'text', 'require' => '1', 'validate' => array ( 'datatype' => 'n', 'nullmsg' => '', 'errormsg' => '年齡必須是數組', ), ), 4 => array ( 'title' => '生日', 'name' => 'birthday', 'type' => 'date', 'option' => '', 'default' => '', 'search_type' => 'text', 'validate' => array ( 'datatype' => '/^\\d{4}\\-\\d{1,2}\\-\\d{1,2}$/', 'nullmsg' => '', 'errormsg' => '生日必須是yy-mm-dddd格式', ), ), 3 => array ( 'title' => '郵箱', 'name' => 'email', 'type' => 'text', 'option' => '', 'default' => '', 'search' => '1', 'search_type' => 'text', 'require' => '1', 'validate' => array ( 'datatype' => 'e', 'nullmsg' => '', 'errormsg' => '郵箱格式錯誤', ), ), ), 'create_table' => '1', 'create_table_force' => '1', 'table_engine' => 'InnoDB', 'table_name' => '', 'field' => array ( 1 => array ( 'name' => 'name', 'type' => 'char(18)', 'default' => '', 'not_null' => '1', 'key' => '1', 'comment' => '姓名', 'extra' => '', ), 2 => array ( 'name' => 'sex', 'type' => 'tinyint(1)', 'default' => '0', 'not_null' => '1', 'key' => '1', 'comment' => '性別', 'extra' => 'unsigned', ), 3 => array ( 'name' => 'age', 'type' => 'tinyint(3)', 'default' => '0', 'not_null' => '1', 'key' => '1', 'comment' => '年齡', 'extra' => 'unsigned', ), 4 => array ( 'name' => 'birthday', 'type' => 'date', 'default' => 'NULL', 'not_null' => '1', 'comment' => '生日', 'extra' => '', ), 5 => array ( 'name' => 'email', 'type' => 'char(32)', 'default' => '', 'not_null' => '1', 'comment' => '郵箱', 'extra' => '', ), ), 'model' => '1', 'auto_timestamp' => '1', 'validate' => '1', ); ``` ### validate/UserInfo.php ``` <?php namespace app\admin\validate; use think\Validate; class UserInfo extends Validate { protected $rule = [ "name|姓名" => "require", "sex|性別" => "require", "age|年齡" => "require", "birthday|生日" => "", "email|郵箱" => "require", ]; } ``` ### model/UserInfo.php ``` <?php namespace app\admin\model; use think\Model; class UserInfo extends Model { // 指定表名,不含前綴 protected $name = 'user_info'; // 開啟自動寫入時間戳字段 protected $autoWriteTimestamp = 'int'; } ``` ## 生成數據表 下面是 Linux 版 Navicat 截圖 ![](https://box.kancloud.cn/0bdaac055ebd5058f933a1669d4bf928_626x339.png) 下面是從 Linux 版 Navicat 中拷貝出的建表語句 ``` CREATE TABLE `tp_user_info` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '用戶信息主鍵', `name` char(18) NOT NULL DEFAULT '' COMMENT '姓名', `sex` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '性別', `age` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '年齡', `birthday` date NOT NULL COMMENT '生日', `email` char(32) NOT NULL DEFAULT '' COMMENT '郵箱', `isdelete` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '刪除狀態,1-刪除 | 0-正常', `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '創建時間', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新時間', PRIMARY KEY (`id`), KEY `name` (`name`), KEY `sex` (`sex`), KEY `age` (`age`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用戶信息'; ``` ## 生成日志 `runtime/log` 目錄下的日志原文: >[info] 在當天的日志中搜索 build_sql 即可搜索到,日志原文中的標記是 BUILD_SQL ``` [ 2016-11-10T20:22:27+08:00 ] 127.0.0.1 127.0.0.1 POST /admin/generate/run.html [ log ] tpadmin.dev/admin/generate/run.html [運行時間:0.046898s][吞吐率:21.32req/s] [內存消耗:6,291.78kb] [文件加載:63] [ sql ] BUILD_SQL: DROP TABLE IF EXISTS `tp_user_info`; CREATE TABLE `tp_user_info` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '用戶信息主鍵', `name` char(18) NOT NULL DEFAULT '' COMMENT '姓名', `sex` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '性別', `age` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '年齡', `birthday` date NOT NULL COMMENT '生日', `email` char(32) NOT NULL DEFAULT '' COMMENT '郵箱', `isdelete` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '刪除狀態,1-刪除 | 0-正常', `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '創建時間', `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新時間', PRIMARY KEY (`id`), KEY `name` (`name`), KEY `sex` (`sex`), KEY `age` (`age`) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '用戶信息'; --------------------------------------------------------------- ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看