BankAction.class.php文件
<?php
class BankAction extends Action{
public function index(){
$this->display();
}
public function add(){
$model=D('Busi');
//var_dump($model);
//$list=$model->select();
//var_dump($list);
//1.先判断用户选择的业务类型
if ($_GET['type']=='1'){
$data['type']='个人业务';
}elseif ($_GET['type']=='2'){
$data['type']='对公业务';
}else {
$data['type']='VIP业务';
}
//收集数据
$data['num']=$model->where("type='".$data['type']."' andstate=0")->count();
//$data['id']=1;
//$data['uid']=$data['id'];
//echo $data['uid'];
//$data['num']=$data['uid']-1;
//var_dump($data);
//$ctime=Date('Y-m-d H:i:s');
//echo $ctime;
$data['createtime']=Date('Y-m-d H:i:s');
//获得数据之后如何将数据添加到数据表中
$data['id']=$model->add($data);
$this->assign('data',$data);
$this->display();
}
}
?>
Index.html文件
<!DOCTYPE html PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"content="text/html; charset=UTF-8">
<title></title>
<style>
body{
background-color:#FFC}
#main{
border:dashed 2px #309;
width:500px;
height:300px;
background-color:#FCC;
margin:auto auto;
}
.dd{
width:200px;
height:60px;
background-color:#CCC;
margin:30px auto 10px auto;
font-size:43px;
text-align:center;
color: #309;
border:1px #090 solid;
}
</style>
</head>
<body>
<center><h1>银行业务系统</h1></center>
<div id="main">
<div class="dd"><a href="__APP__/Admin/Bank/add/type/1">个人业务</a></div>
<div class="dd"><a href="__APP__/Admin/Bank/add/type/2">对公业务</a></div>
<div class="dd"><a href="__APP__/Admin/Bank/add/type/3">VIP业务</a></div>
</div>
</body>
</html>
Add.html文件
<!DOCTYPE html PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"content="text/html; charset=UTF-8">
<title></title>
<style>
body{
background-color:#FFC}
#main{
border:dashed 2px #309;
width:500px;
height:300px;
background-color:#FCC;
margin:auto auto;
font-size:30px;
text-align:left;
}
</style>
</head>
<body>
<center><h1>业务信息</h1></center>
<div id="main">
业务类型:{$data.type}<br>
业务号码:{$data.id}<br>
当前时间:{$data.createtime}<br>
在您前面还有{$data.num}个用户,请您耐心等待<br>
今日有效,过号重取<br>
</div>
</body>
</html>
BusiModel.class.php文件
<?php
class BusiModel extends Model{
//告诉系统真实的表名在这里也可以采用驼峰法
protected $tableName='Bus';
//如果有前缀的话需要设置
//protected $trueTableName='';
//还可以告诉系统使用哪个数据库
//protected $dbName ='';
}
?>