• 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];
        }
    技术最菜,头发最少
  • 相关阅读:
    团队冲刺第三天
    NoSQL数据库基础概述
    团队开发冲刺第九天
    团队开发冲刺第八天
    团队开发冲刺第七天
    团队开发冲刺第六天
    团队开发冲刺第五天
    团队开发冲刺第四天
    团队开发冲刺第三天
    第九周总结
  • 原文地址:https://www.cnblogs.com/gushengyan/p/14866871.html
Copyright © 2020-2023  润新知