<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                控制器 \Application\Admin\Controller\ImageCateController.class.php ~~~ <?php namespace Admin\Controller; use Admin\Controller\AuthController; use Think\Auth; class ImageCateController extends AuthController { public function _initialize() { parent::_initialize(); $this->cate = D('ImageCate'); } public function cate() { $count = $this->cate->where($map)->count(); $page = new \Think\Page($count , C('DEFAULT_PAGE_LIMIT')); // $page = new \Think\Page($count , 5); $list = $this->cate->where($map)->order('id desc')->limit($page->firstRow.','.$page->listRows)->select(); $this->list = $list; $this->page = $page->show(); $this->display(); } public function cateUpdate() { if (IS_POST) { $data = I('post.'); $res = $this->cate->update($data); if ($res) { $this->ajaxReturn(['code'=>1,'msg'=>'更新成功']); }else{ $this->ajaxReturn(['code'=>0,'msg'=>$this->cate->getError()]); } }else{ $id = I('id'); if ($id) { $this->info = $this->cate->where(array('id'=>$id))->find(); } $this->cate = $this->cate->where($map)->order('id desc')->select(); $this->display(); } } } ~~~ 模型-圖片分類 \Application\Admin\Model\ImageCateModel.class.php ~~~ <?php namespace Admin\Model; use Think\Model; class ImageCateModel extends Model { /* 數據庫設置 */ protected $connection = 'DB_CONFIG2'; /** * 自動驗證 * @var array */ protected $_validate = array( array('title', 'require', 'title 不能為空'), ); /** * 自動完成 * @var array */ protected $_auto = array( array('create_time', NOW_TIME, 1), array('update_time', NOW_TIME, 3), array('status',1), ); /** * 更新數據 * @DateTime 2018-05-04 * @return [type] [description] */ public function update($info){ $data = $this->create($info); // dump($this->getError());die; if(!$data){ //數據對象創建錯誤 return false; } /* 添加或更新數據 */ if(empty($data['id'])){ return $this->add(); }else{ return $this->save(); } } } ~~~ 數據表 ~~~ CREATE TABLE `lxl_image_cate` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(32) NOT NULL, `cid` int(11) NOT NULL, `create_time` int(11) NOT NULL, `update_time` int(11) NOT NULL, `status` tinyint(2) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ~~~ 圖片分類 \Application\Admin\View\ImageCate\cate.html ~~~ <include file="Public:header" /> <include file="Public:top" /> <!-- Contents --> <div id="Contents"> <!-- TopMain --> <div id="TopMain"> <!-- btn_box --> <div class="btn_box floatL"> <a href="{:U('Image/cateUpdate')}" > <input type="button" value="添加"> </a> </div> <!-- /btn_box --> </div> <!-- /TopMain --> <!-- MainForm --> <div id="MainForm"> <div class="form_boxA"> <h2>圖片分類列表</h2> <table cellpadding="0" cellspacing="0"> <tr> <th>ID</th> <th>圖片標題</th> <th>上級分類</th> <th>更新時間</th> <th>操作</th> </tr> <volist name="list" id="vo"> <tr> <td>{$vo.id}</td> <td>{$vo.title}</td> <td>{$vo.cid}</td> <td>{$vo.update_time|date="Y-m-d H:i:s",###}</td> <td> <a href="{:U('Image/cateUpdate',array('id'=>$vo[id]))}">編輯</a> </td> </tr> </volist> </table> </div> </div> <!-- /MainForm --> <!-- PageNum --> {$page} <!-- /PageNum --> </div> <!-- /Contents --> <include file="Public:footer" /> ~~~ 添加圖片分類 \Application\Admin\View\ImageCate\cateUpdate.html ~~~ <include file="Public:header" /> <include file="Public:top" /> <!-- Contents --> <div id="Contents"> <!-- TopMain --> <div id="TopMain"> <!-- btn_box --> <div class="btn_box floatL"> <a href="{:U('Image/cate')}" style="text-decoration: none;"> <input type="button" value="返回" > </a> </div> <!-- /btn_box --> </div> <!-- /TopMain --> <!-- MainForm --> <div id="MainForm" style="padding: 50px;"> <div class="form_boxC"> <form id="form" method="post"> <table cellpadding="0" cellspacing="0"> <tr> <th>標題</th> <td><div class="txtbox floatL"> <input type="text" name="title" id="title" size="100" value="{$info.title}" /> </div></td> </tr> <tr> <th>分類</th> <td> <div class="selectbox floatL mag_r20"> <select name="cid" id="cid"> <option value="0" <if condition="$info['cid'] eq 0">selected="selected"</if>>頂級分類</option> <volist name="cate" id="vo"> <option value="{$vo.id}" <if condition="$info['cid'] eq $vo['id']">selected="selected"</if>>{$vo.title}</option> </volist> </select> </div> </td> </tr> <tr> <th>&nbsp;</th> <td> <div class="btn_box" style="box-shadow: none;"> <input type="hidden" name="id" value="{$info.id}" /> <input type="submit" style="min-width:160px;" value="修改"> </div> </td> </tr> </table> </form> </div> </div> <!-- /MainForm --> </div> <!-- /Contents --> <script> $(function(){ $("#form").submit(function(e){ var res = $(this).serialize(); var url = "{:U('Image/cateUpdate')}"; $.ajax({ url: url, data: res, type: 'post', success:function(data){ if (data.code == 1) { layer.alert(data.msg,{icon:6},function (index) { layer.close(index); window.location.href = "{:U('Image/cate')}"; }); } else{ layer.alert(data.msg,{icon:5},function (index) { layer.close(index); window.location.reload(); }); } } }); return false; // 阻止表單跳轉 }); }); </script> <include file="Public:footer" /> ~~~
                  <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>

                              哎呀哎呀视频在线观看