no message
This commit is contained in:
parent
d247642103
commit
5dcb99d1db
@ -18,11 +18,12 @@ class Dog extends Mod\Base {
|
||||
|
||||
public $oModelSelf;
|
||||
public $sPrimaryKey = "id";
|
||||
public $iStrMaxLen = 50;
|
||||
public $iStrMaxLen;
|
||||
public $aStrField = [];
|
||||
public $aInFormat = [];
|
||||
public $aOutFormat = [];
|
||||
public $sDogName;
|
||||
private $aMsg = [];
|
||||
|
||||
public function __construct($oModelSelf = false)
|
||||
{
|
||||
@ -37,6 +38,14 @@ class Dog extends Mod\Base {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -261,10 +270,9 @@ class Dog extends Mod\Base {
|
||||
}
|
||||
|
||||
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, $this->iStrMaxLen, 'UTF-8')."……";
|
||||
return mb_substr($input, 0, (int) $this->iStrMaxLen, 'UTF-8')."……";
|
||||
|
||||
}
|
||||
|
||||
@ -383,7 +391,9 @@ class Dog extends Mod\Base {
|
||||
}
|
||||
|
||||
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;
|
||||
@ -454,28 +464,41 @@ class Dog extends Mod\Base {
|
||||
|
||||
if ($iPageTotal > 1) {
|
||||
if ($iPage) {
|
||||
$aMsg["页"]["页当前"] = $iPage;
|
||||
$this->aMsg["页"]["页当前"] = $iPage;
|
||||
}
|
||||
|
||||
if ($iPageTotal) {
|
||||
$aMsg["页"]["页总数"] = $iPageTotal;
|
||||
$this->aMsg["页"]["页总数"] = $iPageTotal;
|
||||
}
|
||||
|
||||
if ($iPagePer) {
|
||||
$aMsg["页"]["行每页"] = $iPagePer;
|
||||
$this->aMsg["页"]["行每页"] = $iPagePer;
|
||||
}
|
||||
|
||||
if ($iCount) {
|
||||
$aMsg["页"]["行总数"] = $iCount;
|
||||
$this->aMsg["页"]["行总数"] = $iCount;
|
||||
}
|
||||
}
|
||||
|
||||
$aData = $this->filterDataList($aData);
|
||||
$aData = $this->dataInsterMsgList($aData, $aMsg);
|
||||
// $aData = $this->dataInsterMsgList($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)
|
||||
{
|
||||
if ($aMsg) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user