if(!empty($_GET['action']) and $_GET['action'] == 'configs')
{
//同一个表统一界面修改不同字段的值,用op区分
if(!empty($_GET['op'])){
$data = array($_GET['op'] => intval($_GET['id']));
$db->update('ew_username_components',$data,"uid=".$_SESSION['business']['uid']);
}
if(!empty($_GET['del']) and $_GET['del'] == 'del' and intval($_GET['id']) > 0){
$db->delete('ew_username_components_self', 'id = '.intval($_GET['id']));
}
$view->values = $db->fetchRow("SELECT * FROM ew_username_components WHERE uid='". $_SESSION['business']['uid']."'");
$view->self = $db->fetchAll("SELECT * FROM ew_username_components_self WHERE business_id='". $_SESSION['business']['uid']."'");
echo $view->render('business/components/configs.php');
}
//界面
<script>
function del(){
if(confirm('确定更改状态么?'))
return true;
else
return false;
}
</script>
<tr>
<td class="item_title">每天签到</td>
<td class="item_input">
<?php if($this->values['c1']==0){?><a href="components.php?action=configs&op=c1&id=1" onClick="return del()">已启用 点击关闭</a><?php }?>
<?php if($this->values['c1']==1){?><a href="components.php?action=configs&op=c1&id=0" onClick="return del()">已关闭 点击开启</a><?php }?>
<a href="components.php?action=sign">编辑查看</a></td>
</tr>
<tr>
<td class="item_title">邀请有奖</td>
<td class="item_input"> <?php if($this->values['c2']==0){?><a href="components.php?action=configs&op=c2&id=1" onClick="return del()">已启用 点击关闭</a><?php }?>
<?php if($this->values['c2']==1){?><a href="components.php?action=configs&op=c2&id=0" onClick="return del()">已关闭 点击开启</a><?php }?> <a href="components.php?action=invited">编辑查看</a></td>
</tr>