/** * 获取外键数据来源 * @param string $key 指定key获取 * @return array|string 获取到的数据或指定key的值 */ public static function getGroups($key = '') { $groupsDB = new GroupsModelDB(); if (empty($key)) { $sql = "SELECT `id`,`name` FROM `" . $groupsDB->getTableName() . "`"; $groupsModelDBArr = $groupsDB->getData($sql); $data = Common::createArr($groupsModelDBArr, $arrKey = 'id', $arrValue = 'name'); } else { $sql = "SELECT `name` FROM `" . $groupsDB->getTableName() . "` WHERE `id` = ?"; $data = $groupsDB->getFirst($sql, array($key)); } return $data; }
public function logicResume() { $groupsDB = new GroupsModelDB(); $updateArr = array('' => 0); $whereArr = array(); $whereArr['id'] = $_GET['id']; $rs = $groupsDB->update($updateArr, $whereArr); Log::write($this->adminUserName, $this->ip, $_GET['id'], self::$state . "__" . self::$action, $rs); $rs ? Message::showSucc('恢复成功') : Message::showError('恢复失败:' . implode(" ", $groupsDB->getErrorInfo())); }