load($hash)) && $data ) { return $data; } $sql = 'SELECT * FROM ' . $this->getTable() . ' WHERE ' . $this->getAdapter()->quoteInto($this->getAdapter()->quoteIdentifier('apikey') . ' = ?', $apikey); $rows = $this->getAdapter()->query($sql)->fetchAll(); unset($sql); if (is_array($rows) && count($rows) > 0) { $cache->save($rows[0], $hash, array(), 86400); //缓存一天吧 return $rows[0]; } return null; } /** * 获取所有用户程序信息 * * @return array|null */ public function getUserApp() { $db = $this->getAdapter(); $select = $db->select()->from($this->getTable())->where('xtype = ?', self::APP_TYPE_USER); $rows = $db->fetchAll($select); $result = null; if (is_array($rows)) { $result = $rows; } return $result; } /** * 获取所有用户程序标识 * * @return array|null */ public function getUserAppID() { $userApp = $this->getUserApp(); $result = null; if ( $userApp ) { $result = array(); foreach ($userApp as $app) { $result[] = $app['appid']; } } return $result; } /** * @return Com_Model_App */ public static function instance() { return parent::_instance(__CLASS__); } } // End ^ LF ^ encoding