当前位置: 首页>>代码示例>>PHP>>正文


PHP R::count方法代码示例

本文整理汇总了PHP中RedBeanPHP\R::count方法的典型用法代码示例。如果您正苦于以下问题:PHP R::count方法的具体用法?PHP R::count怎么用?PHP R::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedBeanPHP\R的用法示例。


在下文中一共展示了R::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $perPage = 999999;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $where = [];
     $where[] = 1;
     $queryParam = [];
     if (!empty($_GET['geo_id'])) {
         $where[] = "geo_id = ?";
         $queryParam[] = $_GET['geo_id'];
     }
     $where = implode(" AND ", $where);
     $queryParam[] = $start;
     $queryParam[] = $perPage;
     $items = R::getAll('SELECT * FROM contactdealer WHERE ' . $where . ' LIMIT ?,?', $queryParam);
     //$items = R::find('contactdealer', 'LIMIT ?,?', [$start, $perPage]);
     $count = R::count('contactdealer', $where, array_slice($queryParam, 0, -2));
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     // $itemsExport = R::exportAll($items);
     $this->builds($items);
     header('Content-Type: application/json');
     echo json_encode(['items' => $items, 'page' => $page, 'maxPage' => $maxPage, 'total' => $count], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     exit;
 }
开发者ID:nuiz,项目名称:duragres,代码行数:25,代码来源:ApiContactdealerController.php

