|
@@ -38,6 +38,32 @@ class AdminCostController extends AdminBaseController{ |
|
@@ -38,6 +38,32 @@ class AdminCostController extends AdminBaseController{ |
38
|
|
38
|
|
39
|
public function editPost(){
|
39
|
public function editPost(){
|
40
|
$param=$this->request->param();
|
40
|
$param=$this->request->param();
|
41
|
- dump($param);
|
41
|
+ if (empty($param['free'])){
|
|
|
42
|
+ $param['free']=0;
|
|
|
43
|
+ }else{
|
|
|
44
|
+ $param['free']=1;
|
|
|
45
|
+ }
|
|
|
46
|
+ $cost=[
|
|
|
47
|
+ 'free' => $param['free'],
|
|
|
48
|
+ 'cost' => $param['cost'],
|
|
|
49
|
+ 'ceiling' => $param['ceiling'],
|
|
|
50
|
+ 'update_time' => time()
|
|
|
51
|
+ ];
|
|
|
52
|
+ $interval=[
|
|
|
53
|
+ 'start_time' => $param['start_time'],
|
|
|
54
|
+ 'end_time' =>$param['end_time'],
|
|
|
55
|
+ 'price' => $param['price'],
|
|
|
56
|
+ 'update_time' => time()
|
|
|
57
|
+ ];
|
|
|
58
|
+ try{
|
|
|
59
|
+ Db::startTrans();
|
|
|
60
|
+ Db::name('cost')->where('id',1)->update($cost);
|
|
|
61
|
+ Db::name('interval')->where('id',1)->update($interval);
|
|
|
62
|
+ }catch (\Exception $exception){
|
|
|
63
|
+ Db::rollback();
|
|
|
64
|
+ $this->error('保存失败');
|
|
|
65
|
+ }
|
|
|
66
|
+ Db::commit();
|
|
|
67
|
+ $this->success('保存成功');
|
42
|
}
|
68
|
}
|
43
|
} |
69
|
} |