zoukankan      html  css  js  c++  java
  • fastadmin

    1.结构  list+total

     return ['list' => $list, 'total' => $total];

    list需要用limit分页,页码字段是pageNumber

    2.赋值

    如果获取到keyValue的值的话就根据值来做相应的where条件

    在编辑页面初始化页面的时候,第一次会将关联id作为keyValue传到后台,点击选择框之后的异步调用则不会传keyValue

    3.示例

        public function query()
        {
            $account = Admin::get($this->auth->id);
            $page = $this->request->request('pageNumber')?:1;
            $param = input();
            $id = (isset($param['keyValue'])&&$param['keyValue'])>0?$param['keyValue']:0;
            $zhi = 10;
            $tiao = ($page-1)*$zhi;
            $where = ['status' => 'normal'];
            if($account['position_ids']!="all"&&$account['position_ids']!=""){
                $where['position_id'] = ["IN",$account['position_ids']];
            }
            if($id>0){
                $where['id'] = $id;
            }
            if($param['username']!="") $where['username'] = ['like',"%{$param['username']}%"];
            $list    = Db::name("user")->where($where)->field("id,username,position_id")->limit($tiao,$zhi)->select();
            $total    = Db::name("user")->where($where)->field("id,username,position_id")->count();
            return ['list' => $list, 'total' => $total];
        }
    技术最菜,头发最少
  • 相关阅读:
    bt5设置IP
    flyCoding
    [Cocoa][译]苹果 Cocoa 编码规范中文版
    [BZOJ4569] [Scoi2016]萌萌哒
    BZOJ4899]记忆的轮廓
    [BZOJ1701] [Usaco2007 Jan]Cow School牛学校
    [Poi2011]Lightning Conductor
    [BZOJ4709] [Jsoi2011] 柠檬
    决策单调性优化dp 专题练习
    2369. 区间
  • 原文地址:https://www.cnblogs.com/gushengyan/p/14866871.html
Copyright © 2011-2022 走看看