public function delete() { $list = D('Sys_viewmodel'); if ($_REQUEST[id] == "") { halt('输入的ID号不能为空'); } $listd = $list->where('id in (' . $_REQUEST[id] . ')')->findall(); $pid = $listd[0]['pid']; $listdel = D('Sys_viewmodel'); $listdel->delete($_REQUEST[id]); $delis = explode(',', $_REQUEST['id']); foreach ($delis as $delpid) { delbypid('Sys_viewfields', $delpid, 'vid'); delbypid('sys_viewcondition', $delpid, 'vid'); } redirect(__URL__ . "/index"); }
public function delete() { $list = D('Sys_projects'); if ($_REQUEST[id] == "") { halt('输入的ID号不能为空'); } require_once COMMON_PATH . "tp_common.php"; //引入自定义的类 require_once COMMON_PATH . "tpmaker.class.php"; //引入自定义的类 $buideid = $_REQUEST['id']; $t = new tpmaker(); $t->projectid = $buideid; $app_path = $t->getapppath(); if (deldir($app_path)) { msg("成功!"); delbypid(Sys_tables, $_REQUEST['id'], $pidf = 'pid'); $list->delete($_REQUEST['id']); } else { msg("失败!", 0); } sleep(3); redirect(__URL__ . "/index"); }
public function delete() { $list = D('Sys_tables'); //$Sys_tables->find($_REQUEST['id']); if ($_REQUEST[id] == "") { halt('输入的ID号不能为空'); } $listd = $list->where('id in (' . $_REQUEST[id] . ')')->findall(); $pid = $listd[0]['pid']; $listdel = D('Sys_tables'); $listdel->delete($_REQUEST[id]); $delis = explode(',', $_REQUEST['id']); //dump($delis); foreach ($delis as $delpid) { delbypid('Sys_fields', $delpid, 'pid'); } redirect(__URL__ . "/index/pid/" . $pid); // }
function delbypid($daoname, $inpid, $pidf = 'pid') { $table = D($daoname); //引入MODEL $tabledata = $table->findall($pidf . '=' . $inpid); //找出相应的数据 foreach ($tabledata as $creatdb) { $oldid = $creatdb['id']; delbypid('Sys_fields', $oldid, 'pid'); } //$table->deleteAll('pid='.$inpid); $table->where('pid=' . $inpid)->delete(); }