作者 董瑞恩
1 个管道 的构建 通过 耗费 1 秒

cost

... ... @@ -38,6 +38,32 @@ class AdminCostController extends AdminBaseController{
public function editPost(){
$param=$this->request->param();
dump($param);
if (empty($param['free'])){
$param['free']=0;
}else{
$param['free']=1;
}
$cost=[
'free' => $param['free'],
'cost' => $param['cost'],
'ceiling' => $param['ceiling'],
'update_time' => time()
];
$interval=[
'start_time' => $param['start_time'],
'end_time' =>$param['end_time'],
'price' => $param['price'],
'update_time' => time()
];
try{
Db::startTrans();
Db::name('cost')->where('id',1)->update($cost);
Db::name('interval')->where('id',1)->update($interval);
}catch (\Exception $exception){
Db::rollback();
$this->error('保存失败');
}
Db::commit();
$this->success('保存成功');
}
}
\ No newline at end of file
... ...
... ... @@ -11,7 +11,7 @@
<li class="active"><a>费用管理</a></li>
</ul>
<!--js-ajax-form margin-top-20-->
<form action="{:url('AdminCost/editPost')}" method="post" class="form-horizontal">
<form action="{:url('AdminCost/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
<div class="row">
<div class="col-md-3">
<table class="table table-bordered">
... ...