* Date: 2018-4-3 */ namespace weapp\Footernav\model; use think\Model; /** * 模型 */ class FooternavModel extends Model { /** * 数据表名,不带前缀 */ public $name = 'weapp_footernav'; public $code = 'Footernav'; //初始化 protected function initialize() { // 需要调用`Model`的`initialize`方法 parent::initialize(); } /** * 获取数据 */ public function getWeappData() { static $_value = []; if (empty($_value[$this->code])) { $row = M('weapp')->where('code',$this->code)->find(); if (!empty($row['data'])&&$row['data']!="[]") { $row['data'] = unserialize($row['data']); } $_value[$this->code] = $row; } return $_value[$this->code]; } }