no message
This commit is contained in:
parent
d247642103
commit
5dcb99d1db
@ -18,11 +18,12 @@ class Dog extends Mod\Base {
|
|||||||
|
|
||||||
public $oModelSelf;
|
public $oModelSelf;
|
||||||
public $sPrimaryKey = "id";
|
public $sPrimaryKey = "id";
|
||||||
public $iStrMaxLen = 50;
|
public $iStrMaxLen;
|
||||||
public $aStrField = [];
|
public $aStrField = [];
|
||||||
public $aInFormat = [];
|
public $aInFormat = [];
|
||||||
public $aOutFormat = [];
|
public $aOutFormat = [];
|
||||||
public $sDogName;
|
public $sDogName;
|
||||||
|
private $aMsg = [];
|
||||||
|
|
||||||
public function __construct($oModelSelf = false)
|
public function __construct($oModelSelf = false)
|
||||||
{
|
{
|
||||||
@ -37,6 +38,14 @@ class Dog extends Mod\Base {
|
|||||||
|
|
||||||
public function _setStrField($aStrField)
|
public function _setStrField($aStrField)
|
||||||
{
|
{
|
||||||
|
$this->iStrMaxLen = ModelDogOption::_hit($this->sDogName, "str_len_max");
|
||||||
|
|
||||||
|
if (!$this->iStrMaxLen) {
|
||||||
|
// throw new \Exception("需要设置dog的option的str_len_max");
|
||||||
|
$this->iStrMaxLen = 60;
|
||||||
|
$this->aMsg["警告882"] = "需要设置dog的option的str_len_max,临时设为60。";
|
||||||
|
}
|
||||||
|
|
||||||
$this->aStrField = $aStrField;
|
$this->aStrField = $aStrField;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,10 +270,9 @@ class Dog extends Mod\Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function subStr($input) {
|
private function subStr($input) {
|
||||||
|
if (mb_strlen($input, 'UTF-8') > (int) $this->iStrMaxLen) {
|
||||||
|
|
||||||
if (mb_strlen($input, 'UTF-8') > $this->iStrMaxLen) {
|
return mb_substr($input, 0, (int) $this->iStrMaxLen, 'UTF-8')."……";
|
||||||
|
|
||||||
return mb_substr($input, 0, $this->iStrMaxLen, 'UTF-8')."……";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +391,9 @@ class Dog extends Mod\Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$iLimit) {
|
if (!$iLimit) {
|
||||||
throw new \Exception("需要option里的dog_limit");
|
// throw new \Exception("需要option里的dog_limit");
|
||||||
|
$iLimit = 30;
|
||||||
|
$this->aMsg["警告881"] = "需要option里的dog_limit,临时设为30。";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $iLimit;
|
return $iLimit;
|
||||||
@ -454,28 +464,41 @@ class Dog extends Mod\Base {
|
|||||||
|
|
||||||
if ($iPageTotal > 1) {
|
if ($iPageTotal > 1) {
|
||||||
if ($iPage) {
|
if ($iPage) {
|
||||||
$aMsg["页"]["页当前"] = $iPage;
|
$this->aMsg["页"]["页当前"] = $iPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($iPageTotal) {
|
if ($iPageTotal) {
|
||||||
$aMsg["页"]["页总数"] = $iPageTotal;
|
$this->aMsg["页"]["页总数"] = $iPageTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($iPagePer) {
|
if ($iPagePer) {
|
||||||
$aMsg["页"]["行每页"] = $iPagePer;
|
$this->aMsg["页"]["行每页"] = $iPagePer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($iCount) {
|
if ($iCount) {
|
||||||
$aMsg["页"]["行总数"] = $iCount;
|
$this->aMsg["页"]["行总数"] = $iCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$aData = $this->filterDataList($aData);
|
$aData = $this->filterDataList($aData);
|
||||||
$aData = $this->dataInsterMsgList($aData, $aMsg);
|
// $aData = $this->dataInsterMsgList($aData);
|
||||||
|
|
||||||
return $aData;
|
return $aData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toJson($aData)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($this->aMsg && !is_string($aData)) {
|
||||||
|
if (is_object($aData)) {
|
||||||
|
$aData = $aData->toArray();
|
||||||
|
}
|
||||||
|
array_unshift($aData, $this->aMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::toJson($aData);
|
||||||
|
}
|
||||||
|
|
||||||
private function dataInsterMsgList($aData, $aMsg)
|
private function dataInsterMsgList($aData, $aMsg)
|
||||||
{
|
{
|
||||||
if ($aMsg) {
|
if ($aMsg) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user