示例2: index

 public function index()
 {
     $perPage = 999999;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $where = [];
     $where[] = 1;
     $queryParam = [];
     if (!empty($_GET['type'])) {
         $where[] = "type = ?";
         $queryParam[] = $_GET['type'];
     }
     if (!empty($_GET['porcelain_type'])) {
         $where[] = "porcelain_type = ?";
         $queryParam[] = $_GET['porcelain_type'];
     }
     if (!empty($_GET['size'])) {
         $where[] = "size = ?";
         $queryParam[] = $_GET['size'];
     }
     if (!empty($_GET['size_unit'])) {
         $where[] = "size_unit = ?";
         $queryParam[] = $_GET['size_unit'];
     }
     if (!empty($_GET['style'])) {
         $where[] = "style = ?";
         $queryParam[] = $_GET['style'];
     }
     if (!empty($_GET['company'])) {
         $where[] = "company = ?";
         $queryParam[] = $_GET['company'];
     }
     if (!empty($_GET['is_group'])) {
         $where[] = "company = ?";
         $queryParam[] = $_GET['company'];
     }
     if (!empty($_GET['pattern_id'])) {
         $pattern = R::findOne("room_pattern", "id=?", [$_GET['pattern_id']]);
         if (isset($pattern["product_use"])) {
             $ids = trim($pattern["product_use"], ",");
             $ids = explode(",", $ids);
         } else {
             $ids = [0];
         }
         $where[] = "id IN (" . R::genSlots($ids) . ")";
         $queryParam = array_merge($queryParam, $ids);
     }
     $where = implode(" AND ", $where);
     $queryParam[] = $start;
     $queryParam[] = $perPage;
     $items = R::getAll('SELECT product.* FROM product WHERE ' . $where . ' ORDER BY is_hot DESC, is_new DESC, created_at DESC LIMIT ?,?', $queryParam);
     $count = R::count('product', $where, array_slice($queryParam, 0, -2));
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     // $itemsExport = R::exportAll($items);
     $this->builds($items);
     header('Content-Type: application/json');
     echo json_encode(['items' => $items, 'page' => $page, 'maxPage' => $maxPage, 'total' => $count], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     exit;
 }
开发者ID:nuiz,项目名称:duragres,代码行数:59,代码来源:ApiProductController.php

示例3: index

 public function index()
 {
     $perPage = 10;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $items = R::find('user', 'level=2 LIMIT ?,?', [$start, $perPage]);
     $count = R::count('user');
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     $this->slim->render("user/list.php", ['items' => $items, 'page' => $page, 'maxPage' => $maxPage]);
 }
开发者ID:nuiz,项目名称:um,代码行数:10,代码来源:UserController.php

示例4: index

 public function index()
 {
     $perPage = 10;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $items = R::find('account', 'email IS NOT NULL LIMIT ?,?', [$start, $perPage]);
     $count = R::count('account', 'email IS NOT NULL');
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     $itemsExport = R::exportAll($items);
     $this->builds($itemsExport);
     $this->slim->render("user/list.php", ['items' => $itemsExport, 'page' => $page, 'maxPage' => $maxPage]);
 }
开发者ID:nuiz,项目名称:duragres,代码行数:12,代码来源:UserController.php

示例5: index

 public function index()
 {
     $perPage = 10;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $items = R::find('news', ' ORDER BY sort_order LIMIT ?,?', [$start, $perPage]);
     $itemsAll = R::find('news', 'ORDER BY sort_order');
     $itemsAll = R::exportAll($items);
     $count = R::count('news');
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     $this->slim->render("news/list.php", ['items' => $items, 'itemsAll' => $itemsAll, 'page' => $page, 'maxPage' => $maxPage]);
 }
开发者ID:nuiz,项目名称:duragres,代码行数:12,代码来源:NewsController.php

示例6: index

 public function index($roomId)
 {
     $perPage = 10;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $room = R::findOne('room', 'id = ?', [$roomId]);
     $items = R::find('room_pattern', 'room_id = ? LIMIT ?,?', [$roomId, $start, $perPage]);
     $count = R::count('room_pattern', 'room_id = ?', [$roomId]);
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     $itemsExport = R::exportAll($items);
     $this->builds($itemsExport);
     $this->slim->render("room/pattern/list.php", ['room' => $room, 'items' => $itemsExport, 'page' => $page, 'maxPage' => $maxPage]);
 }
开发者ID:nuiz,项目名称:duragres,代码行数:13,代码来源:RoomPatternController.php

示例7: validate

 public function validate()
 {
     $this->errors = [];
     $this->error = false;
     $this->isValid = true;
     if (empty($this->attr['name'])) {
         $this->pushError("name empty");
     }
     $id = @$this->attr["id"] ? $this->attr["id"] : 0;
     if (R::count("room", "name = ? AND id != ?", [$this->attr["name"], $id]) > 0) {
         $this->pushError("Duplicate name " . $this->attr["name"]);
     }
     return !$this->error;
 }
开发者ID:nuiz,项目名称:duragres,代码行数:14,代码来源:RoomForm.php

示例8: index

 public function index()
 {
     $perPage = 10;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $items = R::find('room', 'LIMIT ?,?', [$start, $perPage]);
     $count = R::count('room');
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     $itemsExport = R::exportAll($items);
     $this->builds($itemsExport);
     header('Content-Type: application/json');
     echo json_encode(['items' => $itemsExport, 'page' => $page, 'maxPage' => $maxPage, 'total' => $count], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     exit;
 }
开发者ID:nuiz,项目名称:duragres,代码行数:14,代码来源:ApiRoomController.php

示例9: index

 public function index()
 {
     $perPage = 10;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $items = R::find('contactdealer', 'LIMIT ?,?', [$start, $perPage]);
     $count = R::count('contactdealer');
     foreach ($items as &$item) {
         $item->ownProvince = R::getRow('SELECT * FROM provinces WHERE province_id=?', [$item->province_id]);
         $item->ownGeography = R::getRow('SELECT * FROM geography WHERE geo_id=?', [$item->geo_id]);
         // var_dump($item); exit();
     }
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     $this->slim->render("contactdealer/list.php", ['items' => $items, 'page' => $page, 'maxPage' => $maxPage]);
 }
开发者ID:nuiz,项目名称:duragres,代码行数:15,代码来源:ContactdealerController.php

示例10: CreateInitialAdmin

 public static function CreateInitialAdmin($container)
 {
     if (!R::count('user')) {
         $admin = R::dispense('user');
         $admin->username = 'admin';
         $admin->is_admin = true;
         $admin->is_active = true;
         $admin->name = 'Anonymous';
         $admin->image = '';
         $admin->logins = 0;
         $admin->last_login = null;
         $admin->password_hash = password_hash('admin', PASSWORD_BCRYPT);
         $admin->active_token = null;
         R::store($admin);
     }
 }
开发者ID:kiswa,项目名称:SMPLog,代码行数:16,代码来源:Auth.php

示例11: index

 public function index()
 {
     $perPage = 999999;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $where = [];
     $whereParam = [];
     if (!empty($_GET['room_id'])) {
         $where[] = "room_id = ?";
         $whereParam[] = $_GET['room_id'];
     }
     $whereString = implode("AND", $where);
     $items = R::find('room_pattern', $whereString . ' LIMIT ?,?', array_merge($whereParam, [$start, $perPage]));
     $count = R::count('room_pattern', $whereString, $whereParam);
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     $itemsExport = R::exportAll($items);
     $this->builds($itemsExport);
     header('Content-Type: application/json');
     echo json_encode(['items' => $itemsExport, 'page' => $page, 'maxPage' => $maxPage, 'total' => $count], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     exit;
 }
开发者ID:nuiz,项目名称:duragres,代码行数:21,代码来源:ApiPatternController.php

示例12: comicDetails

 /**
  * @RequestMapping(url="account/comic/{comic_id}/{vol}",type="template",auth=true)
  * @RequestParams(true)
  * @Role(USER)
  * @Role(ADMIN)
  */
 function comicDetails($model, $comic_id = null, $action = null, $title = null, $vol = 1)
 {
     Service::DBSetup();
     $comic = R::load("comic", $comic_id);
     if ($action == "add_chapter" && $title !== null) {
         $chapter = R::dispense("chapter");
         $chapter->title = $title;
         $chapter->uid = $this->user->uid;
         $chapter->vol = $vol;
         $chapter->comic = $comic;
         $chapter->inorder = R::count("chapter", "comic_id = :comic_id AND vol = :vol", array("comic_id" => $comic_id, "vol" => $vol));
         $chapter->time = microtime(true);
         R::store($chapter);
     }
     $chapters = R::find("chapter", "comic_id = :comic_id AND vol = :vol", array("comic_id" => $comic_id, "vol" => $vol));
     //print_r($comic);
     $model->assign("comic", $comic);
     $model->assign("chapters", $chapters);
     $model->assign("user", $this->user);
     return "member/comic";
 }
开发者ID:rx-projects,项目名称:comicasa,代码行数:27,代码来源:AdminController.php

示例13: checkOut

 public static function checkOut($number, Publisher $publisher)
 {
     if (R::count('record', ' number = :number AND isnull(`in`) ', ['number' => $number]) > 0) {
         return null;
     }
     $territoryBean = R::findOne('territory', ' number = :number ', ['number' => $number]);
     if ($territoryBean === null) {
         return null;
     }
     $bean = R::dispense('record');
     $bean->number = $number;
     $bean->out = time();
     $bean->in = null;
     $bean->checkOutBy = App::user()->id;
     $record = new Record($number, $bean);
     $territoryBean->sharedRecordList[] = $bean;
     $publisherBean = $publisher->bean();
     $publisherBean->ownRecordList[] = $bean;
     R::storeAll([$bean, $territoryBean, $publisherBean]);
     $publisher->records[] = $record;
     return $record;
 }
开发者ID:vallevista,项目名称:etm2.temp,代码行数:22,代码来源:Record.php

示例14: search

 public function search()
 {
     $page = $this->getAttr("page");
     $perPage = $this->getAttr("perPage");
     $start = ($page - 1) * $perPage;
     $query = "";
     $bindParam = [];
     $keyword = $this->getAttr("keyword");
     $keyword = trim($keyword);
     if (!empty($keyword)) {
         $query .= "first_name LIKE :keyword OR last_name LIKE :keyword";
         $bindParam["keyword"] = '%' . $keyword . '%';
     }
     $this->count = R::count('employee', $query, $bindParam);
     $page = floor($this->count / $perPage);
     $this->maxPage = $page + ($this->count % $perPage == 0 ? 0 : 1);
     $query .= " LIMIT :start,:perPage";
     $bindParam["start"] = $start;
     $bindParam["perPage"] = $perPage;
     $this->items = R::find('employee', $query, $bindParam);
     $this->injectsUser($this->items);
 }
开发者ID:nuiz,项目名称:um,代码行数:22,代码来源:EmployeeSearchForm.php

示例15: index

 public function index()
 {
     $perPage = 10;
     $page = @$_GET['page'] ? $_GET['page'] : 1;
     $start = ($page - 1) * $perPage;
     $where = [];
     $where[] = 1;
     $queryParam = [];
     if (!empty($_GET['type'])) {
         $where[] = "type = ?";
         $queryParam[] = $_GET['type'];
     }
     if (!empty($_GET['size'])) {
         $where[] = "size = ?";
         $queryParam[] = $_GET['size'];
     }
     if (!empty($_GET['style'])) {
         $where[] = "style = ?";
         $queryParam[] = $_GET['style'];
     }
     if (!empty($_GET['company'])) {
         $where[] = "company = ?";
         $queryParam[] = $_GET['company'];
     }
     $where = implode(" AND ", $where);
     $queryParam[] = $start;
     $queryParam[] = $perPage;
     $items = R::getAll('SELECT * FROM product WHERE ' . $where . ' ORDER BY is_hot DESC, is_new DESC, created_at DESC LIMIT ?,?', $queryParam);
     $count = R::count('product', $where, array_slice($queryParam, 0, -2));
     $maxPage = floor($count / $perPage) + ($count % $perPage == 0 ? 0 : 1);
     $form = [];
     $form["type"] = @$_GET["type"] ?: "";
     $form["size"] = @$_GET["size"] ?: "";
     $form["style"] = @$_GET["style"] ?: "";
     $form["company"] = @$_GET["company"] ?: "";
     $this->slim->render("product/list.php", ['items' => $items, 'page' => $page, 'maxPage' => $maxPage, 'form' => $form]);
 }
开发者ID:nuiz,项目名称:duragres,代码行数:37,代码来源:ProductController.php


注:本文中的RedBeanPHP\R::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。