You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/extend/suning-sdk-php/SelectSuningRequest.php

86 lines
2.1 KiB

8 months ago
<?php
/**
* 苏宁开放平台接口 - 查询业务类基类
*
* @author jerry(14033184@cnsuning.com)
* @date 2014-05-28
*/
class SelectSuningRequest
{
protected $apiParams = array();
/**
* 页码。取值范围:大于零的整数;默认值为1,即返回第一页数据
*/
protected $pageNo;
/**
* 每页条数。取值范围:大于零的整数;最大值:50。默认值:10
*/
protected $pageSize;
/**
* 是否参数校验(默认false,测试及生产建议为true)
*/
protected $checkParam = false;
public function getCheckParam() {
return $this->checkParam;
}
public function setCheckParam($checkParam) {
$this->checkParam = $checkParam;
}
public function setPageNo($pageNo)
{
$this->pageNo = $pageNo;
$this->apiParams["pageNo"] = $pageNo;
}
public function getPageNo()
{
return $this->pageNo;
}
public function setPageSize($pageSize)
{
$this->pageSize = $pageSize;
$this->apiParams["pageSize"] = $pageSize;
}
public function getPageSize()
{
return $this->pageSize;
}
protected $pointParams = array();
public function getPointParams() {
return $this->pointParams;
}
public function setPointParams($pointParams) {
$this->pointParams = $pointParams;
}
public function check($pageNoMin = 1, $pageNoMax = 99999, $pageSizeMin = 10, $pageSizeMax = 50)
{
// 若为空,设置默认值
if (RequestCheckUtil::checkEmpty($this->pageNo)){
$this->pageNo = $pageNoMin;
}
if (RequestCheckUtil::checkEmpty($this->pageSize)){
$this->pageSize = $pageSizeMin;
}
RequestCheckUtil::checkPositiveInteger($this->pageNo, 'pageNo');
RequestCheckUtil::checkMinValue($this->pageNo, $pageNoMin, 'pageNo');
RequestCheckUtil::checkMaxValue($this->pageNo, $pageNoMax, 'pageNo');
RequestCheckUtil::checkPositiveInteger($this->pageSize, 'pageSize');
RequestCheckUtil::checkMinValue($this->pageSize, $pageSizeMin, 'pageSize');
RequestCheckUtil::checkMaxValue($this->pageSize, $pageSizeMax, 'pageSize');
}
}
?>