where([ 'type' => $code ])->find()->toArray(); cache('common_info:'.$code, $val, 60 * 60 * 24); return $val; } public function getByCodeToInt(int $code) { $val = $this->getByCode($code); if (!$val || empty($val['value'])) { throw new SysException('代码获取失败, code: {}', $code); } return intval($val['value']); } }