/**
  * 获取外键数据来源
  * @param string $key 指定key获取
  * @return array|string 获取到的数据或指定key的值
  */
 public function getSysmodule($key = '')
 {
     $sysmoduleDB = new SysmoduleModelDB();
     if (empty($key)) {
         $sql = "SELECT `id`,`name` FROM `" . $sysmoduleDB->getTableName() . "`";
         $sysmoduleModelDBArr = $sysmoduleDB->getData($sql);
         $data = Common::createArr($sysmoduleModelDBArr, 'id', 'name');
     } else {
         $sql = "SELECT `name` FROM `" . $sysmoduleDB->getTableName() . "` WHERE `id` = ?";
         $data = $sysmoduleDB->getFirst($sql, array($key));
     }
     return $data;
 }
 public function detail()
 {
     $sid = intval($_GET['sub_mid']);
     if (md5(md5(md5(implode('|', array($sid, '!mrala', date('Y-m-d')))))) !== $_GET['sign']) {
         Message::showError('sign fail');
     } else {
         $submoduleDB = new SubmoduleModelDB();
         $submodule = $submoduleDB->getRow('SELECT mid, code, name FROM `' . $submoduleDB->getTableName() . '` WHERE id=?', array(intval($sid)));
         $moduleDB = new ModuleModelDB();
         $module = $moduleDB->getRow('SELECT sys_mid, pid FROM `' . $moduleDB->getTableName() . '` WHERE id=?', array(intval($submodule['mid'])));
         $sysmoduleDB = new SysmoduleModelDB();
         $sysmodule = $sysmoduleDB->getRow('SELECT `name` FROM `' . $sysmoduleDB->getTableName() . '` WHERE id=?', array(intval($module['sys_mid'])));
         $projectDB = new ProjectModelDB();
         $project = $projectDB->getRow('SELECT `name` FROM `' . $projectDB->getTableName() . '` WHERE id=?', array(intval($module['pid'])));
         $this->setView('project', $project);
         $this->setView('sysmodule', $sysmodule);
         $this->setView('submodule', $submodule);
         $this->setView('sub_mid', $sid);
         $this->display('mobile/details.html');
     }
 }
 public function logicResume()
 {
     $sysmoduleDB = new SysmoduleModelDB();
     $updateArr = array('' => 0);
     $whereArr = array();
     $whereArr['id'] = $_GET['id'];
     $rs = $sysmoduleDB->update($updateArr, $whereArr);
     Log::write($this->adminUserName, $this->ip, $_GET['id'], self::$state . "__" . self::$action, $rs);
     $rs ? Message::showSucc('恢复成功') : Message::showError('恢复失败:' . implode(" ", $sysmoduleDB->getErrorInfo()));
 }
<?php

/**
 * @Copyright (c) 2011, 新浪网运营部-网络应用开发部
 * All rights reserved.
 * 根据新增的系统module,添加到原有项目中
 * @author          wangxin <*****@*****.**>
 * @time            2011/3/2 15:03
 * @version         Id: 0.9
*/
require dirname(__FILE__) . "/global.php";
$moduleDB = new ModuleModelDB();
$sysmoduleDB = new SysmoduleModelDB();
$sysmoduleArr = $sysmoduleDB->getData("SELECT * FROM `" . $sysmoduleDB->getTableName() . "`");
$projectDB = new ProjectModelDB();
$projectArr = $projectDB->getData("SELECT * FROM `" . $projectDB->getTableName() . "`");
foreach ($projectArr as $v) {
    $moduleArr = $moduleDB->getData("SELECT * FROM `" . $moduleDB->getTableName() . "` WHERE `pid` = ?", array($v['id']));
    $moduleIdArr = array();
    foreach ($moduleArr as $vv) {
        $moduleIdArr[] = $vv['sys_mid'];
    }
    foreach ($sysmoduleArr as $vv) {
        if (!in_array($vv['id'], $moduleIdArr)) {
            $insertArr = array();
            $insertArr['pid'] = $v['id'];
            $insertArr['sys_mid'] = $vv['id'];
            $insertArr['level'] = $vv['level'];
            $insertArr['sms_limit'] = $vv['sms_limit'];
            $insertArr['mail_limit'] = $vv['mail_limit'];
            $insertArr['sms_status'] = 1;